class Io::Flow::V0::Models::ShopifyOrderDeliveryMetafield
Model to represent a delivery metafield
Attributes
cost[R]
items[R]
key[R]
liability[R]
merchant_of_record_entity[R]
prices[R]
service[R]
total[R]
window[R]
Public Class Methods
new(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 68156 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:items, :service, :window], 'ShopifyOrderDeliveryMetafield') @key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, String)) @items = HttpClient::Preconditions.assert_class('items', opts.delete(:items), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ShopifyOrderDeliveryMetafieldItem) ? x : ::Io::Flow::V0::Models::ShopifyOrderDeliveryMetafieldItem.new(x)) } @service = (x = opts.delete(:service); x.is_a?(::Io::Flow::V0::Models::ServiceSummary) ? x : ::Io::Flow::V0::Models::ServiceSummary.new(x)) @window = (x = opts.delete(:window); x.is_a?(::Io::Flow::V0::Models::DeliveryWindow) ? x : ::Io::Flow::V0::Models::DeliveryWindow.new(x)) @liability = (x = opts.delete(:liability); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::RatecardOwner) ? x : ::Io::Flow::V0::Models::RatecardOwner.apply(x))) @cost = (x = opts.delete(:cost); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::MoneyWithOptionalBase) ? x : ::Io::Flow::V0::Models::MoneyWithOptionalBase.new(x))) @prices = (x = opts.delete(:prices); x.nil? ? nil : HttpClient::Preconditions.assert_class('prices', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ShopifyPrice) ? x : ::Io::Flow::V0::Models::ShopifyPrice.new(x)) }) @total = (x = opts.delete(:total); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ShopifyPrice) ? x : ::Io::Flow::V0::Models::ShopifyPrice.new(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))) end
Public Instance Methods
copy(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 68174 def copy(incoming={}) ShopifyOrderDeliveryMetafield.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 68178 def to_hash { :key => key, :items => items.map { |o| o.to_hash }, :service => service.to_hash, :window => window.to_hash, :liability => liability.nil? ? nil : liability.value, :cost => cost.nil? ? nil : cost.to_hash, :prices => prices.nil? ? nil : prices.map { |o| o.to_hash }, :total => total.nil? ? nil : total.to_hash, :merchant_of_record_entity => merchant_of_record_entity.nil? ? nil : merchant_of_record_entity.to_hash } end
to_json()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 68170 def to_json JSON.dump(to_hash) end