Class: Ingenico::Connect::SDK::Domain::Payment::ShoppingCart
- Inherits:
-
Ingenico::Connect::SDK::DataObject
- Object
- Ingenico::Connect::SDK::DataObject
- Ingenico::Connect::SDK::Domain::Payment::ShoppingCart
- Defined in:
- lib/ingenico/connect/sdk/domain/payment/shopping_cart.rb
Instance Attribute Summary collapse
-
#amount_breakdown ⇒ Array<Ingenico::Connect::SDK::Domain::Payment::AmountBreakdown>
The current value of amount_breakdown.
-
#gift_card_purchase ⇒ Ingenico::Connect::SDK::Domain::Payment::GiftCardPurchase
The current value of gift_card_purchase.
-
#is_pre_order ⇒ true/false
The current value of is_pre_order.
-
#items ⇒ Array<Ingenico::Connect::SDK::Domain::Payment::LineItem>
The current value of items.
-
#pre_order_item_availability_date ⇒ String
The current value of pre_order_item_availability_date.
-
#re_order_indicator ⇒ true/false
The current value of re_order_indicator.
Instance Method Summary collapse
Methods inherited from Ingenico::Connect::SDK::DataObject
Instance Attribute Details
#amount_breakdown ⇒ Array<Ingenico::Connect::SDK::Domain::Payment::AmountBreakdown>
Returns the current value of amount_breakdown.
20 21 22 |
# File 'lib/ingenico/connect/sdk/domain/payment/shopping_cart.rb', line 20 def amount_breakdown @amount_breakdown end |
#gift_card_purchase ⇒ Ingenico::Connect::SDK::Domain::Payment::GiftCardPurchase
Returns the current value of gift_card_purchase.
20 21 22 |
# File 'lib/ingenico/connect/sdk/domain/payment/shopping_cart.rb', line 20 def gift_card_purchase @gift_card_purchase end |
#is_pre_order ⇒ true/false
Returns the current value of is_pre_order.
20 21 22 |
# File 'lib/ingenico/connect/sdk/domain/payment/shopping_cart.rb', line 20 def is_pre_order @is_pre_order end |
#items ⇒ Array<Ingenico::Connect::SDK::Domain::Payment::LineItem>
Returns the current value of items.
20 21 22 |
# File 'lib/ingenico/connect/sdk/domain/payment/shopping_cart.rb', line 20 def items @items end |
#pre_order_item_availability_date ⇒ String
Returns the current value of pre_order_item_availability_date.
20 21 22 |
# File 'lib/ingenico/connect/sdk/domain/payment/shopping_cart.rb', line 20 def pre_order_item_availability_date @pre_order_item_availability_date end |
#re_order_indicator ⇒ true/false
Returns the current value of re_order_indicator.
20 21 22 |
# File 'lib/ingenico/connect/sdk/domain/payment/shopping_cart.rb', line 20 def re_order_indicator @re_order_indicator end |
Instance Method Details
#from_hash(hash) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/ingenico/connect/sdk/domain/payment/shopping_cart.rb', line 46 def from_hash(hash) super if hash.has_key? 'amountBreakdown' raise TypeError, "value '%s' is not an Array" % [hash['amountBreakdown']] unless hash['amountBreakdown'].is_a? Array @amount_breakdown = [] hash['amountBreakdown'].each do |e| @amount_breakdown << Ingenico::Connect::SDK::Domain::Payment::AmountBreakdown.new_from_hash(e) end end if hash.has_key? 'giftCardPurchase' raise TypeError, "value '%s' is not a Hash" % [hash['giftCardPurchase']] unless hash['giftCardPurchase'].is_a? Hash @gift_card_purchase = Ingenico::Connect::SDK::Domain::Payment::GiftCardPurchase.new_from_hash(hash['giftCardPurchase']) end if hash.has_key? 'isPreOrder' @is_pre_order = hash['isPreOrder'] end if hash.has_key? 'items' raise TypeError, "value '%s' is not an Array" % [hash['items']] unless hash['items'].is_a? Array @items = [] hash['items'].each do |e| @items << Ingenico::Connect::SDK::Domain::Payment::LineItem.new_from_hash(e) end end if hash.has_key? 'preOrderItemAvailabilityDate' @pre_order_item_availability_date = hash['preOrderItemAvailabilityDate'] end if hash.has_key? 'reOrderIndicator' @re_order_indicator = hash['reOrderIndicator'] end end |
#to_h ⇒ Hash
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/ingenico/connect/sdk/domain/payment/shopping_cart.rb', line 35 def to_h hash = super hash['amountBreakdown'] = @amount_breakdown.collect{|val| val.to_h} unless @amount_breakdown.nil? hash['giftCardPurchase'] = @gift_card_purchase.to_h unless @gift_card_purchase.nil? hash['isPreOrder'] = @is_pre_order unless @is_pre_order.nil? hash['items'] = @items.collect{|val| val.to_h} unless @items.nil? hash['preOrderItemAvailabilityDate'] = @pre_order_item_availability_date unless @pre_order_item_availability_date.nil? hash['reOrderIndicator'] = @re_order_indicator unless @re_order_indicator.nil? hash end |