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.
-
#carrier_tracking_number_url ⇒ Object
readonly
Returns the value of attribute carrier_tracking_number_url.
-
#cost ⇒ Object
readonly
Returns the value of attribute cost.
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#direction ⇒ Object
readonly
Returns the value of attribute direction.
-
#flow_tracking_number ⇒ Object
readonly
Returns the value of attribute flow_tracking_number.
-
#flow_tracking_number_url ⇒ Object
readonly
Returns the value of attribute flow_tracking_number_url.
-
#fulfillment_key ⇒ Object
readonly
Returns the value of attribute fulfillment_key.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#invoice ⇒ Object
readonly
Returns the value of attribute invoice.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#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.
-
#return_ ⇒ Object
readonly
Returns the value of attribute return_.
-
#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 = {}) ⇒ ShippingLabel
constructor
A new instance of ShippingLabel.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ShippingLabel
Returns a new instance of ShippingLabel.
29880 29881 29882 29883 29884 29885 29886 29887 29888 29889 29890 29891 29892 29893 29894 29895 29896 29897 29898 29899 29900 29901 29902 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29880 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :direction, :carrier_tracking_number, :carrier_tracking_number_url, :cost, :destination, :flow_tracking_number, :flow_tracking_number_url, :origin, :service, :window], 'ShippingLabel') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @direction = (x = opts.delete(:direction); x.is_a?(::Io::Flow::V0::Models::Direction) ? x : ::Io::Flow::V0::Models::Direction.apply(x)) @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) @carrier_tracking_number_url = HttpClient::Preconditions.assert_class('carrier_tracking_number_url', opts.delete(:carrier_tracking_number_url), String) @cost = (x = opts.delete(:cost); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x)) @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) @flow_tracking_number_url = HttpClient::Preconditions.assert_class('flow_tracking_number_url', opts.delete(:flow_tracking_number_url), 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)) @label = (x = opts.delete(:label); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ShippingLabelDocument) ? x : ::Io::Flow::V0::Models::ShippingLabelDocument.new(x))) @invoice = (x = opts.delete(:invoice); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ShippingLabelDocument) ? x : ::Io::Flow::V0::Models::ShippingLabelDocument.new(x))) @return_ = (x = opts.delete(:return); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ShippingLabelDocument) ? x : ::Io::Flow::V0::Models::ShippingLabelDocument.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))) @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))) @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)) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
29878 29879 29880 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29878 def attributes @attributes end |
#carrier_tracking_number ⇒ Object (readonly)
Returns the value of attribute carrier_tracking_number.
29878 29879 29880 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29878 def carrier_tracking_number @carrier_tracking_number end |
#carrier_tracking_number_url ⇒ Object (readonly)
Returns the value of attribute carrier_tracking_number_url.
29878 29879 29880 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29878 def carrier_tracking_number_url @carrier_tracking_number_url end |
#cost ⇒ Object (readonly)
Returns the value of attribute cost.
29878 29879 29880 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29878 def cost @cost end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
29878 29879 29880 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29878 def destination @destination end |
#direction ⇒ Object (readonly)
Returns the value of attribute direction.
29878 29879 29880 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29878 def direction @direction end |
#flow_tracking_number ⇒ Object (readonly)
Returns the value of attribute flow_tracking_number.
29878 29879 29880 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29878 def flow_tracking_number @flow_tracking_number end |
#flow_tracking_number_url ⇒ Object (readonly)
Returns the value of attribute flow_tracking_number_url.
29878 29879 29880 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29878 def flow_tracking_number_url @flow_tracking_number_url end |
#fulfillment_key ⇒ Object (readonly)
Returns the value of attribute fulfillment_key.
29878 29879 29880 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29878 def fulfillment_key @fulfillment_key end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
29878 29879 29880 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29878 def id @id end |
#invoice ⇒ Object (readonly)
Returns the value of attribute invoice.
29878 29879 29880 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29878 def invoice @invoice end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
29878 29879 29880 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29878 def label @label end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
29878 29879 29880 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29878 def order @order end |
#order_identifier ⇒ Object (readonly)
Returns the value of attribute order_identifier.
29878 29879 29880 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29878 def order_identifier @order_identifier end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
29878 29879 29880 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29878 def origin @origin end |
#package ⇒ Object (readonly)
Returns the value of attribute package.
29878 29879 29880 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29878 def package @package end |
#return_ ⇒ Object (readonly)
Returns the value of attribute return_.
29878 29879 29880 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29878 def return_ @return_ end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
29878 29879 29880 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29878 def service @service end |
#window ⇒ Object (readonly)
Returns the value of attribute window.
29878 29879 29880 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29878 def window @window end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
29908 29909 29910 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29908 def copy(incoming={}) ShippingLabel.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
29912 29913 29914 29915 29916 29917 29918 29919 29920 29921 29922 29923 29924 29925 29926 29927 29928 29929 29930 29931 29932 29933 29934 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29912 def to_hash { :id => id, :direction => direction.value, :attributes => attributes, :carrier_tracking_number => carrier_tracking_number, :carrier_tracking_number_url => carrier_tracking_number_url, :cost => cost.to_hash, :destination => destination.to_hash, :flow_tracking_number => flow_tracking_number, :flow_tracking_number_url => flow_tracking_number_url, :origin => origin.to_hash, :service => service.to_hash, :window => window.to_hash, :label => label.nil? ? nil : label.to_hash, :invoice => invoice.nil? ? nil : invoice.to_hash, :return => return_.nil? ? nil : return_.to_hash, :order => order.nil? ? nil : order.to_hash, :package => package.nil? ? nil : package.to_hash, :order_identifier => order_identifier, :fulfillment_key => fulfillment_key } end |
#to_json ⇒ Object
29904 29905 29906 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29904 def to_json JSON.dump(to_hash) end |