zendesk_api 1.12.0 → 1.12.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 49f877ef488efff63166e65c6bbc635393efa488
4
- data.tar.gz: d71df887f074652902d22226c6bf150b98d835e6
3
+ metadata.gz: 73febfb24dc4a39b5b386d4476aa71718ca59a13
4
+ data.tar.gz: ba8cfa1f3bccf225f73c5ab33088bba61d9d7167
5
5
  SHA512:
6
- metadata.gz: 7c528d250017f13ed20916f9b8f32ca5570b3533d75e41f9152104c31ec7ae0c7e888cd21a91d261fc8e0adada5cc5c54c1b4dbce3fedf4a5b1c06c33884b23c
7
- data.tar.gz: da0747da376fbabe82d4b46ce86e3a454bbc18fec7c0cb9f1537a8a6e64b21f6b7ede256bc5d4713c5bdbff1747782bab7ab48c6a1e5e565941d22a74a00ddc0
6
+ metadata.gz: fa55aa31b991933dc87c9956d0dc280c84bc32325f43d65ac95f4abea42b98ca366c169bbfad2274a62901016ea5aa9f2c31c59f3533ea8e576d19bd6be77aba
7
+ data.tar.gz: dbfe25ff93a95353da721dca9771e8c6561e65f323e2cc6440fb583c1e4f0281f9b27444c2c65839ad65a95080cfaf98d55ac0d06e2c165aca309841bdbf81ab
data/.gitignore CHANGED
@@ -1,6 +1,6 @@
1
1
  pkg
2
- ./doc/*
3
- ./doc/**/*
2
+ doc/*
3
+ doc/**/*
4
4
  *swp
5
5
  spec/fixtures/cassettes
6
6
  spec/fixtures/credentials.yml
data/README.md CHANGED
@@ -6,7 +6,7 @@ This client **only** supports Zendesk's v2 API. Please see our [API documentati
6
6
 
7
7
  ## Documentation
8
8
 
