Class: OnlinePayments::SDK::Domain::ShoppingCart
- Inherits:
-
DataObject
- Object
- DataObject
- OnlinePayments::SDK::Domain::ShoppingCart
- Defined in:
- lib/onlinepayments/sdk/domain/shopping_cart.rb
Instance Attribute Summary collapse
-
#amount_breakdown ⇒ Object
deprecated
Deprecated.
Use order.shipping.shippingCost for shipping cost. Other amounts are not used. Determines how the total amount is split into amount types
-
#gift_card_purchase ⇒ OnlinePayments::SDK::Domain::GiftCardPurchase
The current value of gift_card_purchase.
-
#is_pre_order ⇒ true/false
The current value of is_pre_order.
-
#items ⇒ Array<OnlinePayments::SDK::Domain::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 DataObject
Instance Attribute Details
#amount_breakdown ⇒ Object
Deprecated.
Use order.shipping.shippingCost for shipping cost. Other amounts are not used. Determines how the total amount is split into amount types
18 19 20 |
# File 'lib/onlinepayments/sdk/domain/shopping_cart.rb', line 18 def amount_breakdown @amount_breakdown end |
#gift_card_purchase ⇒ OnlinePayments::SDK::Domain::GiftCardPurchase
Returns the current value of gift_card_purchase.
18 19 20 |
# File 'lib/onlinepayments/sdk/domain/shopping_cart.rb', line 18 def gift_card_purchase @gift_card_purchase end |
#is_pre_order ⇒ true/false
Returns the current value of is_pre_order.
18 19 20 |
# File 'lib/onlinepayments/sdk/domain/shopping_cart.rb', line 18 def is_pre_order @is_pre_order end |
#items ⇒ Array<OnlinePayments::SDK::Domain::LineItem>
Returns the current value of items.
18 19 20 |
# File 'lib/onlinepayments/sdk/domain/shopping_cart.rb', line 18 def items @items end |
#pre_order_item_availability_date ⇒ String
Returns the current value of pre_order_item_availability_date.
18 19 20 |
# File 'lib/onlinepayments/sdk/domain/shopping_cart.rb', line 18 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.
18 19 20 |
# File 'lib/onlinepayments/sdk/domain/shopping_cart.rb', line 18 def re_order_indicator @re_order_indicator end |
Instance Method Details
#from_hash(hash) ⇒ Object
45 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 |
# File 'lib/onlinepayments/sdk/domain/shopping_cart.rb', line 45 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 << OnlinePayments::SDK::Domain::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 = OnlinePayments::SDK::Domain::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 << OnlinePayments::SDK::Domain::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
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/onlinepayments/sdk/domain/shopping_cart.rb', line 34 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 |