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.



35727
35728
35729
35730
35731
35732
35733
35734
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35727

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:item_number, :quantity, :service, :window], 'ShopifyOrderDeliveryMetafield')
  @item_number = HttpClient::Preconditions.assert_class('item_number', opts.delete(:item_number), String)
  @quantity = HttpClient::Preconditions.assert_class('quantity', opts.delete(:quantity), Integer)
  @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

#item_numberObject (readonly)

Returns the value of attribute item_number.



35725
35726
35727
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35725

def item_number
  @item_number
end

#quantityObject (readonly)

Returns the value of attribute quantity.



35725
35726
35727
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35725

def quantity
  @quantity
end

#serviceObject (readonly)

Returns the value of attribute service.



35725
35726
35727
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35725

def service
  @service
end

#windowObject (readonly)

Returns the value of attribute window.



35725
35726
35727
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35725

def window
  @window
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



35740
35741
35742
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35740

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

#to_hashObject



35744
35745
35746
35747
35748
35749
35750
35751
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35744

def to_hash
  {
    :item_number => item_number,
    :quantity => quantity,
    :service => service.to_hash,
    :window => window.to_hash
  }
end

#to_jsonObject



35736
35737
35738
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35736

def to_json
  JSON.dump(to_hash)
end