Module: Nylas::Model::Attributable
- Included in:
- ApplicationDetail, Categorize, Delta, EmailAddress, EventConferencing, EventConferencingAutocreate, EventConferencingDetails, EventNotification, FreeBusy, IMAddress, Nylas::MessageHeaders, Nylas::MessageTracking, NeuralContactLink, NeuralContactName, NeuralSignatureContact, NylasDate, OpenHours, Participant, PhoneNumber, PhysicalAddress, Recurrence, SchedulerBookingConfirmation, SchedulerBookingRequest, SchedulerConfig, SchedulerTimeSlot, SendGridVerifiedStatus, TimeSlot, Timespan, TokenInfo, WebPage, When
- Defined in:
- lib/nylas/model/attributable.rb
Overview
Allows defining of typecastable attributes on a model
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
- #attributes ⇒ Object
- #initialize(**initial_data) ⇒ Object
-
#to_h(enforce_read_only: false) ⇒ Hash
Representation of the model with values serialized into primitives based on their Type.
Class Method Details
.included(model) ⇒ Object
7 8 9 |
# File 'lib/nylas/model/attributable.rb', line 7 def self.included(model) model.extend(ClassMethods) end |
Instance Method Details
#attributes ⇒ Object
15 16 17 |
# File 'lib/nylas/model/attributable.rb', line 15 def attributes @attributes ||= Attributes.new(self.class.attribute_definitions) end |
#initialize(**initial_data) ⇒ Object
11 12 13 |
# File 'lib/nylas/model/attributable.rb', line 11 def initialize(**initial_data) assign(**initial_data) end |
#to_h(enforce_read_only: false) ⇒ Hash
Returns Representation of the model with values serialized into primitives based on their Type.
20 21 22 |
# File 'lib/nylas/model/attributable.rb', line 20 def to_h(enforce_read_only: false) attributes.to_h(enforce_read_only: enforce_read_only) end |