class Io::Flow::V0::Models::ChannelCurrency

Attributes

capabilities[R]
channel[R]
currency[R]
id[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 34913
def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :currency, :channel, :capabilities], 'ChannelCurrency')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
  @channel = (x = opts.delete(:channel); x.is_a?(::Io::Flow::V0::Models::ChannelReference) ? x : ::Io::Flow::V0::Models::ChannelReference.new(x))
  @capabilities = HttpClient::Preconditions.assert_class('capabilities', opts.delete(:capabilities), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ChannelCurrencyCapability) ? x : ::Io::Flow::V0::Models::ChannelCurrencyCapability.apply(x)) }
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 34926
def copy(incoming={})
  ChannelCurrency.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 34930
def to_hash
  {
    :id => id,
    :currency => currency,
    :channel => channel.to_hash,
    :capabilities => capabilities.map { |o| o.value }
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 34922
def to_json
  JSON.dump(to_hash)
end