Class: Crm::Core::BasicResource
- Inherits:
-
Object
- Object
- Crm::Core::BasicResource
- Includes:
- Mixins::AttributeProvider
- Defined in:
- lib/crm/core/basic_resource.rb
Overview
BasicResource
is the base class of all JustRelate WebCRM SDK resources.
Direct Known Subclasses
Account, Activity, Crm::Collection, Crm::Contact, Event, EventContact, Mailing, MailingRecipient, TemplateSet, Type
Class Method Summary collapse
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean (also: #==)
-
#id ⇒ String
Returns the ID of this item.
- #path ⇒ Object
-
#reload ⇒ self
Reloads the attributes of this item from the remote web service.
-
#type ⇒ Crm::Type
Returns the type object of this item.
Methods included from Mixins::AttributeProvider
#[], #attributes, #initialize, #method_missing, #methods, #raw, #respond_to_missing?
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Crm::Core::Mixins::AttributeProvider
Class Method Details
.base_type ⇒ Object
7 8 9 |
# File 'lib/crm/core/basic_resource.rb', line 7 def self.base_type name.split(/::/).last end |
.path ⇒ Object
15 16 17 |
# File 'lib/crm/core/basic_resource.rb', line 15 def self.path resource_name.pluralize end |
.resource_name ⇒ Object
11 12 13 |
# File 'lib/crm/core/basic_resource.rb', line 11 def self.resource_name base_type.underscore end |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
55 56 57 |
# File 'lib/crm/core/basic_resource.rb', line 55 def eql?(other) other.equal?(self) || other.instance_of?(self.class) && other.id == id end |
#id ⇒ String
Returns the ID of this item.
22 23 24 |
# File 'lib/crm/core/basic_resource.rb', line 22 def id self['id'] end |
#path ⇒ Object
26 27 28 |
# File 'lib/crm/core/basic_resource.rb', line 26 def path [self.class.path, id].compact.join('/') end |