Class: ListingParser

Inherits:
Object
  • Object
show all
Defined in:
app/parsers/listing_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(listing) ⇒ ListingParser


4
5
6
# File 'app/parsers/listing_parser.rb', line 4

def initialize(listing)
  @listing = listing
end

Instance Attribute Details

#listingObject (readonly)

Returns the value of attribute listing


2
3
4
# File 'app/parsers/listing_parser.rb', line 2

def listing
  @listing
end

Instance Method Details

#game_nameObject


8
9
10
# File 'app/parsers/listing_parser.rb', line 8

def game_name
  listing_row.css('.market_listing_game_name').first.content
end

#image_urlObject


20
21
22
# File 'app/parsers/listing_parser.rb', line 20

def image_url
  listing_row.css('img').first.attributes['src'].value
end

#item_nameObject


12
13
14
# File 'app/parsers/listing_parser.rb', line 12

def item_name
  listing_row.css('.market_listing_item_name').first.content
end

16
17
18
# File 'app/parsers/listing_parser.rb', line 16

def link_url
  listing.attributes['href'].value
end

#priceObject


24
25
26
# File 'app/parsers/listing_parser.rb', line 24

def price
  listing_row.css('.market_table_value span').first.content.match(/\d+.\d{1,2}/).to_s.to_f
end