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.



34976
34977
34978
34979
34980
34981
34982
34983
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34976

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::V0::Models::ChannelCurrency) ? x : ::Io::Flow::V0::Models::ChannelCurrency.new(x))
end

Instance Attribute Details

#channel_currencyObject (readonly)

Returns the value of attribute channel_currency.



34974
34975
34976
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34974

def channel_currency
  @channel_currency
end

#event_idObject (readonly)

Returns the value of attribute event_id.



34974
34975
34976
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34974

def event_id
  @event_id
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



34974
34975
34976
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34974

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



34989
34990
34991
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34989

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

#subtype_to_hashObject



34993
34994
34995
34996
34997
34998
34999
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34993

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

#to_jsonObject



34985
34986
34987
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34985

def to_json
  JSON.dump(to_hash)
end