Module: ZendeskAPI::CreateMany

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

Instance Method Summary collapse

Instance Method Details

#create_many!(client, attributes_array, association = Association.new(:class => self)) ⇒ JobStatus

Creates multiple resources using the create_many endpoint.

Parameters:

  • client (Client)

    The ZendeskAPI::Client object to be used

  • attributes_array (Array)

    An array of resources to be created.

Returns:



173
174
175
176
177
178
179
180
181
# File 'lib/zendesk_api/actions.rb', line 173

def create_many!(client, attributes_array, association = Association.new(:class => self))
  response = client.connection.post("#{association.generate_path}/create_many") do |req|
    req.body = { resource_name => attributes_array }

    yield req if block_given?
  end

  JobStatus.new_from_response(client, response)
end