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.
35760 35761 35762 35763 35764 35765 35766 35767 35768 35769 35770 35771 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35760 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.
35758 35759 35760 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35758 def flow_order_id @flow_order_id end |
#incoterm ⇒ Object (readonly)
Returns the value of attribute incoterm.
35758 35759 35760 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35758 def incoterm @incoterm end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
35758 35759 35760 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35758 def items @items end |
#merchant_of_record ⇒ Object (readonly)
Returns the value of attribute merchant_of_record.
35758 35759 35760 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35758 def merchant_of_record @merchant_of_record end |
#merchant_of_record_entity ⇒ Object (readonly)
Returns the value of attribute merchant_of_record_entity.
35758 35759 35760 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35758 def merchant_of_record_entity @merchant_of_record_entity end |
#prices ⇒ Object (readonly)
Returns the value of attribute prices.
35758 35759 35760 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35758 def prices @prices end |
#tax_registration ⇒ Object (readonly)
Returns the value of attribute tax_registration.
35758 35759 35760 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35758 def tax_registration @tax_registration end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
35758 35759 35760 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35758 def total @total end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
35777 35778 35779 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35777 def copy(incoming={}) ShopifyOrderMetafieldValue.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
35781 35782 35783 35784 35785 35786 35787 35788 35789 35790 35791 35792 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35781 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
35773 35774 35775 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35773 def to_json JSON.dump(to_hash) end |