Class: Io::Flow::V0::Models::ShopifyVariantInventoryMetafield

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

Overview

For enabled organizations, this indicates the total number of available units of inventory for customers in this experience.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ShopifyVariantInventoryMetafield

Returns a new instance of ShopifyVariantInventoryMetafield.



40407
40408
40409
40410
40411
40412
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40407

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:experience, :status], 'ShopifyVariantInventoryMetafield')
  @experience = (x = opts.delete(:experience); x.is_a?(::Io::Flow::V0::Models::ExperienceReference) ? x : ::Io::Flow::V0::Models::ExperienceReference.new(x))
  @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::ExperienceInventoryItemStatus) ? x : ::Io::Flow::V0::Models::ExperienceInventoryItemStatus.apply(x))
end

Instance Attribute Details

#experienceObject (readonly)

Returns the value of attribute experience.



40405
40406
40407
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40405

def experience
  @experience
end

#statusObject (readonly)

Returns the value of attribute status.



40405
40406
40407
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40405

def status
  @status
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



40418
40419
40420
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40418

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

#to_hashObject



40422
40423
40424
40425
40426
40427
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40422

def to_hash
  {
    :experience => experience.to_hash,
    :status => status.value
  }
end

#to_jsonObject



40414
40415
40416
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40414

def to_json
  JSON.dump(to_hash)
end