Class: Io::Flow::V0::Models::ShopifyOrderDeliveryMetafield
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ShopifyOrderDeliveryMetafield
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Model to represent a delivery metafield
Instance Attribute Summary collapse
-
#cost ⇒ Object
readonly
Returns the value of attribute cost.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
-
#window ⇒ Object
readonly
Returns the value of attribute window.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ShopifyOrderDeliveryMetafield
constructor
A new instance of ShopifyOrderDeliveryMetafield.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ShopifyOrderDeliveryMetafield
Returns a new instance of ShopifyOrderDeliveryMetafield.
45977 45978 45979 45980 45981 45982 45983 45984 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45977 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:items, :service, :window], 'ShopifyOrderDeliveryMetafield') @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)) @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))) end |
Instance Attribute Details
#cost ⇒ Object (readonly)
Returns the value of attribute cost.
45975 45976 45977 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45975 def cost @cost end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
45975 45976 45977 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45975 def items @items end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
45975 45976 45977 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45975 def service @service end |
#window ⇒ Object (readonly)
Returns the value of attribute window.
45975 45976 45977 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45975 def window @window end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
45990 45991 45992 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45990 def copy(incoming={}) ShopifyOrderDeliveryMetafield.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
45994 45995 45996 45997 45998 45999 46000 46001 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45994 def to_hash { :items => items.map { |o| o.to_hash }, :service => service.to_hash, :window => window.to_hash, :cost => cost.nil? ? nil : cost.to_hash } end |
#to_json ⇒ Object
45986 45987 45988 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45986 def to_json JSON.dump(to_hash) end |