Class: Worldline::Connect::SDK::V1::Domain::ShoppingCart

Inherits:
Domain::DataObject show all
Defined in:
lib/worldline/connect/sdk/v1/domain/shopping_cart.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Domain::DataObject

new_from_hash

Instance Attribute Details

#amount_breakdownArray<Worldline::Connect::SDK::V1::Domain::AmountBreakdown>

Returns the current value of amount_breakdown.

Returns:



21
22
23
# File 'lib/worldline/connect/sdk/v1/domain/shopping_cart.rb', line 21

def amount_breakdown
  @amount_breakdown
end

#gift_card_purchaseWorldline::Connect::SDK::V1::Domain::GiftCardPurchase

Returns the current value of gift_card_purchase.

Returns:



21
22
23
# File 'lib/worldline/connect/sdk/v1/domain/shopping_cart.rb', line 21

def gift_card_purchase
  @gift_card_purchase
end

#is_pre_ordertrue/false

Returns the current value of is_pre_order.

Returns:

  • (true/false)

    the current value of is_pre_order



21
22
23
# File 'lib/worldline/connect/sdk/v1/domain/shopping_cart.rb', line 21

def is_pre_order
  @is_pre_order
end

#itemsArray<Worldline::Connect::SDK::V1::Domain::LineItem>

Returns the current value of items.

Returns:



21
22
23
# File 'lib/worldline/connect/sdk/v1/domain/shopping_cart.rb', line 21

def items
  @items
end

#pre_order_item_availability_dateString

Returns the current value of pre_order_item_availability_date.

Returns:

  • (String)

    the current value of pre_order_item_availability_date



21
22
23
# File 'lib/worldline/connect/sdk/v1/domain/shopping_cart.rb', line 21

def pre_order_item_availability_date
  @pre_order_item_availability_date
end

#re_order_indicatortrue/false

Returns the current value of re_order_indicator.

Returns:

  • (true/false)

    the current value of re_order_indicator



21
22
23
# File 'lib/worldline/connect/sdk/v1/domain/shopping_cart.rb', line 21

def re_order_indicator
  @re_order_indicator
end

Instance Method Details

#from_hash(hash) ⇒ Object



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
76
# File 'lib/worldline/connect/sdk/v1/domain/shopping_cart.rb', line 47

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 << Worldline::Connect::SDK::V1::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 = Worldline::Connect::SDK::V1::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 << Worldline::Connect::SDK::V1::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_hHash

Returns:

  • (Hash)


36
37
38
39
40
41
42
43
44
45
# File 'lib/worldline/connect/sdk/v1/domain/shopping_cart.rb', line 36

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