Class: Io::Flow::V0::Models::ChannelCurrencyUpserted

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

Instance Attribute Summary collapse

Attributes inherited from Event

#discriminator

Instance Method Summary collapse

Methods inherited from Event

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ ChannelCurrencyUpserted

Returns a new instance of ChannelCurrencyUpserted.



32223
32224
32225
32226
32227
32228
32229
32230
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32223

def initialize(incoming={})
  super(:discriminator => Event::Types::CHANNEL_CURRENCY_UPSERTED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :channel_currency], 'ChannelCurrencyUpserted')
  @event_id = HttpClient::Preconditions.assert_class('event_id', opts.delete(:event_id), String)
  @timestamp = HttpClient::Preconditions.assert_class('timestamp', HttpClient::Helper.to_date_time_iso8601(opts.delete(:timestamp)), DateTime)
  @channel_currency = (x = opts.delete(:channel_currency); x.is_a?(::Io::Flow::Channel::Internal::V0::Models::ChannelCurrency) ? x : ::Io::Flow::Channel::Internal::V0::Models::ChannelCurrency.new(x))
end

Instance Attribute Details

#channel_currencyObject (readonly)

Returns the value of attribute channel_currency.



32221
32222
32223
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32221

def channel_currency
  @channel_currency
end

#event_idObject (readonly)

Returns the value of attribute event_id.



32221
32222
32223
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32221

def event_id
  @event_id
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



32221
32222
32223
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32221

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



32236
32237
32238
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32236

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

#subtype_to_hashObject



32240
32241
32242
32243
32244
32245
32246
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32240

def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :channel_currency => channel_currency.to_hash
  }
end

#to_jsonObject



32232
32233
32234
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32232

def to_json
  JSON.dump(to_hash)
end