Class: Io::Flow::V0::Models::AllocationUpserted

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

Returns a new instance of AllocationUpserted.



12507
12508
12509
12510
12511
12512
12513
12514
12515
12516
12517
12518
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12507

def initialize(incoming={})
  super(:discriminator => Event::Types::ALLOCATION_UPSERTED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :id, :organization, :order_id, :order_number, :details], 'AllocationUpserted')
  @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)
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @organization = HttpClient::Preconditions.assert_class('organization', opts.delete(:organization), String)
  @order_id = HttpClient::Preconditions.assert_class('order_id', opts.delete(:order_id), String)
  @order_number = HttpClient::Preconditions.assert_class('order_number', opts.delete(:order_number), String)
  @details = HttpClient::Preconditions.assert_class('details', opts.delete(:details), Array).map { |v| HttpClient::Preconditions.assert_class('details', HttpClient::Helper.to_object(v), Hash) }
end

Instance Attribute Details

#detailsObject (readonly)

Returns the value of attribute details.



12505
12506
12507
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12505

def details
  @details
end

#event_idObject (readonly)

Returns the value of attribute event_id.



12505
12506
12507
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12505

def event_id
  @event_id
end

#idObject (readonly)

Returns the value of attribute id.



12505
12506
12507
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12505

def id
  @id
end

#order_idObject (readonly)

Returns the value of attribute order_id.



12505
12506
12507
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12505

def order_id
  @order_id
end

#order_numberObject (readonly)

Returns the value of attribute order_number.



12505
12506
12507
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12505

def order_number
  @order_number
end

#organizationObject (readonly)

Returns the value of attribute organization.



12505
12506
12507
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12505

def organization
  @organization
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



12505
12506
12507
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12505

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



12524
12525
12526
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12524

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

#subtype_to_hashObject



12528
12529
12530
12531
12532
12533
12534
12535
12536
12537
12538
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12528

def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :id => id,
    :organization => organization,
    :order_id => order_id,
    :order_number => order_number,
    :details => details
  }
end

#to_jsonObject



12520
12521
12522
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12520

def to_json
  JSON.dump(to_hash)
end