class CatClaw::StackOverFlowCat

Attributes

footprint[RW]

Public Class Methods

new() click to toggle source
# File lib/cat_claw/cats/stack_over_flow_cat.rb, line 7
def initialize
  @base_url = "http://careers.stackoverflow.com"
  @footprint = {
    source: "RubyChina",
    jobs: [],
  }
end

Public Instance Methods

paw() click to toggle source
# File lib/cat_claw/cats/stack_over_flow_cat.rb, line 15
def paw
  whisper
  @footprint
end

Private Instance Methods

whisper() click to toggle source
# File lib/cat_claw/cats/stack_over_flow_cat.rb, line 21
def whisper
  puts 'opening URI ... stackoverflow'
  url = @base_url + "/jobs/remote"
  doc = Nokogiri::HTML(open(url))
  topics = doc.css(".jobs div h3 a")
  topics.each do |t|
    url = @base_url + t.attr("href")
    doc = Nokogiri::HTML(open(url))
    title = doc.css(".jobdetail div h1 a").text
    content = doc.css(".description").text
    @footprint[:jobs] << {
      url: url,
      title: title,
      content: content,
      scope: "World",
      job_type: "developer",
    }
  end
end