Class: EbayItem

Inherits:
Object
  • Object
show all
Defined in:
lib/ebay_ruby/ebay_item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(item) ⇒ EbayItem

Returns a new instance of EbayItem.



3
4
5
# File 'lib/ebay_ruby/ebay_item.rb', line 3

def initialize(item)
  @item = item
end

Instance Attribute Details

#itemObject (readonly)

Returns the value of attribute item.



7
8
9
# File 'lib/ebay_ruby/ebay_item.rb', line 7

def item
  @item
end

Instance Method Details

#build_items_dataObject



9
10
11
12
13
14
15
16
# File 'lib/ebay_ruby/ebay_item.rb', line 9

def build_items_data
  item.keys.each do |attribute|
    metaclass = class << self; self; end
    metaclass.send(:define_method, "#{attribute}") do
      return item[attribute]
    end
  end
end