Class: Io::Flow::V0::Models::Manifest
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::Manifest
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents closeout of a group of labels that have been transferred to the carrier for shipping
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#pdf ⇒ Object
readonly
Returns the value of attribute pdf.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
-
#shipping_labels ⇒ Object
readonly
Returns the value of attribute shipping_labels.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ Manifest
constructor
A new instance of Manifest.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ Manifest
Returns a new instance of Manifest.
38917 38918 38919 38920 38921 38922 38923 38924 38925 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38917 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :timestamp, :shipping_labels], 'Manifest') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @timestamp = HttpClient::Preconditions.assert_class('timestamp', HttpClient::Helper.to_date_time_iso8601(opts.delete(:timestamp)), DateTime) @shipping_labels = HttpClient::Preconditions.assert_class('shipping_labels', opts.delete(:shipping_labels), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ShippingLabelSummary) ? x : ::Io::Flow::V0::Models::ShippingLabelSummary.new(x)) } @pdf = (x = opts.delete(:pdf); x.nil? ? nil : HttpClient::Preconditions.assert_class('pdf', x, String)) @service = (x = opts.delete(:service); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ServiceSummary) ? x : ::Io::Flow::V0::Models::ServiceSummary.new(x))) end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
38915 38916 38917 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38915 def id @id end |
#pdf ⇒ Object (readonly)
Returns the value of attribute pdf.
38915 38916 38917 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38915 def pdf @pdf end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
38915 38916 38917 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38915 def service @service end |
#shipping_labels ⇒ Object (readonly)
Returns the value of attribute shipping_labels.
38915 38916 38917 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38915 def shipping_labels @shipping_labels end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
38915 38916 38917 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38915 def @timestamp end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
38931 38932 38933 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38931 def copy(incoming={}) Manifest.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
38935 38936 38937 38938 38939 38940 38941 38942 38943 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38935 def to_hash { :id => id, :timestamp => , :shipping_labels => shipping_labels.map { |o| o.to_hash }, :pdf => pdf, :service => service.nil? ? nil : service.to_hash } end |
#to_json ⇒ Object
38927 38928 38929 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38927 def to_json JSON.dump(to_hash) end |