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.



40053
40054
40055
40056
40057
40058
40059
40060
40061
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40053

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.



40051
40052
40053
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40051

def experience
  @experience
end

#handleObject (readonly)

Returns the value of attribute handle.



40051
40052
40053
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40051

def handle
  @handle
end

#idObject (readonly)

Returns the value of attribute id.



40051
40052
40053
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40051

def id
  @id
end

#pricesObject (readonly)

Returns the value of attribute prices.



40051
40052
40053
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40051

def prices
  @prices
end

#statusObject (readonly)

Returns the value of attribute status.



40051
40052
40053
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40051

def status
  @status
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



40067
40068
40069
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40067

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

#to_hashObject



40071
40072
40073
40074
40075
40076
40077
40078
40079
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40071

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

#to_jsonObject



40063
40064
40065
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40063

def to_json
  JSON.dump(to_hash)
end