Class: Io::Flow::V0::Models::ShippingLabel
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ShippingLabel
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents information about a carrier-generated shipping label used by a shipper to transport a package from a given origin to destination
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.
-
#commercial_invoice ⇒ Object
readonly
Returns the value of attribute commercial_invoice.
-
#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.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
-
#pdf ⇒ Object
readonly
Returns the value of attribute pdf.
-
#png ⇒ Object
readonly
Returns the value of attribute png.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
-
#window ⇒ Object
readonly
Returns the value of attribute window.
-
#zpl ⇒ Object
readonly
Returns the value of attribute zpl.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ShippingLabel
constructor
A new instance of ShippingLabel.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ShippingLabel
Returns a new instance of ShippingLabel.
15636 15637 15638 15639 15640 15641 15642 15643 15644 15645 15646 15647 15648 15649 15650 15651 15652 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15636 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :carrier_tracking_number, :zpl, :destination, :flow_tracking_number, :origin, :service, :window], 'ShippingLabel') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), 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) @zpl = HttpClient::Preconditions.assert_class('zpl', opts.delete(:zpl), 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)) @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)) @commercial_invoice = (x = opts.delete(:commercial_invoice); x.nil? ? nil : HttpClient::Preconditions.assert_class('commercial_invoice', x, String)) @pdf = (x = opts.delete(:pdf); x.nil? ? nil : HttpClient::Preconditions.assert_class('pdf', x, String)) @png = (x = opts.delete(:png); x.nil? ? nil : HttpClient::Preconditions.assert_class('png', x, String)) @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.
15634 15635 15636 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15634 def attributes @attributes end |
#carrier_tracking_number ⇒ Object (readonly)
Returns the value of attribute carrier_tracking_number.
15634 15635 15636 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15634 def carrier_tracking_number @carrier_tracking_number end |
#commercial_invoice ⇒ Object (readonly)
Returns the value of attribute commercial_invoice.
15634 15635 15636 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15634 def commercial_invoice @commercial_invoice end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
15634 15635 15636 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15634 def destination @destination end |
#flow_tracking_number ⇒ Object (readonly)
Returns the value of attribute flow_tracking_number.
15634 15635 15636 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15634 def flow_tracking_number @flow_tracking_number end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
15634 15635 15636 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15634 def id @id end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
15634 15635 15636 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15634 def order @order end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
15634 15635 15636 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15634 def origin @origin end |
#pdf ⇒ Object (readonly)
Returns the value of attribute pdf.
15634 15635 15636 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15634 def pdf @pdf end |
#png ⇒ Object (readonly)
Returns the value of attribute png.
15634 15635 15636 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15634 def png @png end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
15634 15635 15636 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15634 def service @service end |
#window ⇒ Object (readonly)
Returns the value of attribute window.
15634 15635 15636 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15634 def window @window end |
#zpl ⇒ Object (readonly)
Returns the value of attribute zpl.
15634 15635 15636 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15634 def zpl @zpl end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
15658 15659 15660 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15658 def copy(incoming={}) ShippingLabel.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
15662 15663 15664 15665 15666 15667 15668 15669 15670 15671 15672 15673 15674 15675 15676 15677 15678 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15662 def to_hash { :id => id, :attributes => attributes, :carrier_tracking_number => carrier_tracking_number, :zpl => zpl, :destination => destination.to_hash, :flow_tracking_number => flow_tracking_number, :origin => origin.to_hash, :service => service.to_hash, :window => window.to_hash, :commercial_invoice => commercial_invoice, :pdf => pdf, :png => png, :order => order.nil? ? nil : order.to_hash } end |
#to_json ⇒ Object
15654 15655 15656 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15654 def to_json JSON.dump(to_hash) end |