class Ingenico::Connect::SDK::Domain::Payment::ShoppingCart
@attr [Array<Ingenico::Connect::SDK::Domain::Payment::AmountBreakdown>] amount_breakdown
@attr [Ingenico::Connect::SDK::Domain::Payment::GiftCardPurchase] gift_card_purchase
@attr [true/false] is_pre_order
@attr [Array<Ingenico::Connect::SDK::Domain::Payment::LineItem>] items @attr [String] pre_order_item_availability_date
@attr [true/false] re_order_indicator
Attributes
amount_breakdown[RW]
gift_card_purchase[RW]
is_pre_order[RW]
items[RW]
pre_order_item_availability_date[RW]
re_order_indicator[RW]
Public Instance Methods
from_hash(hash)
click to toggle source
Calls superclass method
Ingenico::Connect::SDK::DataObject#from_hash
# 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()
click to toggle source
@return (Hash)
Calls superclass method
Ingenico::Connect::SDK::DataObject#to_h
# 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