Class: Io::Flow::V0::Models::QuoteForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::QuoteForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#experience ⇒ Object
readonly
Returns the value of attribute experience.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ QuoteForm
constructor
A new instance of QuoteForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ QuoteForm
Returns a new instance of QuoteForm.
14940 14941 14942 14943 14944 14945 14946 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14940 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:destination, :experience, :items], 'QuoteForm') @destination = (x = opts.delete(:destination); x.is_a?(::Io::Flow::V0::Models::ShippingAddress) ? x : ::Io::Flow::V0::Models::ShippingAddress.new(x)) @experience = HttpClient::Preconditions.assert_class('experience', opts.delete(:experience), 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)) } end |
Instance Attribute Details
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
14938 14939 14940 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14938 def destination @destination end |
#experience ⇒ Object (readonly)
Returns the value of attribute experience.
14938 14939 14940 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14938 def experience @experience end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
14938 14939 14940 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14938 def items @items end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
14952 14953 14954 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14952 def copy(incoming={}) QuoteForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
14956 14957 14958 14959 14960 14961 14962 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14956 def to_hash { :destination => destination.to_hash, :experience => experience, :items => items.map { |o| o.to_hash } } end |
#to_json ⇒ Object
14948 14949 14950 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14948 def to_json JSON.dump(to_hash) end |