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.
-
#commercial_invoice ⇒ Object
readonly
Returns the value of attribute commercial_invoice.
-
#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.
-
#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.
26407 26408 26409 26410 26411 26412 26413 26414 26415 26416 26417 26418 26419 26420 26421 26422 26423 26424 26425 26426 26427 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26407 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)) @commercial_invoice = (x = opts.delete(:commercial_invoice); x.nil? ? nil : HttpClient::Preconditions.assert_class('commercial_invoice', x, String)) @zpl = (x = opts.delete(:zpl); x.nil? ? nil : HttpClient::Preconditions.assert_class('zpl', 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.
26405 26406 26407 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26405 def attributes @attributes end |
#carrier_tracking_number ⇒ Object (readonly)
Returns the value of attribute carrier_tracking_number.
26405 26406 26407 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26405 def carrier_tracking_number @carrier_tracking_number end |
#carrier_tracking_number_url ⇒ Object (readonly)
Returns the value of attribute carrier_tracking_number_url.
26405 26406 26407 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26405 def carrier_tracking_number_url @carrier_tracking_number_url end |
#commercial_invoice ⇒ Object (readonly)
Returns the value of attribute commercial_invoice.
26405 26406 26407 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26405 def commercial_invoice @commercial_invoice end |
#cost ⇒ Object (readonly)
Returns the value of attribute cost.
26405 26406 26407 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26405 def cost @cost end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
26405 26406 26407 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26405 def destination @destination end |
#direction ⇒ Object (readonly)
Returns the value of attribute direction.
26405 26406 26407 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26405 def direction @direction end |
#flow_tracking_number ⇒ Object (readonly)
Returns the value of attribute flow_tracking_number.
26405 26406 26407 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26405 def flow_tracking_number @flow_tracking_number end |
#flow_tracking_number_url ⇒ Object (readonly)
Returns the value of attribute flow_tracking_number_url.
26405 26406 26407 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26405 def flow_tracking_number_url @flow_tracking_number_url end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
26405 26406 26407 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26405 def id @id end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
26405 26406 26407 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26405 def order @order end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
26405 26406 26407 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26405 def origin @origin end |
#pdf ⇒ Object (readonly)
Returns the value of attribute pdf.
26405 26406 26407 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26405 def pdf @pdf end |
#png ⇒ Object (readonly)
Returns the value of attribute png.
26405 26406 26407 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26405 def png @png end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
26405 26406 26407 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26405 def service @service end |
#window ⇒ Object (readonly)
Returns the value of attribute window.
26405 26406 26407 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26405 def window @window end |
#zpl ⇒ Object (readonly)
Returns the value of attribute zpl.
26405 26406 26407 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26405 def zpl @zpl end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
26433 26434 26435 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26433 def copy(incoming={}) ShippingLabel.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
26437 26438 26439 26440 26441 26442 26443 26444 26445 26446 26447 26448 26449 26450 26451 26452 26453 26454 26455 26456 26457 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26437 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, :commercial_invoice => commercial_invoice, :zpl => zpl, :pdf => pdf, :png => png, :order => order.nil? ? nil : order.to_hash } end |
#to_json ⇒ Object
26429 26430 26431 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26429 def to_json JSON.dump(to_hash) end |