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 transfered 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.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
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.
19281 19282 19283 19284 19285 19286 19287 19288 19289 19290 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19281 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :type, :service, :timestamp, :shipping_labels], 'Manifest') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @type = (x = opts.delete(:type); x.is_a?(::Io::Flow::V0::Models::ManifestType) ? x : ::Io::Flow::V0::Models::ManifestType.apply(x)) @service = (x = opts.delete(:service); x.is_a?(::Io::Flow::V0::Models::ServiceSummary) ? x : ::Io::Flow::V0::Models::ServiceSummary.new(x)) @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)) end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
19279 19280 19281 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19279 def id @id end |
#pdf ⇒ Object (readonly)
Returns the value of attribute pdf.
19279 19280 19281 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19279 def pdf @pdf end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
19279 19280 19281 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19279 def service @service end |
#shipping_labels ⇒ Object (readonly)
Returns the value of attribute shipping_labels.
19279 19280 19281 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19279 def shipping_labels @shipping_labels end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
19279 19280 19281 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19279 def @timestamp end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
19279 19280 19281 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19279 def type @type end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
19296 19297 19298 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19296 def copy(incoming={}) Manifest.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
19300 19301 19302 19303 19304 19305 19306 19307 19308 19309 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19300 def to_hash { :id => id, :type => type.value, :service => service.to_hash, :timestamp => , :shipping_labels => shipping_labels.map { |o| o.to_hash }, :pdf => pdf } end |
#to_json ⇒ Object
19292 19293 19294 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19292 def to_json JSON.dump(to_hash) end |