Class: Io::Flow::V0::Models::ChannelCurrency
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ChannelCurrency
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#capabilities ⇒ Object
readonly
Returns the value of attribute capabilities.
-
#channel ⇒ Object
readonly
Returns the value of attribute channel.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ChannelCurrency
constructor
A new instance of ChannelCurrency.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ChannelCurrency
Returns a new instance of ChannelCurrency.
34913 34914 34915 34916 34917 34918 34919 34920 |
# 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 |
Instance Attribute Details
#capabilities ⇒ Object (readonly)
Returns the value of attribute capabilities.
34911 34912 34913 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34911 def capabilities @capabilities end |
#channel ⇒ Object (readonly)
Returns the value of attribute channel.
34911 34912 34913 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34911 def channel @channel end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
34911 34912 34913 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34911 def currency @currency end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
34911 34912 34913 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34911 def id @id end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
34926 34927 34928 |
# 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 ⇒ Object
34930 34931 34932 34933 34934 34935 34936 34937 |
# 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 ⇒ Object
34922 34923 34924 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34922 def to_json JSON.dump(to_hash) end |