Module: ZendeskAPI::UpdateMany

Included in:
Ticket, User
Defined in:
lib/zendesk_api/actions.rb

Instance Method Summary collapse

Instance Method Details

#update_many!(client, ids, attributes) ⇒ JobStatus

Updates multiple resources using the update_many endpoint.

Parameters:

  • client (Client)

    The Client object to be used

  • ids (Array)

    An array of ids to update

  • attributes (Hash)

    The attributes to update resources with

Returns:



282
283
284
285
286
287
288
289
290
291
292
293
# File 'lib/zendesk_api/actions.rb', line 282

def update_many!(client, ids, attributes)
  association = attributes.delete(:association) || Association.new(:class => self)

  response = client.connection.put("#{association.generate_path}/update_many") do |req|
    req.params = { :ids => ids.join(',') }
    req.body = { singular_resource_name => attributes }

    yield req if block_given?
  end

  JobStatus.new_from_response(client, response)
end