Class: Io::Flow::V0::Models::SessionCurrencyFormat

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ SessionCurrencyFormat

Returns a new instance of SessionCurrencyFormat.



60596
60597
60598
60599
60600
60601
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60596

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:symbol, :label_formatters], 'SessionCurrencyFormat')
  @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_formattersObject (readonly)

Returns the value of attribute label_formatters.



60594
60595
60596
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60594

def label_formatters
  @label_formatters
end

#symbolObject (readonly)

Returns the value of attribute symbol.



60594
60595
60596
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60594

def symbol
  @symbol
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



60607
60608
60609
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60607

def copy(incoming={})
  SessionCurrencyFormat.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



60611
60612
60613
60614
60615
60616
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60611

def to_hash
  {
    :symbol => symbol.value,
    :label_formatters => label_formatters.map { |o| o.value }
  }
end

#to_jsonObject



60603
60604
60605
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60603

def to_json
  JSON.dump(to_hash)
end