Class: Io::Flow::V0::Models::ShopifyLine
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ShopifyLine
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#price ⇒ Object
readonly
Returns the value of attribute price.
-
#price_source ⇒ Object
readonly
Returns the value of attribute price_source.
-
#quantity ⇒ Object
readonly
Returns the value of attribute quantity.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
-
#variant_id ⇒ Object
readonly
Returns the value of attribute variant_id.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ShopifyLine
constructor
A new instance of ShopifyLine.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ShopifyLine
Returns a new instance of ShopifyLine.
67452 67453 67454 67455 67456 67457 67458 67459 67460 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 67452 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:variant_id, :quantity, :price, :total], 'ShopifyLine') @variant_id = HttpClient::Preconditions.assert_class('variant_id', opts.delete(:variant_id), Integer) @quantity = HttpClient::Preconditions.assert_class('quantity', opts.delete(:quantity), Integer) @price = (x = opts.delete(:price); x.is_a?(::Io::Flow::V0::Models::ShopifyPrice) ? x : ::Io::Flow::V0::Models::ShopifyPrice.new(x)) @total = (x = opts.delete(:total); x.is_a?(::Io::Flow::V0::Models::ShopifyPrice) ? x : ::Io::Flow::V0::Models::ShopifyPrice.new(x)) @price_source = (x = opts.delete(:price_source); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::PriceSource) ? x : ::Io::Flow::V0::Models::PriceSource.from_json(x))) end |
Instance Attribute Details
#price ⇒ Object (readonly)
Returns the value of attribute price.
67450 67451 67452 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 67450 def price @price end |
#price_source ⇒ Object (readonly)
Returns the value of attribute price_source.
67450 67451 67452 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 67450 def price_source @price_source end |
#quantity ⇒ Object (readonly)
Returns the value of attribute quantity.
67450 67451 67452 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 67450 def quantity @quantity end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
67450 67451 67452 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 67450 def total @total end |
#variant_id ⇒ Object (readonly)
Returns the value of attribute variant_id.
67450 67451 67452 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 67450 def variant_id @variant_id end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
67466 67467 67468 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 67466 def copy(incoming={}) ShopifyLine.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
67470 67471 67472 67473 67474 67475 67476 67477 67478 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 67470 def to_hash { :variant_id => variant_id, :quantity => quantity, :price => price.to_hash, :total => total.to_hash, :price_source => price_source.nil? ? nil : price_source.to_hash } end |
#to_json ⇒ Object
67462 67463 67464 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 67462 def to_json JSON.dump(to_hash) end |