diff --git a/lib/board_game_geek.rb b/lib/board_game_geek.rb index 173b37e..cb72918 100644 --- a/lib/board_game_geek.rb +++ b/lib/board_game_geek.rb @@ -34,6 +34,9 @@ def self.top_games how_many release_date = name_and_date[2].to_s.strip[1..-2] rating = cells[3] + game_path = game_row.css(".collection_thumbnail a").first["href"] + game_url = "http://boardgamegeek.com" + game_path + image_url = game_row.css(".collection_thumbnail img").first["src"] image_url.sub!("_mt", "_t") @@ -41,6 +44,7 @@ def self.top_games how_many ranking: ranking, rating: rating, release_date: release_date, + url: game_url, image_url: image_url) end end @@ -53,4 +57,4 @@ def self.break_down_total total end end -BGG = BoardGameGeek \ No newline at end of file +BGG = BoardGameGeek diff --git a/spec/scraper_spec.rb b/spec/scraper_spec.rb index e476133..d457765 100644 --- a/spec/scraper_spec.rb +++ b/spec/scraper_spec.rb @@ -39,6 +39,7 @@ it "exposes some handy attributes" do first_game.must_respond_to :name + first_game.must_respond_to :url first_game.must_respond_to :image_url first_game.must_respond_to :rating first_game.must_respond_to :ranking @@ -59,4 +60,4 @@ VCR.insert_cassette('board_game_geek_1000') subject.top_games(1000).length.must_be :==, 1000 end -end \ No newline at end of file +end