Class: Io::Flow::V0::Models::ExperienceCurrencyFormat

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 = {}) ⇒ ExperienceCurrencyFormat

Returns a new instance of ExperienceCurrencyFormat.



23420
23421
23422
23423
23424
23425
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23420

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



23418
23419
23420
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23418

def label_formatters
  @label_formatters
end

#symbolObject (readonly)

Returns the value of attribute symbol.



23418
23419
23420
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23418

def symbol
  @symbol
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



23431
23432
23433
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23431

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

#to_hashObject



23435
23436
23437
23438
23439
23440
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23435

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

#to_jsonObject



23427
23428
23429
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23427

def to_json
  JSON.dump(to_hash)
end