Class: Io::Flow::V0::Models::OrderReplacementUpserted

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

Returns a new instance of OrderReplacementUpserted.



47965
47966
47967
47968
47969
47970
47971
47972
47973
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47965

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

Instance Attribute Details

#event_idObject (readonly)

Returns the value of attribute event_id.



47963
47964
47965
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47963

def event_id
  @event_id
end

#order_replacementObject (readonly)

Returns the value of attribute order_replacement.



47963
47964
47965
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47963

def order_replacement
  @order_replacement
end

#organizationObject (readonly)

Returns the value of attribute organization.



47963
47964
47965
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47963

def organization
  @organization
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



47963
47964
47965
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47963

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



47979
47980
47981
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47979

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

#subtype_to_hashObject



47983
47984
47985
47986
47987
47988
47989
47990
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47983

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

#to_jsonObject



47975
47976
47977
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47975

def to_json
  JSON.dump(to_hash)
end