Module: ZendeskAPI::Update::ClassMethod

Defined in:
lib/zendesk_api/actions.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) update(client, attributes = {})

Updates a resource given the id passed in.

Parameters:

  • client (Client)

    The Client object to be used

  • attributes (Hash) (defaults to: {})

    The attributes to update. Default to {}



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

def update(client, attributes = {})
  update!(client, attributes)
rescue ZendeskAPI::Error::ClientError
  false
end

- (Object) update!(client, attributes = {})



194
195
196
197
198
199
# File 'lib/zendesk_api/actions.rb', line 194

def update!(client, attributes = {})
  ZendeskAPI::Client.check_deprecated_namespace_usage attributes, singular_resource_name
  resource = new(client, { :id => attributes.delete(:id), :global => attributes.delete(:global) })
  resource.attributes.merge!(attributes)
  resource.tap(&:save!)
end