Class: Io::Flow::V0::Models::ShopifyOrderDeliveryMetafield

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Model to represent a delivery metafield

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ShopifyOrderDeliveryMetafield

Returns a new instance of ShopifyOrderDeliveryMetafield.



37327
37328
37329
37330
37331
37332
37333
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37327

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))
end

Instance Attribute Details

#itemsObject (readonly)

Returns the value of attribute items.



37325
37326
37327
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37325

def items
  @items
end

#serviceObject (readonly)

Returns the value of attribute service.



37325
37326
37327
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37325

def service
  @service
end

#windowObject (readonly)

Returns the value of attribute window.



37325
37326
37327
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37325

def window
  @window
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



37339
37340
37341
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37339

def copy(incoming={})
  ShopifyOrderDeliveryMetafield.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



37343
37344
37345
37346
37347
37348
37349
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37343

def to_hash
  {
    :items => items.map { |o| o.to_hash },
    :service => service.to_hash,
    :window => window.to_hash
  }
end

#to_jsonObject



37335
37336
37337
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37335

def to_json
  JSON.dump(to_hash)
end