Class: Io::Flow::V0::Models::LocalItem

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

Overview

The Local Item represents all of the data for a given item that is localized to a given experinece.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ LocalItem

Returns a new instance of LocalItem.



19246
19247
19248
19249
19250
19251
19252
19253
19254
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19246

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :experience, :item, :pricing, :status], 'LocalItem')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @experience = (x = opts.delete(:experience); x.is_a?(::Io::Flow::V0::Models::ExperienceSummary) ? x : ::Io::Flow::V0::Models::ExperienceSummary.new(x))
  @item = (x = opts.delete(:item); x.is_a?(::Io::Flow::V0::Models::CatalogItemReference) ? x : ::Io::Flow::V0::Models::CatalogItemReference.new(x))
  @pricing = (x = opts.delete(:pricing); x.is_a?(::Io::Flow::V0::Models::LocalItemPricing) ? x : ::Io::Flow::V0::Models::LocalItemPricing.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.



19244
19245
19246
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19244

def experience
  @experience
end

#idObject (readonly)

Returns the value of attribute id.



19244
19245
19246
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19244

def id
  @id
end

#itemObject (readonly)

Returns the value of attribute item.



19244
19245
19246
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19244

def item
  @item
end

#pricingObject (readonly)

Returns the value of attribute pricing.



19244
19245
19246
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19244

def pricing
  @pricing
end

#statusObject (readonly)

Returns the value of attribute status.



19244
19245
19246
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19244

def status
  @status
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



19260
19261
19262
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19260

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

#to_hashObject



19264
19265
19266
19267
19268
19269
19270
19271
19272
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19264

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

#to_jsonObject



19256
19257
19258
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19256

def to_json
  JSON.dump(to_hash)
end