Class: Io::Flow::V0::Models::KlaviyoOrderContent
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::KlaviyoOrderContent
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#checkout_url ⇒ Object
readonly
Returns the value of attribute checkout_url.
-
#line_items ⇒ Object
readonly
Returns the value of attribute line_items.
-
#prices ⇒ Object
readonly
Returns the value of attribute prices.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ KlaviyoOrderContent
constructor
A new instance of KlaviyoOrderContent.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ KlaviyoOrderContent
Returns a new instance of KlaviyoOrderContent.
35741 35742 35743 35744 35745 35746 35747 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35741 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:line_items, :prices, :checkout_url], 'KlaviyoOrderContent') @line_items = HttpClient::Preconditions.assert_class('line_items', opts.delete(:line_items), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::KlaviyoLineItem) ? x : ::Io::Flow::V0::Models::KlaviyoLineItem.new(x)) } @prices = (x = opts.delete(:prices); x.is_a?(::Io::Flow::V0::Models::KlaviyoOrderPrices) ? x : ::Io::Flow::V0::Models::KlaviyoOrderPrices.new(x)) @checkout_url = HttpClient::Preconditions.assert_class('checkout_url', opts.delete(:checkout_url), String) end |
Instance Attribute Details
#checkout_url ⇒ Object (readonly)
Returns the value of attribute checkout_url.
35739 35740 35741 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35739 def checkout_url @checkout_url end |
#line_items ⇒ Object (readonly)
Returns the value of attribute line_items.
35739 35740 35741 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35739 def line_items @line_items end |
#prices ⇒ Object (readonly)
Returns the value of attribute prices.
35739 35740 35741 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35739 def prices @prices end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
35753 35754 35755 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35753 def copy(incoming={}) KlaviyoOrderContent.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
35757 35758 35759 35760 35761 35762 35763 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35757 def to_hash { :line_items => line_items.map { |o| o.to_hash }, :prices => prices.to_hash, :checkout_url => checkout_url } end |
#to_json ⇒ Object
35749 35750 35751 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35749 def to_json JSON.dump(to_hash) end |