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.



23696
23697
23698
23699
23700
23701
23702
23703
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23696

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.



23694
23695
23696
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23694

def experience
  @experience
end

#idObject (readonly)

Returns the value of attribute id.



23694
23695
23696
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23694

def id
  @id
end

#itemObject (readonly)

Returns the value of attribute item.



23694
23695
23696
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23694

def item
  @item
end

#statusObject (readonly)

Returns the value of attribute status.



23694
23695
23696
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23694

def status
  @status
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



23709
23710
23711
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23709

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

#to_hashObject



23713
23714
23715
23716
23717
23718
23719
23720
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23713

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

#to_jsonObject



23705
23706
23707
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23705

def to_json
  JSON.dump(to_hash)
end