Class: Tamiyo::GathererScrape
- Inherits:
-
Object
- Object
- Tamiyo::GathererScrape
- Defined in:
- lib/tamiyo/gatherer_scrape.rb
Instance Method Summary collapse
-
#initialize(set_name) ⇒ GathererScrape
constructor
A new instance of GathererScrape.
- #xml_card_name_details(card_id) ⇒ Object
- #xml_spoiler_rows ⇒ Object
Constructor Details
#initialize(set_name) ⇒ GathererScrape
Returns a new instance of GathererScrape.
6 7 8 9 |
# File 'lib/tamiyo/gatherer_scrape.rb', line 6 def initialize(set_name) @set_name = set_name @client = HTTPClient.new end |
Instance Method Details
#xml_card_name_details(card_id) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/tamiyo/gatherer_scrape.rb', line 20 def xml_card_name_details(card_id) path = 'Pages/Card/Details.aspx' query = '?multiverseid=%s' % card_id url = URI.escape "#{host}#{path}#{query}" response = @client.get url html = Nokogiri::HTML ampersand_fixed(response.body) # must apply these selectors separately for some reason html.css('.cardComponentContainer').css('[id$="nameRow"]') end |
#xml_spoiler_rows ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/tamiyo/gatherer_scrape.rb', line 11 def xml_spoiler_rows path = 'Pages/Search/Default.aspx' query = '?output=spoiler&method=text&action=advanced&set=["%s"]&special=true' % @set_name.tr(' ', '+') url = URI.escape "#{host}#{path}#{query}" response = @client.get url html = Nokogiri::HTML ampersand_fixed(response.body) html.css 'div.textspoiler tr' end |