lib/atp_scraper/get.rb in atp_scraper-0.3.0 vs lib/atp_scraper/get.rb in atp_scraper-0.4.0
- old
+ new
@@ -1,18 +1,18 @@
module AtpScraper
# Main class
class Get
def self.singles_ranking(rank_range = nil)
request_uri = "/en/rankings/singles?rankRange=#{rank_range}"
- ranking_doc = AtpScraper::Html.get_and_parse(request_uri)
- ranking = AtpScraper::Ranking.new
- ranking.pickup_ranking_data(ranking_doc)
+ ranking_html = AtpScraper::Html.get(request_uri)
+ ranking = AtpScraper::Ranking.new(ranking_html[:html], ranking_html[:charset])
+ ranking.pickup_ranking_data
end
def self.player_activity(player_id, year)
request_uri = "/players/anything/#{player_id}/player-activity?year=#{year}"
- activity_doc = AtpScraper::Html.get_and_parse(request_uri)
- activity = AtpScraper::Activity.new
- activity.pickup_activity_data(activity_doc)
+ activity_html = AtpScraper::Html.get(request_uri)
+ activity = AtpScraper::Activity.new(activity_html[:html], activity_html[:charset])
+ activity.pickup_activity_data
end
end
end