Class: Io::Flow::V0::Models::ShippingNotification
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ShippingNotification
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents information about a client-facilitated shipment where the shipping label and fulfillment was not handled by Flow. For merchant-of-record and tracking purposes, clients doing their own shipping will need to notify Flow of shipped packages.
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#carrier_tracking_number ⇒ Object
readonly
Returns the value of attribute carrier_tracking_number.
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#flow_tracking_number ⇒ Object
readonly
Returns the value of attribute flow_tracking_number.
-
#fulfillment_key ⇒ Object
readonly
Returns the value of attribute fulfillment_key.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
-
#order_identifier ⇒ Object
readonly
Returns the value of attribute order_identifier.
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
-
#package ⇒ Object
readonly
Returns the value of attribute package.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
-
#shipment_recipient ⇒ Object
readonly
Returns the value of attribute shipment_recipient.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
-
#window ⇒ Object
readonly
Returns the value of attribute window.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ShippingNotification
constructor
A new instance of ShippingNotification.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ShippingNotification
Returns a new instance of ShippingNotification.
66966 66967 66968 66969 66970 66971 66972 66973 66974 66975 66976 66977 66978 66979 66980 66981 66982 66983 66984 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66966 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :key, :carrier_tracking_number, :destination, :flow_tracking_number, :origin, :service], 'ShippingNotification') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String) @attributes = HttpClient::Preconditions.assert_class('attributes', (x = opts.delete(:attributes); x.nil? ? {} : x), Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h } @carrier_tracking_number = HttpClient::Preconditions.assert_class('carrier_tracking_number', opts.delete(:carrier_tracking_number), String) @destination = (x = opts.delete(:destination); x.is_a?(::Io::Flow::V0::Models::ShippingAddress) ? x : ::Io::Flow::V0::Models::ShippingAddress.new(x)) @flow_tracking_number = HttpClient::Preconditions.assert_class('flow_tracking_number', opts.delete(:flow_tracking_number), String) @origin = (x = opts.delete(:origin); x.is_a?(::Io::Flow::V0::Models::ShippingAddress) ? x : ::Io::Flow::V0::Models::ShippingAddress.new(x)) @package = (x = opts.delete(:package); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ShippingLabelPackage) ? x : ::Io::Flow::V0::Models::ShippingLabelPackage.new(x))) @service = (x = opts.delete(:service); x.is_a?(::Io::Flow::V0::Models::ServiceDescription) ? x : ::Io::Flow::V0::Models::ServiceDescription.from_json(x)) @window = (x = opts.delete(:window); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::DatetimeRange) ? x : ::Io::Flow::V0::Models::DatetimeRange.new(x))) @order = (x = opts.delete(:order); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::LabelOrderSummary) ? x : ::Io::Flow::V0::Models::LabelOrderSummary.new(x))) @order_identifier = (x = opts.delete(:order_identifier); x.nil? ? nil : HttpClient::Preconditions.assert_class('order_identifier', x, String)) @fulfillment_key = (x = opts.delete(:fulfillment_key); x.nil? ? nil : HttpClient::Preconditions.assert_class('fulfillment_key', x, String)) @shipment_recipient = (x = opts.delete(:shipment_recipient); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ShipmentRecipient) ? x : ::Io::Flow::V0::Models::ShipmentRecipient.apply(x))) @updated_at = (x = opts.delete(:updated_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('updated_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime)) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
66964 66965 66966 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66964 def attributes @attributes end |
#carrier_tracking_number ⇒ Object (readonly)
Returns the value of attribute carrier_tracking_number.
66964 66965 66966 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66964 def carrier_tracking_number @carrier_tracking_number end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
66964 66965 66966 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66964 def destination @destination end |
#flow_tracking_number ⇒ Object (readonly)
Returns the value of attribute flow_tracking_number.
66964 66965 66966 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66964 def flow_tracking_number @flow_tracking_number end |
#fulfillment_key ⇒ Object (readonly)
Returns the value of attribute fulfillment_key.
66964 66965 66966 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66964 def fulfillment_key @fulfillment_key end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
66964 66965 66966 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66964 def id @id end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
66964 66965 66966 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66964 def key @key end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
66964 66965 66966 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66964 def order @order end |
#order_identifier ⇒ Object (readonly)
Returns the value of attribute order_identifier.
66964 66965 66966 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66964 def order_identifier @order_identifier end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
66964 66965 66966 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66964 def origin @origin end |
#package ⇒ Object (readonly)
Returns the value of attribute package.
66964 66965 66966 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66964 def package @package end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
66964 66965 66966 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66964 def service @service end |
#shipment_recipient ⇒ Object (readonly)
Returns the value of attribute shipment_recipient.
66964 66965 66966 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66964 def shipment_recipient @shipment_recipient end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
66964 66965 66966 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66964 def updated_at @updated_at end |
#window ⇒ Object (readonly)
Returns the value of attribute window.
66964 66965 66966 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66964 def window @window end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
66990 66991 66992 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66990 def copy(incoming={}) ShippingNotification.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
66994 66995 66996 66997 66998 66999 67000 67001 67002 67003 67004 67005 67006 67007 67008 67009 67010 67011 67012 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66994 def to_hash { :id => id, :key => key, :attributes => attributes, :carrier_tracking_number => carrier_tracking_number, :destination => destination.to_hash, :flow_tracking_number => flow_tracking_number, :origin => origin.to_hash, :package => package.nil? ? nil : package.to_hash, :service => service.to_hash, :window => window.nil? ? nil : window.to_hash, :order => order.nil? ? nil : order.to_hash, :order_identifier => order_identifier, :fulfillment_key => fulfillment_key, :shipment_recipient => shipment_recipient.nil? ? nil : shipment_recipient.value, :updated_at => updated_at } end |
#to_json ⇒ Object
66986 66987 66988 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66986 def to_json JSON.dump(to_hash) end |