module ZendeskAPI::Update::ClassMethod

Public Instance Methods

update(client, attributes = {}, &block) click to toggle source

Updates, returning false on error.

# File lib/zendesk_api/actions.rb, line 292
def update(client, attributes = {}, &block)
  update!(client, attributes, &block)
rescue ZendeskAPI::Error::ClientError
  false
end
update!(client, attributes = {}, &block) click to toggle source

Updates a resource given the id passed in. @param [Client] client The {Client} object to be used @param [Hash] attributes The attributes to update. Default to {

# File lib/zendesk_api/actions.rb, line 301
def update!(client, attributes = {}, &block)
  ZendeskAPI::Client.check_deprecated_namespace_usage attributes, singular_resource_name
  resource = new(client, :id => attributes.delete(:id), :global => attributes.delete(:global), :association => attributes.delete(:association))
  resource.attributes.merge!(attributes)
  resource.save!(:force_update => resource.is_a?(SingularResource), &block)
  resource
end