Class: Io::Flow::V0::Models::ItemMarginUpserted

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

#to_hash

Constructor Details

#initialize(incoming = {}) ⇒ ItemMarginUpserted

Returns a new instance of ItemMarginUpserted.



14997
14998
14999
15000
15001
15002
15003
15004
15005
15006
15007
15008
15009
15010
15011
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14997

def initialize(incoming={})
  super(:discriminator => Event::Types::ITEM_MARGIN_UPSERTED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :item_margin_id, :organization_id, :experience_key, :name, :q, :fixed, :percent, :position], 'ItemMarginUpserted')
  @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)
  @item_margin_id = HttpClient::Preconditions.assert_class('item_margin_id', opts.delete(:item_margin_id), String)
  @organization_id = HttpClient::Preconditions.assert_class('organization_id', opts.delete(:organization_id), String)
  @experience_key = HttpClient::Preconditions.assert_class('experience_key', opts.delete(:experience_key), String)
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @q = HttpClient::Preconditions.assert_class('q', opts.delete(:q), String)
  @fixed = HttpClient::Preconditions.assert_class('fixed', HttpClient::Helper.to_big_decimal(opts.delete(:fixed)), BigDecimal)
  @percent = HttpClient::Preconditions.assert_class('percent', HttpClient::Helper.to_big_decimal(opts.delete(:percent)), BigDecimal)
  @position = HttpClient::Preconditions.assert_class('position', opts.delete(:position), Integer)
end

Instance Attribute Details

#event_id ⇒ Object (readonly)

Returns the value of attribute event_id.



14995
14996
14997
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14995

def event_id
  @event_id
end

#experience_key ⇒ Object (readonly)

Returns the value of attribute experience_key.



14995
14996
14997
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14995

def experience_key
  @experience_key
end

#fixed ⇒ Object (readonly)

Returns the value of attribute fixed.



14995
14996
14997
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14995

def fixed
  @fixed
end

#item_margin_id ⇒ Object (readonly)

Returns the value of attribute item_margin_id.



14995
14996
14997
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14995

def item_margin_id
  @item_margin_id
end

#name ⇒ Object (readonly)

Returns the value of attribute name.



14995
14996
14997
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14995

def name
  @name
end

#organization_id ⇒ Object (readonly)

Returns the value of attribute organization_id.



14995
14996
14997
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14995

def organization_id
  @organization_id
end

#percent ⇒ Object (readonly)

Returns the value of attribute percent.



14995
14996
14997
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14995

def percent
  @percent
end

#position ⇒ Object (readonly)

Returns the value of attribute position.



14995
14996
14997
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14995

def position
  @position
end

#q ⇒ Object (readonly)

Returns the value of attribute q.



14995
14996
14997
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14995

def q
  @q
end

#timestamp ⇒ Object (readonly)

Returns the value of attribute timestamp.



14995
14996
14997
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14995

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



15017
15018
15019
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15017

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

#subtype_to_hash ⇒ Object



15021
15022
15023
15024
15025
15026
15027
15028
15029
15030
15031
15032
15033
15034
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15021

def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :item_margin_id => item_margin_id,
    :organization_id => organization_id,
    :experience_key => experience_key,
    :name => name,
    :q => q,
    :fixed => fixed,
    :percent => percent,
    :position => position
  }
end

#to_json ⇒ Object



15013
15014
15015
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15013

def to_json
  JSON.dump(to_hash)
end