Class: MusicTodayApiWrapper::Resources::Checkout::Session
- Inherits:
-
Object
- Object
- MusicTodayApiWrapper::Resources::Checkout::Session
- Defined in:
- lib/resources/checkout/session.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#id ⇒ Object
Returns the value of attribute id.
-
#items ⇒ Object
Returns the value of attribute items.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id, address, items = []) ⇒ Session
constructor
A new instance of Session.
Constructor Details
#initialize(id, address, items = []) ⇒ Session
Returns a new instance of Session.
10 11 12 13 14 |
# File 'lib/resources/checkout/session.rb', line 10 def initialize(id, address, items = []) @id = id @address = address @items = items end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
8 9 10 |
# File 'lib/resources/checkout/session.rb', line 8 def address @address end |
#id ⇒ Object
Returns the value of attribute id.
8 9 10 |
# File 'lib/resources/checkout/session.rb', line 8 def id @id end |
#items ⇒ Object
Returns the value of attribute items.
8 9 10 |
# File 'lib/resources/checkout/session.rb', line 8 def items @items end |
Class Method Details
.from_hash(session_hash) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/resources/checkout/session.rb', line 16 def self.from_hash(session_hash) address = Address.from_hash(session_hash) session = Session.new(session_hash['sessionId'], address) session_hash['items'].each do |item| session.items << Resources::Purchase::Item.from_hash(item) end session end |