Class: SixSaferpay::Order
- Inherits:
-
Object
- Object
- SixSaferpay::Order
- Defined in:
- lib/six_saferpay/models/order.rb
Instance Method Summary collapse
-
#initialize(items: []) ⇒ Order
constructor
A new instance of Order.
- #to_hash ⇒ Object (also: #to_h)
Constructor Details
#initialize(items: []) ⇒ Order
Returns a new instance of Order.
8 9 10 11 12 13 14 15 |
# File 'lib/six_saferpay/models/order.rb', line 8 def initialize( items: [] ) if items @items = items.map {|item_attr| SixSaferpay::Item.new(item_attr) } end end |
Instance Method Details
#to_hash ⇒ Object Also known as: to_h
17 18 19 20 21 22 23 |
# File 'lib/six_saferpay/models/order.rb', line 17 def to_hash hash = Hash.new if @items hash.merge!(items: items.map(&:to_hash)) end hash end |