Class: Io::Flow::V0::Models::CurrencyFormat
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::CurrencyFormat
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#label_formatters ⇒ Object
readonly
Returns the value of attribute label_formatters.
-
#symbol ⇒ Object
readonly
Returns the value of attribute symbol.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ CurrencyFormat
constructor
A new instance of CurrencyFormat.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ CurrencyFormat
Returns a new instance of CurrencyFormat.
22546 22547 22548 22549 22550 22551 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22546 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:symbol, :label_formatters], 'CurrencyFormat') @symbol = (x = opts.delete(:symbol); x.is_a?(::Io::Flow::V0::Models::CurrencySymbolFormat) ? x : ::Io::Flow::V0::Models::CurrencySymbolFormat.apply(x)) @label_formatters = HttpClient::Preconditions.assert_class('label_formatters', opts.delete(:label_formatters), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::CurrencyLabelFormatter) ? x : ::Io::Flow::V0::Models::CurrencyLabelFormatter.apply(x)) } end |
Instance Attribute Details
#label_formatters ⇒ Object (readonly)
Returns the value of attribute label_formatters.
22544 22545 22546 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22544 def label_formatters @label_formatters end |
#symbol ⇒ Object (readonly)
Returns the value of attribute symbol.
22544 22545 22546 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22544 def symbol @symbol end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
22557 22558 22559 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22557 def copy(incoming={}) CurrencyFormat.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
22561 22562 22563 22564 22565 22566 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22561 def to_hash { :symbol => symbol.value, :label_formatters => label_formatters.map { |o| o.value } } end |
#to_json ⇒ Object
22553 22554 22555 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22553 def to_json JSON.dump(to_hash) end |