class Scraper

Attributes

url[RW]

Public Class Methods

new(url) click to toggle source
# File lib/scrape_notice.rb, line 14
def initialize(url)
  @url = url
  @notice = Notice.new

end

Public Instance Methods

get_page() click to toggle source
# File lib/scrape_notice.rb, line 20
def get_page
 html = open(@url, ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE)
 doc = Nokogiri::HTML(html)


end
set_attributes() click to toggle source
# File lib/scrape_notice.rb, line 27
def set_attributes
  array_alert = ["array_alert"]
  array_watch = ["array_watch"]
  array_warn = ["array_warn"]

  main_content = self.get_page.css('#contentArea')
  notice_hash = {:alert => main_content.css('#alert'), :watch => main_content.css('#watch'), :warn => main_content.css('#warn')}
  alerts = notice_hash[:alert].collect {|alert| alert.css('li')}
  watches = notice_hash[:watch].collect {|watch| watch.css('li')}
  warns = notice_hash[:warn].collect {|warn| warn.css('li')}
    if alerts[0] != nil
      alerts[0].each do |alert|
        array_alert << alert
      end
    end

    if watches[0] != nil
      watches[0].each do |watch|
        array_watch << watch
      end
    end

    if warns[0] != nil
      warns[0].each do |warn|
        array_warn << warn
      end
    end

 make(array_alert)
 make(array_warn)
 make(array_watch)

 @notice
 end