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.



38329
38330
38331
38332
38333
38334
38335
38336
38337
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38329

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))
end

Instance Attribute Details

#experienceObject (readonly)

Returns the value of attribute experience.



38327
38328
38329
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38327

def experience
  @experience
end

#handleObject (readonly)

Returns the value of attribute handle.



38327
38328
38329
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38327

def handle
  @handle
end

#idObject (readonly)

Returns the value of attribute id.



38327
38328
38329
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38327

def id
  @id
end

#pricesObject (readonly)

Returns the value of attribute prices.



38327
38328
38329
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38327

def prices
  @prices
end

#statusObject (readonly)

Returns the value of attribute status.



38327
38328
38329
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38327

def status
  @status
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



38343
38344
38345
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38343

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

#to_hashObject



38347
38348
38349
38350
38351
38352
38353
38354
38355
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38347

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

#to_jsonObject



38339
38340
38341
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38339

def to_json
  JSON.dump(to_hash)
end