Class: Io::Flow::V0::Models::KlaviyoLineItem
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::KlaviyoLineItem
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#line_price ⇒ Object
readonly
Returns the value of attribute line_price.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
-
#quantity ⇒ Object
readonly
Returns the value of attribute quantity.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ KlaviyoLineItem
constructor
A new instance of KlaviyoLineItem.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ KlaviyoLineItem
Returns a new instance of KlaviyoLineItem.
47822 47823 47824 47825 47826 47827 47828 47829 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47822 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:content, :quantity, :price, :line_price], 'KlaviyoLineItem') @content = (x = opts.delete(:content); x.is_a?(::Io::Flow::V0::Models::CheckoutItemContent) ? x : ::Io::Flow::V0::Models::CheckoutItemContent.new(x)) @quantity = HttpClient::Preconditions.assert_class('quantity', opts.delete(:quantity), Integer) @price = (x = opts.delete(:price); x.is_a?(::Io::Flow::V0::Models::PriceWithBase) ? x : ::Io::Flow::V0::Models::PriceWithBase.new(x)) @line_price = (x = opts.delete(:line_price); x.is_a?(::Io::Flow::V0::Models::PriceWithBase) ? x : ::Io::Flow::V0::Models::PriceWithBase.new(x)) end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
47820 47821 47822 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47820 def content @content end |
#line_price ⇒ Object (readonly)
Returns the value of attribute line_price.
47820 47821 47822 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47820 def line_price @line_price end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
47820 47821 47822 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47820 def price @price end |
#quantity ⇒ Object (readonly)
Returns the value of attribute quantity.
47820 47821 47822 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47820 def quantity @quantity end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
47835 47836 47837 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47835 def copy(incoming={}) KlaviyoLineItem.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
47839 47840 47841 47842 47843 47844 47845 47846 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47839 def to_hash { :content => content.to_hash, :quantity => quantity, :price => price.to_hash, :line_price => line_price.to_hash } end |
#to_json ⇒ Object
47831 47832 47833 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47831 def to_json JSON.dump(to_hash) end |