Class: Io::Flow::V0::Models::ChannelUpserted

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

Returns a new instance of ChannelUpserted.



35797
35798
35799
35800
35801
35802
35803
35804
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35797

def initialize(incoming={})
  super(:discriminator => Event::Types::CHANNEL_UPSERTED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :channel], 'ChannelUpserted')
  @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 = (x = opts.delete(:channel); x.is_a?(::Io::Flow::V0::Models::Channel) ? x : ::Io::Flow::V0::Models::Channel.new(x))
end

Instance Attribute Details

#channelObject (readonly)

Returns the value of attribute channel.



35795
35796
35797
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35795

def channel
  @channel
end

#event_idObject (readonly)

Returns the value of attribute event_id.



35795
35796
35797
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35795

def event_id
  @event_id
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



35795
35796
35797
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35795

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



35810
35811
35812
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35810

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

#subtype_to_hashObject



35814
35815
35816
35817
35818
35819
35820
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35814

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

#to_jsonObject



35806
35807
35808
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35806

def to_json
  JSON.dump(to_hash)
end