Class: Io::Flow::V0::Models::FullyHarmonizedItemUpserted

Inherits:
Event
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Event indicating insertion or changes to the details of a fully harmonized item. Will be triggered upon any change to the item being harmonized, its duties or taxes. If two changes occur within minutes of each other, it is possible only one upserted event will be produced, aggregating both changes.

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

Returns a new instance of FullyHarmonizedItemUpserted.



25593
25594
25595
25596
25597
25598
25599
25600
25601
25602
25603
25604
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25593

def initialize(incoming={})
  super(:discriminator => Event::Types::FULLY_HARMONIZED_ITEM_UPSERTED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :organization, :item_number, :customs_description, :hs6_code, :landed_costs], 'FullyHarmonizedItemUpserted')
  @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)
  @item_number = HttpClient::Preconditions.assert_class('item_number', opts.delete(:item_number), String)
  @customs_description = HttpClient::Preconditions.assert_class('customs_description', opts.delete(:customs_description), String)
  @hs6_code = HttpClient::Preconditions.assert_class('hs6_code', opts.delete(:hs6_code), String)
  @landed_costs = HttpClient::Preconditions.assert_class('landed_costs', opts.delete(:landed_costs), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::LaneLandedCost) ? x : ::Io::Flow::V0::Models::LaneLandedCost.new(x)) }
end

Instance Attribute Details

#customs_descriptionObject (readonly)

Returns the value of attribute customs_description.



25591
25592
25593
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25591

def customs_description
  @customs_description
end

#event_idObject (readonly)

Returns the value of attribute event_id.



25591
25592
25593
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25591

def event_id
  @event_id
end

#hs6_codeObject (readonly)

Returns the value of attribute hs6_code.



25591
25592
25593
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25591

def hs6_code
  @hs6_code
end

#item_numberObject (readonly)

Returns the value of attribute item_number.



25591
25592
25593
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25591

def item_number
  @item_number
end

#landed_costsObject (readonly)

Returns the value of attribute landed_costs.



25591
25592
25593
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25591

def landed_costs
  @landed_costs
end

#organizationObject (readonly)

Returns the value of attribute organization.



25591
25592
25593
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25591

def organization
  @organization
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



25591
25592
25593
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25591

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



25610
25611
25612
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25610

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

#subtype_to_hashObject



25614
25615
25616
25617
25618
25619
25620
25621
25622
25623
25624
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25614

def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :organization => organization,
    :item_number => item_number,
    :customs_description => customs_description,
    :hs6_code => hs6_code,
    :landed_costs => landed_costs.map { |o| o.to_hash }
  }
end

#to_jsonObject



25606
25607
25608
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25606

def to_json
  JSON.dump(to_hash)
end