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.



50829
50830
50831
50832
50833
50834
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50829

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::ItemAvailabilityStatus) ? x : ::Io::Flow::V0::Models::ItemAvailabilityStatus.apply(x))
end

Instance Attribute Details

#experienceObject (readonly)

Returns the value of attribute experience.



50827
50828
50829
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50827

def experience
  @experience
end

#statusObject (readonly)

Returns the value of attribute status.



50827
50828
50829
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50827

def status
  @status
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



50840
50841
50842
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50840

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

#to_hashObject



50844
50845
50846
50847
50848
50849
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50844

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

#to_jsonObject



50836
50837
50838
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50836

def to_json
  JSON.dump(to_hash)
end