Class: Io::Flow::V0::Models::ExperienceInventoryItem

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

Overview

Model for status of an item in an experience

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ExperienceInventoryItem

Returns a new instance of ExperienceInventoryItem.



24167
24168
24169
24170
24171
24172
24173
24174
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24167

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :experience, :item, :status], 'ExperienceInventoryItem')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @experience = (x = opts.delete(:experience); x.is_a?(::Io::Flow::V0::Models::InventoryExperienceReference) ? x : ::Io::Flow::V0::Models::InventoryExperienceReference.new(x))
  @item = (x = opts.delete(:item); x.is_a?(::Io::Flow::V0::Models::ItemReference) ? x : ::Io::Flow::V0::Models::ItemReference.new(x))
  @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::ExperienceInventoryItemStatus) ? x : ::Io::Flow::V0::Models::ExperienceInventoryItemStatus.apply(x))
end

Instance Attribute Details

#experienceObject (readonly)

Returns the value of attribute experience.



24165
24166
24167
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24165

def experience
  @experience
end

#idObject (readonly)

Returns the value of attribute id.



24165
24166
24167
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24165

def id
  @id
end

#itemObject (readonly)

Returns the value of attribute item.



24165
24166
24167
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24165

def item
  @item
end

#statusObject (readonly)

Returns the value of attribute status.



24165
24166
24167
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24165

def status
  @status
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



24180
24181
24182
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24180

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

#to_hashObject



24184
24185
24186
24187
24188
24189
24190
24191
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24184

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

#to_jsonObject



24176
24177
24178
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24176

def to_json
  JSON.dump(to_hash)
end