@@ -90,6 +90,7 @@ def self.included(base)
9090 base . extend ( ClassMethods )
9191 end
9292
93+ # Reloads a resource.
9394 def reload!
9495 response = @client . connection . get ( path ) do |req |
9596 yield req if block_given?
@@ -124,6 +125,8 @@ def find!(client, options = {})
124125 end
125126
126127 # 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
127130 def find ( client , options = { } , &block )
128131 find! ( client , options , &block )
129132 rescue ZendeskAPI ::Error ::ClientError => e
@@ -151,6 +154,9 @@ def create!(client, attributes = {}, &block)
151154 end
152155 end
153156
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
154160 def create ( client , attributes = { } , &block )
155161 create! ( client , attributes , &block )
156162 rescue ZendeskAPI ::Error ::ClientError
@@ -160,6 +166,10 @@ def create(client, attributes = {}, &block)
160166 end
161167
162168 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
163173 def create_many! ( client , attributes_array , association = Association . new ( :class => self ) )
164174 response = client . connection . post ( "#{ association . generate_path } /create_many" ) do |req |
165175 req . body = { resource_name => attributes_array }
@@ -193,6 +203,7 @@ def destroy!
193203 @destroyed = true
194204 end
195205
206+ # Destroys, returning false on error.
196207 def destroy ( &block )
197208 destroy! ( &block )
198209 rescue ZendeskAPI ::Error ::ClientError
@@ -209,6 +220,7 @@ def destroy!(client, opts = {}, &block)
209220 true
210221 end
211222
223+ # Destroys, returning false on error.
212224 def destroy ( client , attributes = { } , &block )
213225 destroy! ( client , attributes , &block )
214226 rescue ZendeskAPI ::Error ::ClientError
@@ -218,6 +230,10 @@ def destroy(client, attributes = {}, &block)
218230 end
219231
220232 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
221237 def destroy_many! ( client , ids , association = Association . new ( :class => self ) )
222238 response = client . connection . delete ( "#{ association . generate_path } /destroy_many" ) do |req |
223239 req . params = { :ids => ids . join ( ',' ) }
@@ -237,15 +253,16 @@ def self.included(klass)
237253 end
238254
239255 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.
243257 def update ( client , attributes = { } , &block )
244258 update! ( client , attributes , &block )
245259 rescue ZendeskAPI ::Error ::ClientError
246260 false
247261 end
248262
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 {
249266 def update! ( client , attributes = { } , &block )
250267 ZendeskAPI ::Client . check_deprecated_namespace_usage attributes , singular_resource_name
251268 resource = new ( client , :id => attributes . delete ( :id ) , :global => attributes . delete ( :global ) , :association => attributes . delete ( :association ) )
@@ -257,6 +274,11 @@ def update!(client, attributes = {}, &block)
257274 end
258275
259276 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
260282 def update_many! ( client , ids , attributes )
261283 association = attributes . delete ( :association ) || Association . new ( :class => self )
262284
0 commit comments