Skip to content

Commit

Permalink
Merge pull request chriswarren#2 from andrewpbrett/master
Browse files Browse the repository at this point in the history
Global sub of assistly.com for desk.com
  • Loading branch information
Robert Ross committed Feb 24, 2012
2 parents ae0878a + c717fca commit 799ec25
Show file tree
Hide file tree
Showing 18 changed files with 61 additions and 61 deletions.
10 changes: 5 additions & 5 deletions README.mkd
@@ -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
------------
Expand Down Expand Up @@ -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)"
Expand All @@ -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
Expand Down Expand Up @@ -125,8 +125,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")
Expand Down
2 changes: 1 addition & 1 deletion lib/assistly/api.rb
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/assistly/client.rb
@@ -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
Expand Down
10 changes: 5 additions & 5 deletions lib/assistly/client/article.rb
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions lib/assistly/client/case.rb
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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
Expand Down
12 changes: 6 additions & 6 deletions lib/assistly/client/customer.rb
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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})
Expand All @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions lib/assistly/client/interaction.rb
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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 : {}
Expand Down
16 changes: 8 additions & 8 deletions lib/assistly/client/macro.rb
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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']
Expand All @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions lib/assistly/client/topic.rb
Expand Up @@ -11,7 +11,7 @@ module Topic
# Assistly.topics(:count => 5, :page => 3)
# @format :json
# @authenticated true
# @see http://dev.assistly.com/docs/api/topics/show
# @see http://dev.desk.com/docs/api/topics/show
def topics(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
response = get("topics",options)
Expand All @@ -27,7 +27,7 @@ def topics(*args)
# Assistly.topic(12345, :by => "external_id")
# @format :json
# @authenticated true
# @see http://dev.assistly.com/docs/api/topics/show
# @see http://dev.desk.com/docs/api/topics/show
def topic(id, *args)
options = args.last.is_a?(Hash) ? args.pop : {}
response = get("topics/#{id}",options)
Expand All @@ -43,7 +43,7 @@ def topic(id, *args)
# Assistly.create_topic("name", :description => "description")
# @format :json
# @authenticated true
# @see http://dev.assistly.com/docs/api/topics/create
# @see http://dev.desk.com/docs/api/topics/create
def create_topic(name, *args)
options = args.last.is_a?(Hash) ? args.pop : {}
response = post("topics",options)
Expand All @@ -62,7 +62,7 @@ def create_topic(name, *args)
# Assistly.update_topic(12345, :subject => "New Subject")
# @format :json
# @authenticated true
# @see http://dev.assistly.com/docs/api/topics/update
# @see http://dev.desk.com/docs/api/topics/update
def update_topic(id, *args)
options = args.last.is_a?(Hash) ? args.pop : {}
response = put("topics/#{id}",options)
Expand All @@ -80,7 +80,7 @@ def update_topic(id, *args)
# Assistly.update_topic(12345, :subject => "New Subject")
# @format :json
# @authenticated true
# @see http://dev.assistly.com/docs/api/topics/update
# @see http://dev.desk.com/docs/api/topics/update
def delete_topic(id)
response = delete("topics/#{id}")
response
Expand Down
4 changes: 2 additions & 2 deletions lib/assistly/client/user.rb
Expand Up @@ -12,7 +12,7 @@ module User
# Assistly.user(12345)
# @format :json, :xml
# @authenticated true
# @see http://dev.assistly.com/docs/api/users/show
# @see http://dev.desk.com/docs/api/users/show
def user(id,*args)
options = args.last.is_a?(Hash) ? args.pop : {}
response = get("users/#{id}",options)
Expand All @@ -25,7 +25,7 @@ def user(id,*args)
# @authenticated true
# @rate_limited true
# @return [Array] The requested users.
# @see http://dev.assistly.com/docs/api/users
# @see http://dev.desk.com/docs/api/users
# @example Return extended information account users
# Assistly.users
def users(*args)
Expand Down
2 changes: 1 addition & 1 deletion lib/assistly/error.rb
Expand Up @@ -45,7 +45,7 @@ class NotAcceptable < Error; end
class EnhanceYourCalm < Error
# The number of seconds your application should wait before requesting date from the Search API again
#
# @see http://dev.Assistly.com/pages/rate-limiting
# @see http://dev.desk.com/pages/rate-limiting
def retry_after
@http_headers.values_at('retry-after', 'Retry-After').detect {|value| value }.to_i
end
Expand Down
2 changes: 1 addition & 1 deletion spec/assistly/client/case_spec.rb
Expand Up @@ -89,7 +89,7 @@
context "generating a case url" do

it "should make a correct url for the case" do
@client.case_url(123).should == "https://example.assistly.com/agent/case/123"
@client.case_url(123).should == "https://example.desk.com/agent/case/123"
end

end
Expand Down
4 changes: 2 additions & 2 deletions spec/assistly_spec.rb
Expand Up @@ -55,7 +55,7 @@
end

it "should change the endpoint" do
Assistly.endpoint.should == "https://zencoder.assistly.com/api/#{Assistly::Configuration::DEFAULT_VERSION}/"
Assistly.endpoint.should == "https://zencoder.desk.com/api/#{Assistly::Configuration::DEFAULT_VERSION}/"
end
end

Expand All @@ -82,7 +82,7 @@
end

it "should change the endpoint" do
Assistly.endpoint.should == "https://#{Assistly::Configuration::DEFAULT_SUBDOMAIN}.assistly.com/api/v4/"
Assistly.endpoint.should == "https://#{Assistly::Configuration::DEFAULT_SUBDOMAIN}.desk.com/api/v4/"
end
end

Expand Down

0 comments on commit 799ec25

Please sign in to comment.