assistly 0.1.5 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,8 @@
1
+ 0.2.0 - April 16, 2011
2
+ -------------------------
3
+ * Support for Topics, Articles, and Macros added
4
+ * Update Readme
5
+
1
6
  0.1.5 - April 15, 2011
2
7
  -------------------------
3
8
  * Support for creating outbound interactions via email
data/README.mkd CHANGED
@@ -1,11 +1,20 @@
1
1
  The Assistly Ruby Gem
2
2
  ====================
3
- A Ruby wrapper for the Assistly API
3
+ A Ruby wrapper for the [Assistly API](http://dev.assistly.com/)
4
4
 
5
5
  Installation
6
6
  ------------
7
7
  gem install assistly
8
8
 
9
+ What's new in 0.2.0?
10
+ ------------------
11
+ Added support for Topics, Articles, and Macros, which is currently all that is available in the Assistly API.
12
+
13
+ What's new in 0.1.5?
14
+ ------------------
15
+ Added the ability to create outbound communications over email
16
+
17
+
9
18
  What's new in 0.1?
10
19
  ------------------
11
20
  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.
@@ -24,6 +33,7 @@ Usage Examples
24
33
  # All methods require authentication. To get your Assistly OAuth credentials,
25
34
  # register an app in the Assistly admin for your account at http://your-domain.assistly.com/admin
26
35
  @assistly = Assistly.configure do |config|
36
+ config.support_email = "help@example.com"
27
37
  config.subdomain = YOUR_ASSISTLY_SUBDOMAIN
28
38
  config.consumer_key = YOUR_CONSUMER_KEY
29
39
  config.consumer_secret = YOUR_CONSUMER_SECRET
@@ -31,6 +41,10 @@ Usage Examples
31
41
  config.oauth_token_secret = YOUR_OAUTH_TOKEN_SECRET
32
42
  end
33
43
 
44
+ ######
45
+ # Cases
46
+ ######
47
+
34
48
  # List cases
35
49
  @assistly.cases
36
50
  @assistly.cases(:since_id => 12345)
@@ -43,6 +57,10 @@ Usage Examples
43
57
 
44
58
  # Get a case url
45
59
  @assistly.case_url(12345)
60
+
61
+ ######
62
+ # Customers
63
+ ######
46
64
 
47
65
  # List customers
48
66
  @assistly.customers
@@ -64,6 +82,10 @@ Usage Examples
64
82
  # Update a customer email
65
83
  @assistly.update_customer_email(12345, 54321, :email => "foo@example.com")
66
84
  @assistly.update_customer_email(12345, 54321, :customer_contact_type => "work")
85
+
86
+ ######
87
+ # Interactions
88
+ ######
67
89
 
68
90
  # List interactions
69
91
  @assistly.interactions
@@ -85,11 +107,81 @@ Usage Examples
85
107
  @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")
86
108
  @assistly.create_outbound_interaction("foo@example.com", "Missed Your Call", "Sorry we missed yoru call. What's up?")
87
109
 
110
+ ######
111
+ # Users
112
+ ######
113
+
88
114
  # List users
89
115
  @assistly.users
90
116
 
91
117
  # Get a specific user
92
118
  @assistly.user(12345)
119
+
120
+ ######
121
+ # Topics
122
+ ######
123
+
124
+ # List Topics
125
+ @assistly.topics
126
+
127
+ # Get a specific topic
128
+ @assistly.topic(12345)
129
+
130
+ # Create a new topic
131
+ @assistly.create_topic("name", :description => "description")
132
+
133
+ # Update a topic
134
+ @assistly.update_topic(12345, :subject => "Updated")
135
+
136
+ # Delete a topic
137
+ @assistly.delete_topic(12345)
138
+
139
+ ######
140
+ # Articles
141
+ ######
142
+
143
+ # List articles for a topic
144
+ @assistly.articles(1)
145
+
146
+ # Get a specific article
147
+ @assistly.article(12345)
148
+
149
+ # Create a new article within a topic
150
+ @assistly.create_article(1, :subject => "API Tips", :main_content => "Tips on using our API")
151
+
152
+ # Update an article
153
+ @assistly.update_article(12345, :subject => "Updated API Tips")
154
+
155
+ # Delete an article
156
+ @assistly.delete_article(12345)
157
+
158
+ ######
159
+ # Macros
160
+ ######
161
+
162
+ # List Macros
163
+ @assistly.macros
164
+
165
+ # Get a specific macro
166
+ @assistly.macro(12345)
167
+
168
+ # Create a new macro
169
+ @assistly.create_macro("name", :labels => "escalated")
170
+
171
+ # Update a macro
172
+ @assistly.update_macro(12345, :name => "Updated Name")
173
+
174
+ # Delete a macro
175
+ @assistly.delete_macro(12345)
176
+
177
+ # Macro Actions
178
+ @assistly.macro_actions(12345)
179
+
180
+ # Macro Action
181
+ @assistly.macro_action(12345, "set-case-description")
182
+
183
+ # Update Macro Action
184
+ @assistly.update_macro_action(12345, "set-case-description", :value => "New Subject")
93
185
 
94
186
  Contributing
95
187
  ------------
@@ -133,5 +225,5 @@ Submitting a Pull Request
133
225
 
134
226
  Copyright
135
227
  ---------
136
- Copyright (c) 2011 Chris Warren/Zencoder
228
+ Copyright (c) 2011 Chris Warren/[Zencoder](http://zencoder.com)
137
229
  See [LICENSE](https://github.com/zencoder/assistly/blob/master/LICENSE.mkd) for details.
@@ -12,6 +12,9 @@ module Assistly
12
12
  require 'assistly/client/interaction'
13
13
  require 'assistly/client/case'
14
14
  require 'assistly/client/customer'
15
+ require 'assistly/client/topic'
16
+ require 'assistly/client/article'
17
+ require 'assistly/client/macro'
15
18
 
16
19
  alias :api_endpoint :endpoint
17
20
 
@@ -21,5 +24,8 @@ module Assistly
21
24
  include Assistly::Client::Interaction
22
25
  include Assistly::Client::Case
23
26
  include Assistly::Client::Customer
27
+ include Assistly::Client::Topic
28
+ include Assistly::Client::Article
29
+ include Assistly::Client::Macro
24
30
  end
25
31
  end
@@ -0,0 +1,96 @@
1
+ module Assistly
2
+ class Client
3
+ # Defines methods related to articles
4
+ module Article
5
+ # Returns extended information of articles for a topic
6
+ #
7
+ # @param id [Integer] a article ID
8
+ # @option options [Boolean, String, Integer]
9
+ # @example Return extended information for 12345
10
+ # Assistly.articles
11
+ # Assistly.articles(:count => 5)
12
+ # Assistly.articles(:count => 5, :page => 3)
13
+ # @format :json
14
+ # @authenticated true
15
+ # @see http://dev.assistly.com/docs/api/topics/articles
16
+ def articles(id, *args)
17
+ options = args.last.is_a?(Hash) ? args.pop : {}
18
+ response = get("topics/#{id}/articles",options)
19
+ if response['results']
20
+ return response['results']
21
+ else
22
+ return response
23
+ end
24
+ end
25
+
26
+ # Returns extended information on a single article
27
+ #
28
+ # @param id [Integer] a article ID
29
+ # @option options [Hash]
30
+ # @example Return extended information for 12345
31
+ # Assistly.article(12345)
32
+ # Assistly.article(12345, :by => "external_id")
33
+ # @format :json
34
+ # @authenticated true
35
+ # @see http://dev.assistly.com/docs/api/articles/show
36
+ def article(id, *args)
37
+ options = args.last.is_a?(Hash) ? args.pop : {}
38
+ response = get("articles/#{id}",options)
39
+ response.article
40
+ end
41
+
42
+ # Creates a new article
43
+ #
44
+ # @param id [Integer] a article ID
45
+ # @param id [Integer] a article ID
46
+ # @param id [Integer] a article ID
47
+ # @option options [Hash]
48
+ # @example Creates a new article
49
+ # Assistly.create_article(1, :subject => "API Tips", :main_content => "Tips on using our API")
50
+ # @format :json
51
+ # @authenticated true
52
+ # @see http://dev.assistly.com/docs/api/articles/create
53
+ def create_article(topic_id, *args)
54
+ options = args.last.is_a?(Hash) ? args.pop : {}
55
+ response = post("topics/#{topic_id}/articles",options)
56
+ if response['success']
57
+ return response['results']['article']
58
+ else
59
+ return response
60
+ end
61
+ end
62
+
63
+ # Updates a single article
64
+ #
65
+ # @param id [Integer] a article ID
66
+ # @option options [String]
67
+ # @example Updates information for article 12345
68
+ # Assistly.update_article(12345, :subject => "New Subject")
69
+ # @format :json
70
+ # @authenticated true
71
+ # @see http://dev.assistly.com/docs/api/articles/update
72
+ def update_article(id, *args)
73
+ options = args.last.is_a?(Hash) ? args.pop : {}
74
+ response = put("articles/#{id}",options)
75
+ if response['success']
76
+ return response['results']['article']
77
+ else
78
+ return response
79
+ end
80
+ end
81
+
82
+ # Deletes a single article
83
+ #
84
+ # @param id [Integer] a article ID
85
+ # @example Deletes article 12345
86
+ # Assistly.update_article(12345, :subject => "New Subject")
87
+ # @format :json
88
+ # @authenticated true
89
+ # @see http://dev.assistly.com/docs/api/articles/update
90
+ def delete_article(id)
91
+ response = delete("articles/#{id}")
92
+ response
93
+ end
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,142 @@
1
+ module Assistly
2
+ class Client
3
+ # Defines methods related to macros
4
+ module Macro
5
+ # Returns extended information of macros
6
+ #
7
+ # @option options [Boolean, String, Integer]
8
+ # @example Return extended information for 12345
9
+ # Assistly.macros
10
+ # Assistly.macros(:count => 5)
11
+ # Assistly.macros(:count => 5, :page => 3)
12
+ # @format :json
13
+ # @authenticated true
14
+ # @see http://dev.assistly.com/docs/api/macros
15
+ def macros(*args)
16
+ options = args.last.is_a?(Hash) ? args.pop : {}
17
+ response = get("macros",options)
18
+ response['results']
19
+ end
20
+
21
+ # Returns extended information on a single macro
22
+ #
23
+ # @param id [Integer] a macro ID
24
+ # @option options [Hash]
25
+ # @example Return extended information for 12345
26
+ # Assistly.macro(12345)
27
+ # @format :json
28
+ # @authenticated true
29
+ # @see http://dev.assistly.com/docs/api/macros/show
30
+ def macro(id)
31
+ response = get("macros/#{id}")
32
+ response.macro
33
+ end
34
+
35
+ # Creates a new macro
36
+ #
37
+ # @param name [String] A macro name
38
+ # @option options [Hash]
39
+ # @example Creates a new macro
40
+ # Assistly.create_macro("name")
41
+ # Assistly.create_macro("name")
42
+ # @format :json
43
+ # @authenticated true
44
+ # @see http://dev.assistly.com/docs/api/macros/create
45
+ def create_macro(name, *args)
46
+ options = args.last.is_a?(Hash) ? args.pop : {}
47
+ response = post("macros",options)
48
+ if response['success']
49
+ return response['results']['macro']
50
+ else
51
+ return response
52
+ end
53
+ end
54
+
55
+ # Updates a single macro
56
+ #
57
+ # @param id [Integer] a macro ID
58
+ # @option options [String]
59
+ # @example Updates information for macro 12345
60
+ # Assistly.update_macro(12345, :subject => "New Subject")
61
+ # @format :json
62
+ # @authenticated true
63
+ # @see http://dev.assistly.com/docs/api/macros/update
64
+ def update_macro(id, *args)
65
+ options = args.last.is_a?(Hash) ? args.pop : {}
66
+ response = put("macros/#{id}",options)
67
+ if response['success']
68
+ return response['results']['macro']
69
+ else
70
+ return response
71
+ end
72
+ end
73
+
74
+ # Deletes a single macro
75
+ #
76
+ # @param id [Integer] a macro ID
77
+ # @example Deletes macro 12345
78
+ # Assistly.update_macro(12345, :subject => "New Subject")
79
+ # @format :json
80
+ # @authenticated true
81
+ # @see http://dev.assistly.com/docs/api/macros/update
82
+ def delete_macro(id)
83
+ response = delete("macros/#{id}")
84
+ response
85
+ end
86
+
87
+ ##########
88
+ # Macro Actions
89
+ ##########
90
+
91
+ # Returns extended information of macros
92
+ #
93
+ # @option options [Boolean, String, Integer]
94
+ # @example Return extended information for 12345
95
+ # Assistly.macro_actions(1)
96
+ # Assistly.macro_actions(1, :count => 5)
97
+ # Assistly.macro_actions(1, :count => 5, :page => 3)
98
+ # @format :json
99
+ # @authenticated true
100
+ # @see http://dev.assistly.com/docs/api/macros/actions
101
+ def macro_actions(id, *args)
102
+ options = args.last.is_a?(Hash) ? args.pop : {}
103
+ response = get("macros/#{id}/actions",options)
104
+ response['results']
105
+ end
106
+
107
+ # Returns extended information on a single macro
108
+ #
109
+ # @param id [Integer] a macro ID
110
+ # @option options [Hash]
111
+ # @example Return extended information for 12345
112
+ # Assistly.macro_action(12345, "set-case-description")
113
+ # @format :json
114
+ # @authenticated true
115
+ # @see http://dev.assistly.com/docs/api/macros/actions/show
116
+ def macro_action(id, slug)
117
+ response = get("macros/#{id}/actions/#{slug}")
118
+ response['action']
119
+ end
120
+
121
+ # Updates a single macro action
122
+ #
123
+ # @param id [Integer] a macro ID
124
+ # @option options [String]
125
+ # @example Updates information for macro 12345
126
+ # Assistly.update_macro_action(12345, "set-case-description", :value => "New Subject")
127
+ # @format :json
128
+ # @authenticated true
129
+ # @see http://dev.assistly.com/docs/api/macros/actions/update
130
+ def update_macro_action(id, slug, *args)
131
+ options = args.last.is_a?(Hash) ? args.pop : {}
132
+ response = put("macros/#{id}/actions/#{slug}",options)
133
+ if response['success']
134
+ return response['results']['action']
135
+ else
136
+ return response
137
+ end
138
+ end
139
+
140
+ end
141
+ end
142
+ end
@@ -0,0 +1,90 @@
1
+ module Assistly
2
+ class Client
3
+ # Defines methods related to topics
4
+ module Topic
5
+ # Returns extended information of topics
6
+ #
7
+ # @option options [Boolean, String, Integer]
8
+ # @example Return extended information for 12345
9
+ # Assistly.topics
10
+ # Assistly.topics(:count => 5)
11
+ # Assistly.topics(:count => 5, :page => 3)
12
+ # @format :json
13
+ # @authenticated true
14
+ # @see http://dev.assistly.com/docs/api/topics/show
15
+ def topics(*args)
16
+ options = args.last.is_a?(Hash) ? args.pop : {}
17
+ response = get("topics",options)
18
+ response['results']
19
+ end
20
+
21
+ # Returns extended information on a single topic
22
+ #
23
+ # @param id [Integer] a topic ID
24
+ # @option options [Hash]
25
+ # @example Return extended information for 12345
26
+ # Assistly.topic(12345)
27
+ # Assistly.topic(12345, :by => "external_id")
28
+ # @format :json
29
+ # @authenticated true
30
+ # @see http://dev.assistly.com/docs/api/topics/show
31
+ def topic(id, *args)
32
+ options = args.last.is_a?(Hash) ? args.pop : {}
33
+ response = get("topics/#{id}",options)
34
+ response.topic
35
+ end
36
+
37
+ # Creates a new topic
38
+ #
39
+ # @param name [String] A topic name
40
+ # @option options [Hash]
41
+ # @example Creates a new topic
42
+ # Assistly.create_topic("name")
43
+ # Assistly.create_topic("name", :description => "description")
44
+ # @format :json
45
+ # @authenticated true
46
+ # @see http://dev.assistly.com/docs/api/topics/create
47
+ def create_topic(name, *args)
48
+ options = args.last.is_a?(Hash) ? args.pop : {}
49
+ response = post("topics",options)
50
+ if response['success']
51
+ return response['results']['topic']
52
+ else
53
+ return response
54
+ end
55
+ end
56
+
57
+ # Updates a single topic
58
+ #
59
+ # @param id [Integer] a topic ID
60
+ # @option options [String]
61
+ # @example Updates information for topic 12345
62
+ # Assistly.update_topic(12345, :subject => "New Subject")
63
+ # @format :json
64
+ # @authenticated true
65
+ # @see http://dev.assistly.com/docs/api/topics/update
66
+ def update_topic(id, *args)
67
+ options = args.last.is_a?(Hash) ? args.pop : {}
68
+ response = put("topics/#{id}",options)
69
+ if response['success']
70
+ return response['results']['topic']
71
+ else
72
+ return response
73
+ end
74
+ end
75
+
76
+ # Deletes a single topic
77
+ #
78
+ # @param id [Integer] a topic ID
79
+ # @example Deletes topic 12345
80
+ # Assistly.update_topic(12345, :subject => "New Subject")
81
+ # @format :json
82
+ # @authenticated true
83
+ # @see http://dev.assistly.com/docs/api/topics/update
84
+ def delete_topic(id)
85
+ response = delete("topics/#{id}")
86
+ response
87
+ end
88
+ end
89
+ end
90
+ end