module Crm::Core::Mixins::Modifiable

Modifiable is a collection of methods that are used to {ClassMethods#create .create}, {#update} and {#delete} a JustRelate WebCRM item. @api public

Public Instance Methods

delete() click to toggle source

Deletes this item.

@raise [Errors::ResourceConflict] if the item has been changed concurrently.

{Core::BasicResource#reload Reload} it, review the changes and retry.

@api public

# File lib/crm/core/mixins/modifiable.rb, line 62
def delete
  RestApi.instance.delete(path, nil, if_match_header)
  nil
end
Also aliased as: destroy
destroy()
Alias for: delete
update(attributes = {}) click to toggle source

Updates the attributes of this item. @example

contact.last_name
# => 'Smith'

contact.locality
# => 'New York'

contact.update({locality: 'Boston'})
# => Crm::Contact

contact.last_name
# => 'Smith'

contact.locality
# => 'Boston'

@param attributes [Hash{String, Symbol => String}] the new attributes. @return [self] the updated item. @raise [Errors::InvalidKeys] if attributes contains unknown attribute names. @raise [Errors::InvalidValues] if attributes contains incorrect values. @raise [Errors::ResourceConflict] if the item has been changed concurrently.

{Core::BasicResource#reload Reload} it, review the changes and retry.

@api public

# File lib/crm/core/mixins/modifiable.rb, line 53
def update(attributes = {})
  load_attributes(RestApi.instance.put(path, attributes, if_match_header))
end