Permalink
Browse files

Merge branch 'master' of github.com:zencoder/assistly

Conflicts:
	assistly.gemspec
  • Loading branch information...
2 parents a495963 + 30ae1d9 commit 12a02ec2f26c520f0af8bb4366fa92a73278d2c1 Christopher Warren committed Jul 15, 2012
View
@@ -1,6 +1,6 @@
The Assistly Ruby Gem
====================
-A Ruby wrapper for the [Assistly API](http://dev.assistly.com/)
+A Ruby wrapper for the [Assistly API](http://dev.desk.com/)
Installation
------------
@@ -42,7 +42,7 @@ Added the ability to create outbound communications over email
What's new in 0.1?
------------------
-This is the first release of the Assistly gem, based on the [Twitter gem](http://github.com/jnunemaker/twitter). Support for most of the [Assistly API](http://dev.assistly.com/docs/api) are handled.
+This is the first release of the Assistly gem, based on the [Twitter gem](http://github.com/jnunemaker/twitter). Support for most of the [Assistly API](http://dev.desk.com/docs/api) are handled.
There is not yet support for Content or Macros.
Help! I'm getting: "Did not recognize your engine specification. Please specify either a symbol or a class. (RuntimeError)"
@@ -56,7 +56,7 @@ Usage Examples
require "assistly"
# All methods require authentication. To get your Assistly OAuth credentials,
- # register an app in the Assistly admin for your account at http://your-domain.assistly.com/admin
+ # register an app in the Assistly admin for your account at http://your-domain.desk.com/admin
Assistly.configure do |config|
config.support_email = "help@example.com"
config.subdomain = YOUR_ASSISTLY_SUBDOMAIN
@@ -107,6 +107,14 @@ Usage Examples
# Update a customer email
Assistly.update_customer_email(12345, 54321, :email => "foo@example.com")
Assistly.update_customer_email(12345, 54321, :customer_contact_type => "work")
+
+ # Add a customer phone number
+ Assistly.create_customer_phone(12345, "555-368-7147")
+ Assistly.create_customer_phone(12345, "555-368-7147", :customer_contact_type => "work")
+
+ # Update a customer phone number
+ Assistly.update_customer_phone(12345, 54321, :phone => "555-368-7147")
+ Assistly.update_customer_phone(12345, 54321, :customer_contact_type => "work")
######
# Interactions
@@ -125,8 +133,8 @@ Usage Examples
# Assistly's API doesn't support creating outbound communications, so we do this over email with a BCC back to Assistly and customer headers.
# Assistly.support_email must be set to your Assistly email address so that the email can be sent to the account and give the customer someone to respond to.
#
- # Read more at http://support.assistly.com/customer/portal/articles/4180
- # Additional headers can be passed as well http://support.assistly.com/customer/portal/articles/6728
+ # Read more at http://support.desk.com/customer/portal/articles/4180
+ # Additional headers can be passed as well http://support.desk.com/customer/portal/articles/6728
#
# Email is sent using Pony https://github.com/benprew/pony
Assistly.create_interaction(:interaction_subject => "Missed Your Call", :customer_email => "foo@example.com", :interaction_body => "Sorry we missed yoru call. What's up?", :direction => "outbound")
View
@@ -12,13 +12,13 @@ Gem::Specification.new do |s|
s.add_development_dependency('webmock', '~> 1.6')
s.add_development_dependency('yard', '~> 0.6')
s.add_development_dependency('ZenTest', '~> 4.5')
- s.add_runtime_dependency('hashie', '~> 1.1.0')
- s.add_runtime_dependency('faraday', '~> 0.7.0')
- s.add_runtime_dependency('faraday_middleware', '~> 0.7.0')
+ s.add_runtime_dependency('hashie', '~> 1.2.0')
+ s.add_runtime_dependency('faraday', '~> 0.8.0')
+ s.add_runtime_dependency('faraday_middleware', '~> 0.8.0')
s.add_runtime_dependency('jruby-openssl', '~> 0.7.2') if RUBY_PLATFORM == 'java'
s.add_runtime_dependency('multi_json', '~> 1.0.3')
s.add_runtime_dependency('multi_xml', '~> 0.4.0')
- s.add_runtime_dependency('rash', '~> 0.3.0')
+ s.add_runtime_dependency('rash', '~> 0.3.1')
s.add_runtime_dependency('simple_oauth', '~> 0.1.4')
s.add_runtime_dependency('pony', '~> 1.1')
s.authors = ["Chris Warren"]
View
@@ -18,7 +18,7 @@ def initialize(options={})
end
def endpoint
- "https://#{self.subdomain}.assistly.com/api/#{self.version}/"
+ "https://#{self.subdomain}.desk.com/api/#{self.version}/"
end
include Connection
View
@@ -1,8 +1,8 @@
module Assistly
# Wrapper for the Assistly REST API
#
- # @note All methods have been separated into modules and follow the same grouping used in {http://dev.assistly.com/doc the Assistly API Documentation}.
- # @see http://dev.assistly.com/pages/every_developer
+ # @note All methods have been separated into modules and follow the same grouping used in {http://dev.desk.com/doc the Assistly API Documentation}.
+ # @see http://dev.desk.com/pages/every_developer
class Client < API
# Require client method modules after initializing the Client class in
# order to avoid a superclass mismatch error, allowing those modules to be
@@ -12,7 +12,7 @@ module Article
# Assistly.articles(:count => 5, :page => 3)
# @format :json
# @authenticated true
- # @see http://dev.assistly.com/docs/api/topics/articles
+ # @see http://dev.desk.com/docs/api/topics/articles
def articles(id, *args)
options = args.last.is_a?(Hash) ? args.pop : {}
response = get("topics/#{id}/articles",options)
@@ -28,7 +28,7 @@ def articles(id, *args)
# Assistly.article(12345, :by => "external_id")
# @format :json
# @authenticated true
- # @see http://dev.assistly.com/docs/api/articles/show
+ # @see http://dev.desk.com/docs/api/articles/show
def article(id, *args)
options = args.last.is_a?(Hash) ? args.pop : {}
response = get("articles/#{id}",options)
@@ -45,7 +45,7 @@ def article(id, *args)
# Assistly.create_article(1, :subject => "API Tips", :main_content => "Tips on using our API")
# @format :json
# @authenticated true
- # @see http://dev.assistly.com/docs/api/articles/create
+ # @see http://dev.desk.com/docs/api/articles/create
def create_article(topic_id, *args)
options = args.last.is_a?(Hash) ? args.pop : {}
response = post("topics/#{topic_id}/articles",options)
@@ -64,7 +64,7 @@ def create_article(topic_id, *args)
# Assistly.update_article(12345, :subject => "New Subject")
# @format :json
# @authenticated true
- # @see http://dev.assistly.com/docs/api/articles/update
+ # @see http://dev.desk.com/docs/api/articles/update
def update_article(id, *args)
options = args.last.is_a?(Hash) ? args.pop : {}
response = put("articles/#{id}",options)
@@ -82,7 +82,7 @@ def update_article(id, *args)
# Assistly.update_article(12345, :subject => "New Subject")
# @format :json
# @authenticated true
- # @see http://dev.assistly.com/docs/api/articles/update
+ # @see http://dev.desk.com/docs/api/articles/update
def delete_article(id)
response = delete("articles/#{id}")
response
@@ -11,7 +11,7 @@ module Case
# Assistly.cases(:since_id => 12345)
# @format :json
# @authenticated true
- # @see http://dev.assistly.com/docs/api/cases/show
+ # @see http://dev.desk.com/docs/api/cases/show
def cases(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
response = get("cases",options)
@@ -26,7 +26,7 @@ def cases(*args)
# Assistly.case(12345, :by => "external_id")
# @format :json
# @authenticated true
- # @see http://dev.assistly.com/docs/api/cases/show
+ # @see http://dev.desk.com/docs/api/cases/show
def case(id, *args)
options = args.last.is_a?(Hash) ? args.pop : {}
response = get("cases/#{id}",options)
@@ -40,15 +40,15 @@ def case(id, *args)
# Assistly.update_case(12345, :subject => "New Subject")
# @format :json
# @authenticated true
- # @see http://dev.assistly.com/docs/api/cases/update
+ # @see http://dev.desk.com/docs/api/cases/update
def update_case(id, *args)
options = args.last.is_a?(Hash) ? args.pop : {}
response = put("cases/#{id}",options)
response.case
end
def case_url(id)
- "https://#{subdomain}.assistly.com/agent/case/#{id}"
+ "https://#{subdomain}.desk.com/agent/case/#{id}"
end
end
end
@@ -10,7 +10,7 @@ module Customer
# Assistly.customers(:since_id => 12345, :count => 5)
# @format :json
# @authenticated true
- # @see http://dev.assistly.com/docs/api/customers
+ # @see http://dev.desk.com/docs/api/customers
def customers(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
response = get("customers",options)
@@ -24,7 +24,7 @@ def customers(*args)
# Assistly.customer(12345)
# @format :json
# @authenticated true
- # @see http://dev.assistly.com/docs/api/customers/show
+ # @see http://dev.desk.com/docs/api/customers/show
def customer(id)
response = get("customers/#{id}")
response.customer
@@ -37,7 +37,7 @@ def customer(id)
# Assistly.create_customer(:name => "Chris Warren", :twitter => "cdwarren")
# @format :json
# @authenticated true
- # @see http://dev.assistly.com/docs/api/customers/create
+ # @see http://dev.desk.com/docs/api/customers/create
def create_customer(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
response = post("customers",options)
@@ -55,7 +55,7 @@ def create_customer(*args)
# Assistly.update_customer(12345, :name => "Christopher Warren")
# @format :json
# @authenticated true
- # @see http://dev.assistly.com/docs/api/customers/update
+ # @see http://dev.desk.com/docs/api/customers/update
def update_customer(id, *args)
options = args.last.is_a?(Hash) ? args.pop : {}
response = put("customers/#{id}",options)
@@ -73,7 +73,7 @@ def update_customer(id, *args)
# Assistly.create_customer_email(12345, "foo@example.com")
# @format :json
# @authenticated true
- # @see http://dev.assistly.com/docs/api/customers/emails/create
+ # @see http://dev.desk.com/docs/api/customers/emails/create
def create_customer_email(id, email, *args)
options = args.last.is_a?(Hash) ? args.pop : {}
options.merge!({:email => email})
@@ -93,7 +93,7 @@ def create_customer_email(id, email, *args)
# Assistly.update_customer_email(12345, 12345, :customer_contact_type => "work")
# @format :json
# @authenticated true
- # @see http://dev.assistly.com/docs/api/customers/emails/update
+ # @see http://dev.desk.com/docs/api/customers/emails/update
def update_customer_email(id, email_id, *args)
options = args.last.is_a?(Hash) ? args.pop : {}
response = put("customers/#{id}/emails/#{email_id}",options)
@@ -103,6 +103,44 @@ def update_customer_email(id, email_id, *args)
return response
end
end
+
+ # Create a new customer phone number
+ #
+ # @option options [String]
+ # @example Return extended information for 12345
+ # Assistly.create_customer_phone(12345, "555-368-7147")
+ # @format :json
+ # @authenticated true
+ # @see http://dev.desk.com/docs/api/customers/phones/create
+ def create_customer_phone(id, phone, *args)
+ options = args.last.is_a?(Hash) ? args.pop : {}
+ options.merge!({:phone => phone})
+ response = post("customers/#{id}/phones",options)
+ if response['success']
+ return response['results']['phone']
+ else
+ return response
+ end
+ end
+
+ # Update a customer's phone number
+ #
+ # @option options [String]
+ # @example Return extended information for 12345
+ # Assistly.update_customer_phone(12345, 12345, :phone => "555-368-7147")
+ # Assistly.update_customer_phone(12345, 12345, :customer_contact_type => "work")
+ # @format :json
+ # @authenticated true
+ # @see http://dev.desk.com/docs/api/customers/phones/update
+ def update_customer_phone(id, phone_id, *args)
+ options = args.last.is_a?(Hash) ? args.pop : {}
+ response = put("customers/#{id}/phones/#{phone_id}",options)
+ if response['success']
+ return response['results']['phone']
+ else
+ return response
+ end
+ end
end
end
end
@@ -11,7 +11,7 @@ module Interaction
# Assistly.interactions(:since_id => 12345, :count => 5)
# @format :json
# @authenticated true
- # @see http://dev.assistly.com/docs/api/interactions
+ # @see http://dev.desk.com/docs/api/interactions
def interactions(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
response = get("interactions",options)
@@ -38,7 +38,7 @@ def create_interaction(*args)
# @authenticated true
# @rate_limited true
# @return [Array] The requested users.
- # @see http://dev.assistly.com/docs/api/interactions/create
+ # @see http://dev.desk.com/docs/api/interactions/create
# @example Create a new interaction
# Assistly.create_interaction(:interaction_subject => "this is an api test", :customer_email => "foo@example.com")
def create_inbound_interaction(*args)
@@ -57,8 +57,8 @@ def create_inbound_interaction(*args)
# so we'll use send an email to the customer directly that is BCC'd to the support email address
# which will create the ticket
#
- # @see http://support.assistly.com/customer/portal/articles/4180
- # @see http://support.assistly.com/customer/portal/articles/6728
+ # @see http://support.desk.com/customer/portal/articles/4180
+ # @see http://support.desk.com/customer/portal/articles/6728
def create_outbound_interaction(to, subject, body, *args)
raise Assistly::SupportEmailNotSet if support_email.blank?
options = args.last.is_a?(Hash) ? args.pop : {}
@@ -11,7 +11,7 @@ module Macro
# Assistly.macros(:count => 5, :page => 3)
# @format :json
# @authenticated true
- # @see http://dev.assistly.com/docs/api/macros
+ # @see http://dev.desk.com/docs/api/macros
def macros(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
response = get("macros",options)
@@ -26,7 +26,7 @@ def macros(*args)
# Assistly.macro(12345)
# @format :json
# @authenticated true
- # @see http://dev.assistly.com/docs/api/macros/show
+ # @see http://dev.desk.com/docs/api/macros/show
def macro(id)
response = get("macros/#{id}")
response.macro
@@ -41,7 +41,7 @@ def macro(id)
# Assistly.create_macro("name")
# @format :json
# @authenticated true
- # @see http://dev.assistly.com/docs/api/macros/create
+ # @see http://dev.desk.com/docs/api/macros/create
def create_macro(name, *args)
options = args.last.is_a?(Hash) ? args.pop : {}
response = post("macros",options)
@@ -60,7 +60,7 @@ def create_macro(name, *args)
# Assistly.update_macro(12345, :subject => "New Subject")
# @format :json
# @authenticated true
- # @see http://dev.assistly.com/docs/api/macros/update
+ # @see http://dev.desk.com/docs/api/macros/update
def update_macro(id, *args)
options = args.last.is_a?(Hash) ? args.pop : {}
response = put("macros/#{id}",options)
@@ -78,7 +78,7 @@ def update_macro(id, *args)
# Assistly.update_macro(12345, :subject => "New Subject")
# @format :json
# @authenticated true
- # @see http://dev.assistly.com/docs/api/macros/update
+ # @see http://dev.desk.com/docs/api/macros/update
def delete_macro(id)
response = delete("macros/#{id}")
response
@@ -97,7 +97,7 @@ def delete_macro(id)
# Assistly.macro_actions(1, :count => 5, :page => 3)
# @format :json
# @authenticated true
- # @see http://dev.assistly.com/docs/api/macros/actions
+ # @see http://dev.desk.com/docs/api/macros/actions
def macro_actions(id, *args)
options = args.last.is_a?(Hash) ? args.pop : {}
response = get("macros/#{id}/actions",options)
@@ -112,7 +112,7 @@ def macro_actions(id, *args)
# Assistly.macro_action(12345, "set-case-description")
# @format :json
# @authenticated true
- # @see http://dev.assistly.com/docs/api/macros/actions/show
+ # @see http://dev.desk.com/docs/api/macros/actions/show
def macro_action(id, slug)
response = get("macros/#{id}/actions/#{slug}")
response['action']
@@ -126,7 +126,7 @@ def macro_action(id, slug)
# Assistly.update_macro_action(12345, "set-case-description", :value => "New Subject")
# @format :json
# @authenticated true
- # @see http://dev.assistly.com/docs/api/macros/actions/update
+ # @see http://dev.desk.com/docs/api/macros/actions/update
def update_macro_action(id, slug, *args)
options = args.last.is_a?(Hash) ? args.pop : {}
response = put("macros/#{id}/actions/#{slug}",options)
Oops, something went wrong.

0 comments on commit 12a02ec

Please sign in to comment.