9
- Please check out the [wiki](https://github.com/zendesk/zendesk_api_client_rb/wiki), [class documentation](https://zendesk-api.herokuapp.com/doc/index.html), and [issues](https://github.com/zendesk/zendesk_api_client_rb/issues) before reporting a bug or asking for help.
9
+ Please check out the [wiki](https://github.com/zendesk/zendesk_api_client_rb/wiki), [class documentation](http://zendesk.github.io/zendesk_api_client_rb), and [issues](https://github.com/zendesk/zendesk_api_client_rb/issues) before reporting a bug or asking for help.
10
10
 
11
11
  ## Important Notices
12
12
 
@@ -306,6 +306,7 @@ client.apps.create!(:name => "test", :upload => "app.zip")
306
306
  ```
307
307
 
308
308
  *Note: job statuses are currently not supported, so you must manually poll the job status API for app creation.*
309
+
309
310
  ```ruby
310
311
  body = {}
311
312
  until %w{failed completed}.include?(body["status"])
@@ -90,6 +90,7 @@ module ZendeskAPI
90
90
  base.extend(ClassMethods)
91
91
  end
92
92
 
93
+ # Reloads a resource.
93
94
  def reload!
94
95
  response = @client.connection.get(path) do |req|
95
96
  yield req if block_given?
@@ -124,6 +125,8 @@ module ZendeskAPI
124
125
  end
125
126
 
126
127
  # Finds, returning nil if it fails
128
+ # @param [Client] client The {Client} object to be used
129
+ # @param [Hash] options Any additional GET parameters to be added
127
130
  def find(client, options = {}, &block)
128
131
  find!(client, options, &block)
129
132
  rescue ZendeskAPI::Error::ClientError => e
@@ -151,6 +154,9 @@ module ZendeskAPI
151
154
  end
152
155
  end
153
156
 
157
+ # Creates, returning nil if it fails
158
+ # @param [Client] client The {Client} object to be used
159
+ # @param [Hash] options Any additional GET parameters to be added
154
160
  def create(client, attributes = {}, &block)
155
161
  create!(client, attributes, &block)
156
162
  rescue ZendeskAPI::Error::ClientError
@@ -160,6 +166,10 @@ module ZendeskAPI
160
166
  end
161
167
 
162
168
  module CreateMany
169
+ # Creates multiple resources using the create_many endpoint.
170
+ # @param [Client] client The {Client} object to be used
171
+ # @param [Array] attributes_array An array of resources to be created.
172
+ # @return [JobStatus] the {JobStatus} instance for this create job
163
173
  def create_many!(client, attributes_array, association = Association.new(:class => self))
164
174
  response = client.connection.post("#{association.generate_path}/create_many") do |req|
165
175
  req.body = { resource_name => attributes_array }
@@ -193,6 +203,7 @@ module ZendeskAPI
193
203
  @destroyed = true
194
204
  end
195
205
 
206
+ # Destroys, returning false on error.
196
207
  def destroy(&block)
197
208
  destroy!(&block)
198
209
  rescue ZendeskAPI::Error::ClientError
@@ -209,6 +220,7 @@ module ZendeskAPI
209
220
  true
210
221
  end
211
222
 
223
+ # Destroys, returning false on error.
212
224
  def destroy(client, attributes = {}, &block)
213
225
  destroy!(client, attributes, &block)
214
226
  rescue ZendeskAPI::Error::ClientError
@@ -218,6 +230,10 @@ module ZendeskAPI
218
230
  end
219
231
 
220
232
  module DestroyMany
233
+ # Destroys multiple resources using the destroy_many endpoint.
234
+ # @param [Client] client The {Client} object to be used
235
+ # @param [Array] ids An array of ids to destroy
236
+ # @return [JobStatus] the {JobStatus} instance for this destroy job
221
237
  def destroy_many!(client, ids, association = Association.new(:class => self))
222
238
  response = client.connection.delete("#{association.generate_path}/destroy_many") do |req|
223
239
  req.params = { :ids => ids.join(',') }
@@ -237,15 +253,16 @@ module ZendeskAPI
237
253
  end
238
254
 
239
255
  module ClassMethod
240
- # Updates a resource given the id passed in.
241
- # @param [Client] client The {Client} object to be used
242
- # @param [Hash] attributes The attributes to update. Default to {}
256
+ # Updates, returning false on error.
243
257
  def update(client, attributes = {}, &block)
244
258
  update!(client, attributes, &block)
245
259
  rescue ZendeskAPI::Error::ClientError
246
260
  false
247
261
  end
248
262
 
263
+ # Updates a resource given the id passed in.
264
+ # @param [Client] client The {Client} object to be used
265
+ # @param [Hash] attributes The attributes to update. Default to {
249
266
  def update!(client, attributes = {}, &block)
250
267
  ZendeskAPI::Client.check_deprecated_namespace_usage attributes, singular_resource_name
251
268
  resource = new(client, :id => attributes.delete(:id), :global => attributes.delete(:global), :association => attributes.delete(:association))
@@ -257,6 +274,11 @@ module ZendeskAPI
257
274
  end
258
275
 
259
276
  module UpdateMany
277
+ # Updates multiple resources using the update_many endpoint.
278
+ # @param [Client] client The {Client} object to be used
279
+ # @param [Array] ids An array of ids to update
280
+ # @param [Hash] attributes The attributes to update resources with
281
+ # @return [JobStatus] the {JobStatus} instance for this destroy job
260
282
  def update_many!(client, ids, attributes)
261
283
  association = attributes.delete(:association) || Association.new(:class => self)
262
284
 
@@ -82,7 +82,7 @@ module ZendeskAPI
82
82
 
83
83
  # Convenience method to build a new resource and
84
84
  # add it to the collection. Fetches the collection as well.
85
- # @param [Hash] options Options or attributes to pass
85
+ # @param [Hash] opts Options or attributes to pass
86
86
  def build(opts = {})
87
87
  wrap_resource(opts, true).tap do |res|
88
88
  self << res
@@ -91,7 +91,7 @@ module ZendeskAPI
91
91
 
92
92
  # Convenience method to build a new resource and
93
93
  # add it to the collection. Fetches the collection as well.
94
- # @param [Hash] options Options or attributes to pass
94
+ # @param [Hash] opts Options or attributes to pass
95
95
  def build!(opts = {})
96
96
  wrap_resource(opts, true).tap do |res|
97
97
  fetch!
@@ -637,6 +637,10 @@ module ZendeskAPI
637
637
  end
638
638
 
639
639
  class User < Resource
640
+ extend CreateMany
641
+ extend UpdateMany
642
+ extend DestroyMany
643
+
640
644
  class TopicComment < TopicComment
641
645
  include Read
642
646
  end
@@ -1,3 +1,3 @@
1
1
  module ZendeskAPI
2
- VERSION = "1.12.0"
2
+ VERSION = "1.12.1"
3
3
  end
@@ -14,7 +14,7 @@ class ResourceHandler < YARD::Handlers::Ruby::Base
14
14
  p.const_get(k)
15
15
  end
16
16
  rescue NameError
17
- parent = ZendeskAPI.const_get(namespace.to_s.split('::').last)
17
+ parent = walk_namespace(namespace)
18
18
  klass = parent.const_get(klass)
19
19
  end
20
20
 
@@ -25,7 +25,7 @@ class ResourceHandler < YARD::Handlers::Ruby::Base
25
25
  begin
26
26
  klass = ZendeskAPI.const_get(klass)
27
27
  rescue NameError
28
- parent = ZendeskAPI.const_get(namespace.to_s.split('::').last)
28
+ parent = walk_namespace(namespace)
29
29
  klass = parent.const_get(klass)
30
30
  end
31
31
 
@@ -52,6 +52,12 @@ class ResourceHandler < YARD::Handlers::Ruby::Base
52
52
  writer.docstring.add_tag(YARD::Tags::Tag.new(:param, "The associated object or its attributes", "Hash or #{klass.name}", "value"))
53
53
  end
54
54
 
55
+ def walk_namespace(namespace)
56
+ namespace.to_s.split('::').inject(ZendeskAPI) do |klass, namespace|
57
+ klass.const_get(namespace)
58
+ end
59
+ end
60
+
55
61
  def get_klass(statement)
56
62
  statement.traverse do |node|
57
63
  if node.type == :assoc && node.jump(:kw).source == "class"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zendesk_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.0
4
+ version: 1.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Davidovitz
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-09-11 00:00:00.000000000 Z
12
+ date: 2015-10-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bump