Class: Io::Flow::V0::Models::LocalizedPrice
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::LocalizedPrice
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ LocalizedPrice
constructor
A new instance of LocalizedPrice.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ LocalizedPrice
Returns a new instance of LocalizedPrice.
10959 10960 10961 10962 10963 10964 10965 10966 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10959 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:key, :currency, :amount, :label], 'LocalizedPrice') @key = (x = opts.delete(:key); x.is_a?(::Io::Flow::V0::Models::LocalizedPriceKey) ? x : ::Io::Flow::V0::Models::LocalizedPriceKey.apply(x)) @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String) @amount = HttpClient::Preconditions.assert_class('amount', opts.delete(:amount), Numeric) @label = HttpClient::Preconditions.assert_class('label', opts.delete(:label), String) end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
10957 10958 10959 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10957 def amount @amount end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
10957 10958 10959 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10957 def currency @currency end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
10957 10958 10959 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10957 def key @key end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
10957 10958 10959 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10957 def label @label end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
10972 10973 10974 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10972 def copy(incoming={}) LocalizedPrice.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
10976 10977 10978 10979 10980 10981 10982 10983 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10976 def to_hash { :key => key.value, :currency => currency, :amount => amount, :label => label } end |
#to_json ⇒ Object
10968 10969 10970 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10968 def to_json JSON.dump(to_hash) end |