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.
-
#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.
-
#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.
-
#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.
24432 24433 24434 24435 24436 24437 24438 24439 24440 24441 24442 24443 24444 24445 24446 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24432 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :key, :carrier_tracking_number, :destination, :flow_tracking_number, :origin, :package, :service, :window], '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.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::ServiceSummary) ? x : ::Io::Flow::V0::Models::ServiceSummary.new(x)) @window = (x = opts.delete(:window); 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))) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
24430 24431 24432 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24430 def attributes @attributes end |
#carrier_tracking_number ⇒ Object (readonly)
Returns the value of attribute carrier_tracking_number.
24430 24431 24432 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24430 def carrier_tracking_number @carrier_tracking_number end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
24430 24431 24432 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24430 def destination @destination end |
#flow_tracking_number ⇒ Object (readonly)
Returns the value of attribute flow_tracking_number.
24430 24431 24432 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24430 def flow_tracking_number @flow_tracking_number end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
24430 24431 24432 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24430 def id @id end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
24430 24431 24432 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24430 def key @key end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
24430 24431 24432 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24430 def order @order end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
24430 24431 24432 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24430 def origin @origin end |
#package ⇒ Object (readonly)
Returns the value of attribute package.
24430 24431 24432 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24430 def package @package end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
24430 24431 24432 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24430 def service @service end |
#window ⇒ Object (readonly)
Returns the value of attribute window.
24430 24431 24432 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24430 def window @window end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
24452 24453 24454 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24452 def copy(incoming={}) ShippingNotification.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
24456 24457 24458 24459 24460 24461 24462 24463 24464 24465 24466 24467 24468 24469 24470 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24456 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.to_hash, :service => service.to_hash, :window => window.to_hash, :order => order.nil? ? nil : order.to_hash } end |
#to_json ⇒ Object
24448 24449 24450 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24448 def to_json JSON.dump(to_hash) end |