Class: Attune::Model::Customer
- Inherits:
-
Object
- Object
- Attune::Model::Customer
- Defined in:
- lib/attune/models/customer.rb
Overview
Customer associated with an anonymous user
Instance Attribute Summary collapse
-
#customer ⇒ String
The current value of customer.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Customer
constructor
A new instance of Customer.
- #to_body ⇒ Object
- #to_json(options = {}) ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Customer
Returns a new instance of Customer.
10 11 12 13 14 15 16 |
# File 'lib/attune/models/customer.rb', line 10 def initialize(attributes = {}) return if attributes.empty? # Workaround since JSON.parse has accessors as strings rather than symbols @customer = attributes["customer"] || attributes[:"customer"] end |
Instance Attribute Details
#customer ⇒ String
Returns the current value of customer.
6 7 8 |
# File 'lib/attune/models/customer.rb', line 6 def customer @customer end |
Instance Method Details
#to_body ⇒ Object
18 19 20 21 22 23 |
# File 'lib/attune/models/customer.rb', line 18 def to_body Hash[ATTRIBUTE_MAP.map do |internal, external| next unless value = send(internal) [external, value] end.compact] end |
#to_json(options = {}) ⇒ Object
25 26 27 |
# File 'lib/attune/models/customer.rb', line 25 def to_json( = {}) to_body.to_json end |