Module: Crm::Core::Mixins::Modifiable

Extended by:
ActiveSupport::Concern, ClassMethods
Included in:
Account, Activity, Crm::Collection, Crm::Contact, Event, EventContact, Mailing, Type
Defined in:
lib/crm/core/mixins/modifiable.rb

Overview

Modifiable is a collection of methods that are used to .create, #update and #delete a JustRelate WebCRM item.

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Methods included from ClassMethods

create

Instance Method Details

#deleteObject Also known as: destroy

Deletes this item.

Raises:



62
63
64
65
# File 'lib/crm/core/mixins/modifiable.rb', line 62

def delete
  RestApi.instance.delete(path, nil, if_match_header)
  nil
end

#update(attributes = {}) ⇒ self

Updates the attributes of this item.

Examples:

contact.last_name
# => 'Smith'

contact.locality
# => 'New York'

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

contact.last_name
# => 'Smith'

contact.locality
# => 'Boston'

Parameters:

  • attributes (Hash{String, Symbol => String}) (defaults to: {})

    the new attributes.

Returns:

  • (self)

    the updated item.

Raises:



53
54
55
# File 'lib/crm/core/mixins/modifiable.rb', line 53

def update(attributes = {})
  load_attributes(RestApi.instance.put(path, attributes, if_match_header))
end