Class: MusicTodayApiWrapper::Resources::Checkout::Destination

Inherits:
Object
  • Object
show all
Defined in:
lib/resources/checkout/destination.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(customer, shipping_option = '', shipping_cost = 0.0) ⇒ Destination

Returns a new instance of Destination.



10
11
12
13
14
# File 'lib/resources/checkout/destination.rb', line 10

def initialize(customer, shipping_option = '', shipping_cost = 0.0)
  @customer = customer
  @shipping_option = shipping_option
  @shipping_cost = shipping_cost.to_f
end

Instance Attribute Details

#customerObject

Returns the value of attribute customer.



8
9
10
# File 'lib/resources/checkout/destination.rb', line 8

def customer
  @customer
end

#shipping_costObject

Returns the value of attribute shipping_cost.



8
9
10
# File 'lib/resources/checkout/destination.rb', line 8

def shipping_cost
  @shipping_cost
end

#shipping_optionObject

Returns the value of attribute shipping_option.



8
9
10
# File 'lib/resources/checkout/destination.rb', line 8

def shipping_option
  @shipping_option
end

Instance Method Details

#as_hashObject



16
17
18
19
20
21
# File 'lib/resources/checkout/destination.rb', line 16

def as_hash
  { requestedShippingOption: @shipping_option,
    shippingCost: @shipping_cost,
    shipToBillTo: false,
    address: @customer.as_hash }
end