Class: SpApiHelpers::MoneyType

Inherits:
Object
  • Object
show all
Defined in:
lib/sp_api_helpers.rb

Constant Summary collapse

USD =
"USD"
EUR =
"EUR"
GBP =
"GBP"
RMB =
"RMB"
INR =
"INR"
JPY =
"JPY"
CAD =
"CAD"
MXN =
"MXN"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(amount, currency_code = USD) ⇒ MoneyType

Returns a new instance of MoneyType.



82
83
84
85
# File 'lib/sp_api_helpers.rb', line 82

def initialize(amount, currency_code = USD)
  @amount = amount.to_f
  @currency_code = currency_code
end

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



80
81
82
# File 'lib/sp_api_helpers.rb', line 80

def amount
  @amount
end

#currency_codeObject

Returns the value of attribute currency_code.



80
81
82
# File 'lib/sp_api_helpers.rb', line 80

def currency_code
  @currency_code
end

Instance Method Details

#to_camelizeObject



87
88
89
90
91
92
# File 'lib/sp_api_helpers.rb', line 87

def to_camelize
  {
    "Amount" => amount,
    "CurrencyCode" => currency_code
  }
end