Class: Io::Flow::V0::Models::OrderWithDiscountsForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::OrderWithDiscountsForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#discounts ⇒ Object
readonly
Returns the value of attribute discounts.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ OrderWithDiscountsForm
constructor
A new instance of OrderWithDiscountsForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ OrderWithDiscountsForm
Returns a new instance of OrderWithDiscountsForm.
42466 42467 42468 42469 42470 42471 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42466 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:order], 'OrderWithDiscountsForm') @order = (x = opts.delete(:order); x.is_a?(::Io::Flow::V0::Models::OrderForm) ? x : ::Io::Flow::V0::Models::OrderForm.new(x)) @discounts = HttpClient::Preconditions.assert_class('discounts', (x = opts.delete(:discounts); x.nil? ? [] : x), Array).map { |v| HttpClient::Preconditions.assert_class('discounts', v, String) } end |
Instance Attribute Details
#discounts ⇒ Object (readonly)
Returns the value of attribute discounts.
42464 42465 42466 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42464 def discounts @discounts end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
42464 42465 42466 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42464 def order @order end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
42477 42478 42479 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42477 def copy(incoming={}) OrderWithDiscountsForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
42481 42482 42483 42484 42485 42486 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42481 def to_hash { :order => order.to_hash, :discounts => discounts } end |
#to_json ⇒ Object
42473 42474 42475 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42473 def to_json JSON.dump(to_hash) end |