Module: ZendeskAPI::Update::ClassMethod
- Defined in:
- lib/zendesk_api/actions.rb
Instance Method Summary collapse
-
#update(client, attributes = {}, &block) ⇒ Object
Updates, returning false on error.
-
#update!(client, attributes = {}, &block) ⇒ Object
Updates a resource given the id passed in.
Instance Method Details
#update(client, attributes = {}, &block) ⇒ Object
Updates, returning false on error.
257 258 259 260 261 |
# File 'lib/zendesk_api/actions.rb', line 257 def update(client, attributes = {}, &block) update!(client, attributes, &block) rescue ZendeskAPI::Error::ClientError false end |
#update!(client, attributes = {}, &block) ⇒ Object
Updates a resource given the id passed in.
266 267 268 269 270 271 272 |
# File 'lib/zendesk_api/actions.rb', line 266 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 |