Class: Io::Flow::V0::Models::DeliveryForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::DeliveryForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents a collection of items, the available delivery option tier for that collection of items, and metadata about those options
Instance Attribute Summary collapse
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#quote ⇒ Object
readonly
Returns the value of attribute quote.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ DeliveryForm
constructor
A new instance of DeliveryForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ DeliveryForm
Returns a new instance of DeliveryForm.
11499 11500 11501 11502 11503 11504 11505 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11499 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:quote, :items, :destination], 'DeliveryForm') @quote = HttpClient::Preconditions.assert_class('quote', opts.delete(:quote), String) @items = HttpClient::Preconditions.assert_class('items', opts.delete(:items), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::LineItemForm) ? x : ::Io::Flow::V0::Models::LineItemForm.new(x)) } @destination = (x = opts.delete(:destination); x.is_a?(::Io::Flow::V0::Models::ShippingAddress) ? x : ::Io::Flow::V0::Models::ShippingAddress.new(x)) end |
Instance Attribute Details
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
11497 11498 11499 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11497 def destination @destination end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
11497 11498 11499 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11497 def items @items end |
#quote ⇒ Object (readonly)
Returns the value of attribute quote.
11497 11498 11499 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11497 def quote @quote end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
11511 11512 11513 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11511 def copy(incoming={}) DeliveryForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
11515 11516 11517 11518 11519 11520 11521 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11515 def to_hash { :quote => quote, :items => items.map { |o| o.to_hash }, :destination => destination.to_hash } end |
#to_json ⇒ Object
11507 11508 11509 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11507 def to_json JSON.dump(to_hash) end |