Class: Esputnik::Contact
- Inherits:
-
Struct
- Object
- Struct
- Esputnik::Contact
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/esputnik/contact.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#address_book_id ⇒ Object
Returns the value of attribute address_book_id.
-
#channels ⇒ Object
Returns the value of attribute channels.
-
#contact_key ⇒ Object
Returns the value of attribute contact_key.
-
#fields ⇒ Object
Returns the value of attribute fields.
-
#first_name ⇒ Object
Returns the value of attribute first_name.
-
#groups ⇒ Object
Returns the value of attribute groups.
-
#id ⇒ Object
Returns the value of attribute id.
-
#last_name ⇒ Object
Returns the value of attribute last_name.
-
#orders_info ⇒ Object
Returns the value of attribute orders_info.
Instance Method Summary collapse
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address
4 5 6 |
# File 'lib/esputnik/contact.rb', line 4 def address @address end |
#address_book_id ⇒ Object
Returns the value of attribute address_book_id
4 5 6 |
# File 'lib/esputnik/contact.rb', line 4 def address_book_id @address_book_id end |
#channels ⇒ Object
Returns the value of attribute channels
4 5 6 |
# File 'lib/esputnik/contact.rb', line 4 def channels @channels end |
#contact_key ⇒ Object
Returns the value of attribute contact_key
4 5 6 |
# File 'lib/esputnik/contact.rb', line 4 def contact_key @contact_key end |
#fields ⇒ Object
Returns the value of attribute fields
4 5 6 |
# File 'lib/esputnik/contact.rb', line 4 def fields @fields end |
#first_name ⇒ Object
Returns the value of attribute first_name
4 5 6 |
# File 'lib/esputnik/contact.rb', line 4 def first_name @first_name end |
#groups ⇒ Object
Returns the value of attribute groups
4 5 6 |
# File 'lib/esputnik/contact.rb', line 4 def groups @groups end |
#id ⇒ Object
Returns the value of attribute id
4 5 6 |
# File 'lib/esputnik/contact.rb', line 4 def id @id end |
#last_name ⇒ Object
Returns the value of attribute last_name
4 5 6 |
# File 'lib/esputnik/contact.rb', line 4 def last_name @last_name end |
#orders_info ⇒ Object
Returns the value of attribute orders_info
4 5 6 |
# File 'lib/esputnik/contact.rb', line 4 def orders_info @orders_info end |
Instance Method Details
#as_json ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/esputnik/contact.rb', line 18 def as_json hash = self.class.members.each_with_object({}) do |method_name, h| value = public_send(method_name) value = value.as_json if value.respond_to? :as_json h[method_name.to_s.camelize(:lower)] = value if value.present? end hash['channels'] = channels&.map(&:as_json) hash end |