Class: Io::Flow::V0::Models::ShippingNotificationForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ShippingNotificationForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Form for 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.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#order_number ⇒ Object
readonly
Returns the value of attribute order_number.
-
#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.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ShippingNotificationForm
constructor
A new instance of ShippingNotificationForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ShippingNotificationForm
Returns a new instance of ShippingNotificationForm.
26650 26651 26652 26653 26654 26655 26656 26657 26658 26659 26660 26661 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26650 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:carrier_tracking_number, :destination, :order_number, :package, :service], 'ShippingNotificationForm') @key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, String)) @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', 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)) @order_number = HttpClient::Preconditions.assert_class('order_number', opts.delete(:order_number), String) @package = (x = opts.delete(:package); x.is_a?(::Io::Flow::V0::Models::ShippingLabelPackage) ? x : ::Io::Flow::V0::Models::ShippingLabelPackage.new(x)) @service = HttpClient::Preconditions.assert_class('service', opts.delete(:service), String) @origin = (x = opts.delete(:origin); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ShippingAddress) ? x : ::Io::Flow::V0::Models::ShippingAddress.new(x))) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
26648 26649 26650 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26648 def attributes @attributes end |
#carrier_tracking_number ⇒ Object (readonly)
Returns the value of attribute carrier_tracking_number.
26648 26649 26650 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26648 def carrier_tracking_number @carrier_tracking_number end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
26648 26649 26650 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26648 def destination @destination end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
26648 26649 26650 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26648 def key @key end |
#order_number ⇒ Object (readonly)
Returns the value of attribute order_number.
26648 26649 26650 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26648 def order_number @order_number end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
26648 26649 26650 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26648 def origin @origin end |
#package ⇒ Object (readonly)
Returns the value of attribute package.
26648 26649 26650 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26648 def package @package end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
26648 26649 26650 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26648 def service @service end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
26667 26668 26669 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26667 def copy(incoming={}) ShippingNotificationForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
26671 26672 26673 26674 26675 26676 26677 26678 26679 26680 26681 26682 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26671 def to_hash { :key => key, :attributes => attributes.nil? ? nil : attributes, :carrier_tracking_number => carrier_tracking_number, :destination => destination.to_hash, :order_number => order_number, :package => package.to_hash, :service => service, :origin => origin.nil? ? nil : origin.to_hash } end |
#to_json ⇒ Object
26663 26664 26665 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26663 def to_json JSON.dump(to_hash) end |