class Io::Flow::V0::Models::ShopifyLine
Attributes
price[R]
price_source[R]
quantity[R]
total[R]
variant_id[R]
Public Class Methods
new(incoming={})
click to toggle source
# 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
Public Instance Methods
copy(incoming={})
click to toggle source
# 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()
click to toggle source
# 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()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 67462 def to_json JSON.dump(to_hash) end