Class: Io::Flow::V0::Models::Hs10CodeUpserted

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

Overview

Event raised whenever an HS-10 code is assigned to an item

Instance Attribute Summary collapse

Attributes inherited from Event

#discriminator

Instance Method Summary collapse

Methods inherited from Event

#to_hash

Constructor Details

#initialize(incoming = {}) ⇒ Hs10CodeUpserted

Returns a new instance of Hs10CodeUpserted.



13579
13580
13581
13582
13583
13584
13585
13586
13587
13588
13589
13590
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13579

def initialize(incoming={})
  super(:discriminator => Event::Types::HS10_CODE_UPSERTED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :organization, :number, :origin, :destination, :code], 'Hs10CodeUpserted')
  @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)
  @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String)
  @origin = HttpClient::Preconditions.assert_class('origin', opts.delete(:origin), String)
  @destination = HttpClient::Preconditions.assert_class('destination', opts.delete(:destination), String)
  @code = HttpClient::Preconditions.assert_class('code', opts.delete(:code), String)
end

Instance Attribute Details

#code ⇒ Object (readonly)

Returns the value of attribute code.



13577
13578
13579
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13577

def code
  @code
end

#destination ⇒ Object (readonly)

Returns the value of attribute destination.



13577
13578
13579
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13577

def destination
  @destination
end

#event_id ⇒ Object (readonly)

Returns the value of attribute event_id.



13577
13578
13579
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13577

def event_id
  @event_id
end

#number ⇒ Object (readonly)

Returns the value of attribute number.



13577
13578
13579
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13577

def number
  @number
end

#organization ⇒ Object (readonly)

Returns the value of attribute organization.



13577
13578
13579
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13577

def organization
  @organization
end

#origin ⇒ Object (readonly)

Returns the value of attribute origin.



13577
13578
13579
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13577

def origin
  @origin
end

#timestamp ⇒ Object (readonly)

Returns the value of attribute timestamp.



13577
13578
13579
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13577

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



13596
13597
13598
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13596

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

#subtype_to_hash ⇒ Object



13600
13601
13602
13603
13604
13605
13606
13607
13608
13609
13610
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13600

def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :organization => organization,
    :number => number,
    :origin => origin,
    :destination => destination,
    :code => code
  }
end

#to_json ⇒ Object



13592
13593
13594
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13592

def to_json
  JSON.dump(to_hash)
end