Module: ZendeskAPI::CreateOrUpdate

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

Instance Method Summary collapse

Instance Method Details

#create_or_update!(client, attributes, association = Association.new(:class => self)) ⇒ Object

Creates or updates resource using the create_or_update endpoint.

Parameters:



188
189
190
191
192
193
194
195
196
# File 'lib/zendesk_api/actions.rb', line 188

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

    yield req if block_given?
  end

  new_from_response(client, response, Array(association.options[:include]))
end