class Io::Flow::V0::Models::SnapshotUpserted

Attributes

available[R]
center_key[R]
event_id[R]
item_number[R]
organization[R]
quantity[R]
snapshot_id[R]
timestamp[R]

Public Class Methods

new(incoming={}) click to toggle source
Calls superclass method Io::Flow::V0::Models::Event::new
# File lib/flow_commerce/flow_api_v0_client.rb, line 68589
def initialize(incoming={})
  super(:discriminator => Event::Types::SNAPSHOT_UPSERTED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :organization, :snapshot_id, :available, :center_key, :item_number, :quantity], 'SnapshotUpserted')
  @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)
  @organization = HttpClient::Preconditions.assert_class('organization', opts.delete(:organization), String)
  @snapshot_id = HttpClient::Preconditions.assert_class('snapshot_id', opts.delete(:snapshot_id), String)
  @available = HttpClient::Preconditions.assert_class('available', opts.delete(:available), Integer)
  @center_key = HttpClient::Preconditions.assert_class('center_key', opts.delete(:center_key), String)
  @item_number = HttpClient::Preconditions.assert_class('item_number', opts.delete(:item_number), String)
  @quantity = HttpClient::Preconditions.assert_class('quantity', opts.delete(:quantity), Integer)
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 68607
def copy(incoming={})
  SnapshotUpserted.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
subtype_to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 68611
def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :organization => organization,
    :snapshot_id => snapshot_id,
    :available => available,
    :center_key => center_key,
    :item_number => item_number,
    :quantity => quantity
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 68603
def to_json
  JSON.dump(to_hash)
end