Class: Workarea::GlobalE::CartUserDetails
- Inherits:
-
Object
- Object
- Workarea::GlobalE::CartUserDetails
- Defined in:
- app/services/workarea/global_e/cart_user_details.rb
Instance Attribute Summary collapse
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#address_details ⇒ Array<Workarea::GlobalE::AddressDetails>
All available addresses taken from the registered customer address book.
- #as_json(*args) ⇒ Object
-
#initialize(user) ⇒ CartUserDetails
constructor
A new instance of CartUserDetails.
-
#user_id ⇒ String
Internal User identifier on the Merchant’s site.
Constructor Details
#initialize(user) ⇒ CartUserDetails
Returns a new instance of CartUserDetails.
6 7 8 |
# File 'app/services/workarea/global_e/cart_user_details.rb', line 6 def initialize(user) @user = user end |
Instance Attribute Details
#user ⇒ Object (readonly)
Returns the value of attribute user.
4 5 6 |
# File 'app/services/workarea/global_e/cart_user_details.rb', line 4 def user @user end |
Instance Method Details
#address_details ⇒ Array<Workarea::GlobalE::AddressDetails>
All available addresses taken from the registered customer address book
29 30 31 |
# File 'app/services/workarea/global_e/cart_user_details.rb', line 29 def address_details @address_details ||= user.addresses.map { |address| AddressDetails.new user, address } end |
#as_json(*args) ⇒ Object
10 11 12 13 14 15 |
# File 'app/services/workarea/global_e/cart_user_details.rb', line 10 def as_json(*args) { UserId: user_id, AddressDetails: address_details }.compact end |
#user_id ⇒ String
Internal User identifier on the Merchant’s site.
21 22 23 |
# File 'app/services/workarea/global_e/cart_user_details.rb', line 21 def user_id user.id.to_s end |