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.



52626
52627
52628
52629
52630
52631
52632
52633
52634
52635
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52626

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.



52624
52625
52626
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52624

def experience
  @experience
end

#handleObject (readonly)

Returns the value of attribute handle.



52624
52625
52626
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52624

def handle
  @handle
end

#idObject (readonly)

Returns the value of attribute id.



52624
52625
52626
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52624

def id
  @id
end

#inventory_statusObject (readonly)

Returns the value of attribute inventory_status.



52624
52625
52626
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52624

def inventory_status
  @inventory_status
end

#pricesObject (readonly)

Returns the value of attribute prices.



52624
52625
52626
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52624

def prices
  @prices
end

#statusObject (readonly)

Returns the value of attribute status.



52624
52625
52626
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52624

def status
  @status
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



52641
52642
52643
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52641

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

#to_hashObject



52645
52646
52647
52648
52649
52650
52651
52652
52653
52654
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52645

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



52637
52638
52639
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52637

def to_json
  JSON.dump(to_hash)
end