Class: OnlinePayments::SDK::Domain::Shipping

Inherits:
OnlinePayments::SDK::DataObject show all
Defined in:
lib/onlinepayments/sdk/domain/shipping.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from OnlinePayments::SDK::DataObject

new_from_hash

Instance Attribute Details

#addressOnlinePayments::SDK::Domain::AddressPersonal

Returns the current value of address.

Returns:



20
21
22
# File 'lib/onlinepayments/sdk/domain/shipping.rb', line 20

def address
  @address
end

#address_indicatorString

Returns the current value of address_indicator.

Returns:

  • (String)

    the current value of address_indicator



20
21
22
# File 'lib/onlinepayments/sdk/domain/shipping.rb', line 20

def address_indicator
  @address_indicator
end

#email_addressString

Returns the current value of email_address.

Returns:

  • (String)

    the current value of email_address



20
21
22
# File 'lib/onlinepayments/sdk/domain/shipping.rb', line 20

def email_address
  @email_address
end

#first_usage_dateString

Returns the current value of first_usage_date.

Returns:

  • (String)

    the current value of first_usage_date



20
21
22
# File 'lib/onlinepayments/sdk/domain/shipping.rb', line 20

def first_usage_date
  @first_usage_date
end

#is_first_usagetrue/false

Returns the current value of is_first_usage.

Returns:

  • (true/false)

    the current value of is_first_usage



20
21
22
# File 'lib/onlinepayments/sdk/domain/shipping.rb', line 20

def is_first_usage
  @is_first_usage
end

#methodOnlinePayments::SDK::Domain::ShippingMethod

Returns the current value of method.

Returns:



20
21
22
# File 'lib/onlinepayments/sdk/domain/shipping.rb', line 20

def method
  @method
end

#shipping_costLong

Returns the current value of shipping_cost.

Returns:

  • (Long)

    the current value of shipping_cost



20
21
22
# File 'lib/onlinepayments/sdk/domain/shipping.rb', line 20

def shipping_cost
  @shipping_cost
end

#shipping_cost_taxLong

Returns the current value of shipping_cost_tax.

Returns:

  • (Long)

    the current value of shipping_cost_tax



20
21
22
# File 'lib/onlinepayments/sdk/domain/shipping.rb', line 20

def shipping_cost_tax
  @shipping_cost_tax
end

#typeString

Returns the current value of type.

Returns:

  • (String)

    the current value of type



20
21
22
# File 'lib/onlinepayments/sdk/domain/shipping.rb', line 20

def type
  @type
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
# File 'lib/onlinepayments/sdk/domain/shipping.rb', line 46

def from_hash(hash)
  super
  if hash.key? 'address'
    raise TypeError, "value '%s' is not a Hash" % [hash['address']] unless hash['address'].is_a? Hash
    @address = OnlinePayments::SDK::Domain::AddressPersonal.new_from_hash(hash['address'])
  end
  @address_indicator = hash['addressIndicator'] if hash.key? 'addressIndicator'
  @email_address = hash['emailAddress'] if hash.key? 'emailAddress'
  @first_usage_date = hash['firstUsageDate'] if hash.key? 'firstUsageDate'
  @is_first_usage = hash['isFirstUsage'] if hash.key? 'isFirstUsage'
  if hash.key? 'method'
    raise TypeError, "value '%s' is not a Hash" % [hash['method']] unless hash['method'].is_a? Hash
    @method = OnlinePayments::SDK::Domain::ShippingMethod.new_from_hash(hash['method'])
  end
  @shipping_cost = hash['shippingCost'] if hash.key? 'shippingCost'
  @shipping_cost_tax = hash['shippingCostTax'] if hash.key? 'shippingCostTax'
  @type = hash['type'] if hash.key? 'type'
end

#to_hHash

Returns:

  • (Hash)


32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/onlinepayments/sdk/domain/shipping.rb', line 32

def to_h
  hash = super
  hash['address'] = @address.to_h if @address
  hash['addressIndicator'] = @address_indicator unless @address_indicator.nil?
  hash['emailAddress'] = @email_address unless @email_address.nil?
  hash['firstUsageDate'] = @first_usage_date unless @first_usage_date.nil?
  hash['isFirstUsage'] = @is_first_usage unless @is_first_usage.nil?
  hash['method'] = @method.to_h if @method
  hash['shippingCost'] = @shipping_cost unless @shipping_cost.nil?
  hash['shippingCostTax'] = @shipping_cost_tax unless @shipping_cost_tax.nil?
  hash['type'] = @type unless @type.nil?
  hash
end