Class: Io::Flow::V0::Models::SnapshotUpserted

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

Returns a new instance of SnapshotUpserted.



27009
27010
27011
27012
27013
27014
27015
27016
27017
27018
27019
27020
27021
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27009

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

Instance Attribute Details

#availableObject (readonly)

Returns the value of attribute available.



27007
27008
27009
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27007

def available
  @available
end

#center_keyObject (readonly)

Returns the value of attribute center_key.



27007
27008
27009
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27007

def center_key
  @center_key
end

#event_idObject (readonly)

Returns the value of attribute event_id.



27007
27008
27009
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27007

def event_id
  @event_id
end

#item_numberObject (readonly)

Returns the value of attribute item_number.



27007
27008
27009
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27007

def item_number
  @item_number
end

#organizationObject (readonly)

Returns the value of attribute organization.



27007
27008
27009
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27007

def organization
  @organization
end

#quantityObject (readonly)

Returns the value of attribute quantity.



27007
27008
27009
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27007

def quantity
  @quantity
end

#snapshot_idObject (readonly)

Returns the value of attribute snapshot_id.



27007
27008
27009
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27007

def snapshot_id
  @snapshot_id
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



27007
27008
27009
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27007

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



27027
27028
27029
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27027

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

#subtype_to_hashObject



27031
27032
27033
27034
27035
27036
27037
27038
27039
27040
27041
27042
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27031

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_jsonObject



27023
27024
27025
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27023

def to_json
  JSON.dump(to_hash)
end