Class: Io::Flow::V0::Models::ShopifyLocalizedVariant

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ShopifyLocalizedVariant

Returns a new instance of ShopifyLocalizedVariant.



51844
51845
51846
51847
51848
51849
51850
51851
51852
51853
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51844

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :handle, :experience, :prices, :status], 'ShopifyLocalizedVariant')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), Integer)
  @handle = HttpClient::Preconditions.assert_class('handle', opts.delete(:handle), String)
  @experience = (x = opts.delete(:experience); x.is_a?(::Io::Flow::V0::Models::ExperienceReference) ? x : ::Io::Flow::V0::Models::ExperienceReference.new(x))
  @prices = (x = opts.delete(:prices); x.is_a?(::Io::Flow::V0::Models::ShopifyLocalizedVariantPrices) ? x : ::Io::Flow::V0::Models::ShopifyLocalizedVariantPrices.new(x))
  @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::SubcatalogItemStatus) ? x : ::Io::Flow::V0::Models::SubcatalogItemStatus.apply(x))
  @inventory_status = (x = opts.delete(:inventory_status); x.nil? ? nil : (x = x; 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.



51842
51843
51844
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51842

def experience
  @experience
end

#handleObject (readonly)

Returns the value of attribute handle.



51842
51843
51844
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51842

def handle
  @handle
end

#idObject (readonly)

Returns the value of attribute id.



51842
51843
51844
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51842

def id
  @id
end

#inventory_statusObject (readonly)

Returns the value of attribute inventory_status.



51842
51843
51844
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51842

def inventory_status
  @inventory_status
end

#pricesObject (readonly)

Returns the value of attribute prices.



51842
51843
51844
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51842

def prices
  @prices
end

#statusObject (readonly)

Returns the value of attribute status.



51842
51843
51844
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51842

def status
  @status
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



51859
51860
51861
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51859

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

#to_hashObject



51863
51864
51865
51866
51867
51868
51869
51870
51871
51872
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51863

def to_hash
  {
    :id => id,
    :handle => handle,
    :experience => experience.to_hash,
    :prices => prices.to_hash,
    :status => status.value,
    :inventory_status => inventory_status.nil? ? nil : inventory_status.value
  }
end

#to_jsonObject



51855
51856
51857
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51855

def to_json
  JSON.dump(to_hash)
end