Class: Workarea::Emarsys::Contact
- Inherits:
-
Object
- Object
- Workarea::Emarsys::Contact
- Defined in:
- app/services/emarsys/contact.rb,
app/services/emarsys/contact/user.rb,
app/services/emarsys/contact/order.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(model, options = {}) ⇒ Contact
constructor
A new instance of Contact.
-
#to_h ⇒ Object
Hash.
Constructor Details
#initialize(model, options = {}) ⇒ Contact
Returns a new instance of Contact.
6 7 8 9 |
# File 'app/services/emarsys/contact.rb', line 6 def initialize(model, = {}) @model = model @options = end |
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model.
4 5 6 |
# File 'app/services/emarsys/contact.rb', line 4 def model @model end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'app/services/emarsys/contact.rb', line 4 def @options end |
Instance Method Details
#to_h ⇒ Object
Returns Hash.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/services/emarsys/contact.rb', line 12 def to_h user_data = { "1" => contact_model.first_name, "2" => contact_model.last_name, "3" => contact_model.email } if address.present? address_data = { "10" => address.street, "11" => address.city, "12" => address.region, "13" => address.postal_code, "14" => ::Emarsys::Country.new.find_code(address.country.to_s), "15" => address.phone_number } user_data.merge!(address_data) end user_data end |