Class: Io::Flow::V0::Models::ShippingLaneUpserted

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

Returns a new instance of ShippingLaneUpserted.



51023
51024
51025
51026
51027
51028
51029
51030
51031
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51023

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

Instance Attribute Details

#event_idObject (readonly)

Returns the value of attribute event_id.



51021
51022
51023
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51021

def event_id
  @event_id
end

#organizationObject (readonly)

Returns the value of attribute organization.



51021
51022
51023
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51021

def organization
  @organization
end

#shipping_laneObject (readonly)

Returns the value of attribute shipping_lane.



51021
51022
51023
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51021

def shipping_lane
  @shipping_lane
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



51021
51022
51023
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51021

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



51037
51038
51039
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51037

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

#subtype_to_hashObject



51041
51042
51043
51044
51045
51046
51047
51048
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51041

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

#to_jsonObject



51033
51034
51035
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51033

def to_json
  JSON.dump(to_hash)
end