Module: CapsuleCRM::Serializable
- Extended by:
- ActiveSupport::Concern
- Included in:
- Address, Case, Country, Currency, CustomField, CustomFieldDefinition, Email, History, Milestone, Opportunity, Organization, Party, Person, Phone, Task, TaskCategory, Track, User, Website
- Defined in:
- lib/capsule_crm/serializable.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
-
.included(base) ⇒ Object
We need to use “self.included” here instead of “included do” to make sure that organizations and people don’t inherit a pointer to the serializable_options of their parent class and modify that.
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
We need to use “self.included” here instead of “included do” to make sure that organizations and people don’t inherit a pointer to the serializable_options of their parent class and modify that.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/capsule_crm/serializable.rb', line 8 def self.included(base) base.send :class_attribute, :serializable_options base. = OpenStruct.new( collection_root: base.to_s.demodulize.downcase.pluralize, root: base.to_s.demodulize.downcase.singularize, include_root: true, excluded_keys: [], additional_methods: [] ) end |
Instance Method Details
#serializer ⇒ Object
24 25 26 |
# File 'lib/capsule_crm/serializable.rb', line 24 def serializer @serializer ||= CapsuleCRM::Serializer.new(self.) end |
#to_capsule_json ⇒ Object
20 21 22 |
# File 'lib/capsule_crm/serializable.rb', line 20 def to_capsule_json serializer.serialize(self) end |