module ZendeskAPI::UpdateMany

Public Instance Methods

update_many!(client, ids_or_attributes, attributes = {}) { |req| ... } click to toggle source

Updates multiple resources using the update_many endpoint. @param [Client] client The {Client} object to be used @param [Array] ids_or_attributes An array of ids or arributes including ids to update @param [Hash] attributes The attributes to update resources with @return [JobStatus] the {JobStatus} instance for this destroy job

# File lib/zendesk_api/actions.rb, line 317
def update_many!(client, ids_or_attributes, attributes = {})
  association = attributes.delete(:association) || Association.new(:class => self)

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

    yield req if block_given?
  end

  JobStatus.new_from_response(client, response)
end