class OnTapIbc::Scraper

Public Class Methods

beer_details() click to toggle source
# File lib/on_tap_ibc/scraper.rb, line 27
def self.beer_details
  self.scrape_core_beliefs
end
scrape_core_beliefs() click to toggle source
# File lib/on_tap_ibc/scraper.rb, line 31
def self.scrape_core_beliefs
    beer_hashes = {}
    ["https://www.ithacabeer.com/ithaca-beer-core-beliefs","https://www.ithacabeer.com/ithaca-beer-random-acts"].each do |url|

    beers = Nokogiri::HTML(open(url))

    beers.css("div.col.sqs-col-10.span-10").each do |beer|
      beer_hashes["#{beer.css("div p.beerDetails").text.strip.upcase}"] = {
        style: beer.css("div p.beerDetails2").text.strip,
        long_desc: beer.css("div.html-block p")[0].text.strip,
        addl1: beer.css("div.html-block p").last.text.strip
      }
    end
  end
  beer_hashes
end
scrape_menu() click to toggle source
# File lib/on_tap_ibc/scraper.rb, line 12
def self.scrape_menu
  beers = Nokogiri::HTML(open("https://www.ithacabeer.com/taproom-menu/#anchor-tap-list"))
  current_beers = []
  # Iterate through beer menu
  beers.css("div#block-yui_3_17_2_8_1508769314339_15193 div.menu-items div.menu-item").each do |beer|

    current_beers << {
      :name => beer.css("div.menu-item-title").text.strip,
      :abv => beer.css("span.menu-item-price-top").text.strip,
      :short_desc => beer.css("div.menu-item-description").text.strip
    }
  end
  current_beers
end
updated_last() click to toggle source
# File lib/on_tap_ibc/scraper.rb, line 6
def self.updated_last
  doc = Nokogiri::HTML(open("https://www.ithacabeer.com/taproom-menu/#anchor-tap-list"))
  updated_last = doc.search("div#block-yui_3_17_2_8_1508769314339_15193 div.menu-section-title").text.strip
  updated_last
end