Class: Io::Flow::V0::Models::ShopifyOrderMetafieldValue
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ShopifyOrderMetafieldValue
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Model to represent details available in an order metafield.
Instance Attribute Summary collapse
-
#flow_order_id ⇒ Object
readonly
Returns the value of attribute flow_order_id.
-
#incoterm ⇒ Object
readonly
Returns the value of attribute incoterm.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#merchant_of_record ⇒ Object
readonly
Returns the value of attribute merchant_of_record.
-
#merchant_of_record_entity ⇒ Object
readonly
Returns the value of attribute merchant_of_record_entity.
-
#prices ⇒ Object
readonly
Returns the value of attribute prices.
-
#tax_registration ⇒ Object
readonly
Returns the value of attribute tax_registration.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ShopifyOrderMetafieldValue
constructor
A new instance of ShopifyOrderMetafieldValue.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ShopifyOrderMetafieldValue
Returns a new instance of ShopifyOrderMetafieldValue.
38785 38786 38787 38788 38789 38790 38791 38792 38793 38794 38795 38796 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38785 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:items, :prices, :total], 'ShopifyOrderMetafieldValue') @merchant_of_record = (x = (x = opts.delete(:merchant_of_record); x.nil? ? "flow" : x); x.is_a?(::Io::Flow::V0::Models::OrderMerchantOfRecord) ? x : ::Io::Flow::V0::Models::OrderMerchantOfRecord.apply(x)) @merchant_of_record_entity = (x = opts.delete(:merchant_of_record_entity); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::MerchantOfRecordEntity) ? x : ::Io::Flow::V0::Models::MerchantOfRecordEntity.new(x))) @items = HttpClient::Preconditions.assert_class('items', opts.delete(:items), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::LocalizedLineItem) ? x : ::Io::Flow::V0::Models::LocalizedLineItem.new(x)) } @prices = HttpClient::Preconditions.assert_class('prices', opts.delete(:prices), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::OrderPriceDetail) ? x : ::Io::Flow::V0::Models::OrderPriceDetail.new(x)) } @total = (x = opts.delete(:total); x.is_a?(::Io::Flow::V0::Models::LocalizedTotal) ? x : ::Io::Flow::V0::Models::LocalizedTotal.new(x)) @flow_order_id = (x = opts.delete(:flow_order_id); x.nil? ? nil : HttpClient::Preconditions.assert_class('flow_order_id', x, String)) @incoterm = (x = opts.delete(:incoterm); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Incoterm) ? x : ::Io::Flow::V0::Models::Incoterm.apply(x))) @tax_registration = (x = opts.delete(:tax_registration); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::TaxRegistration) ? x : ::Io::Flow::V0::Models::TaxRegistration.new(x))) end |
Instance Attribute Details
#flow_order_id ⇒ Object (readonly)
Returns the value of attribute flow_order_id.
38783 38784 38785 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38783 def flow_order_id @flow_order_id end |
#incoterm ⇒ Object (readonly)
Returns the value of attribute incoterm.
38783 38784 38785 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38783 def incoterm @incoterm end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
38783 38784 38785 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38783 def items @items end |
#merchant_of_record ⇒ Object (readonly)
Returns the value of attribute merchant_of_record.
38783 38784 38785 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38783 def merchant_of_record @merchant_of_record end |
#merchant_of_record_entity ⇒ Object (readonly)
Returns the value of attribute merchant_of_record_entity.
38783 38784 38785 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38783 def merchant_of_record_entity @merchant_of_record_entity end |
#prices ⇒ Object (readonly)
Returns the value of attribute prices.
38783 38784 38785 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38783 def prices @prices end |
#tax_registration ⇒ Object (readonly)
Returns the value of attribute tax_registration.
38783 38784 38785 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38783 def tax_registration @tax_registration end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
38783 38784 38785 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38783 def total @total end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
38802 38803 38804 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38802 def copy(incoming={}) ShopifyOrderMetafieldValue.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
38806 38807 38808 38809 38810 38811 38812 38813 38814 38815 38816 38817 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38806 def to_hash { :merchant_of_record => merchant_of_record.value, :merchant_of_record_entity => merchant_of_record_entity.nil? ? nil : merchant_of_record_entity.to_hash, :items => items.map { |o| o.to_hash }, :prices => prices.map { |o| o.to_hash }, :total => total.to_hash, :flow_order_id => flow_order_id, :incoterm => incoterm.nil? ? nil : incoterm.value, :tax_registration => tax_registration.nil? ? nil : tax_registration.to_hash } end |
#to_json ⇒ Object
38798 38799 38800 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38798 def to_json JSON.dump(to_hash) end |