Class: NycWorkspaceFinder::Scraper

Inherits:
Object
  • Object
show all
Defined in:
lib/nyc_workspace_finder/scraper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#computer_stationObject

Returns the value of attribute computer_station.



8
9
10
# File 'lib/nyc_workspace_finder/scraper.rb', line 8

def computer_station
  @computer_station
end

#dedicated_deskObject

Returns the value of attribute dedicated_desk.



8
9
10
# File 'lib/nyc_workspace_finder/scraper.rb', line 8

def dedicated_desk
  @dedicated_desk
end

#ft_desksObject

Returns the value of attribute ft_desks.



8
9
10
# File 'lib/nyc_workspace_finder/scraper.rb', line 8

def ft_desks
  @ft_desks
end

#limitedObject

Returns the value of attribute limited.



8
9
10
# File 'lib/nyc_workspace_finder/scraper.rb', line 8

def limited
  @limited
end

#monthlyObject

Returns the value of attribute monthly.



8
9
10
# File 'lib/nyc_workspace_finder/scraper.rb', line 8

def monthly
  @monthly
end

#nights_weekendsObject

Returns the value of attribute nights_weekends.



8
9
10
# File 'lib/nyc_workspace_finder/scraper.rb', line 8

def nights_weekends
  @nights_weekends
end

#open_deskObject

Returns the value of attribute open_desk.



8
9
10
# File 'lib/nyc_workspace_finder/scraper.rb', line 8

def open_desk
  @open_desk
end

#pt_workspaceObject

Returns the value of attribute pt_workspace.



8
9
10
# File 'lib/nyc_workspace_finder/scraper.rb', line 8

def pt_workspace
  @pt_workspace
end

#pvt_offceObject

Returns the value of attribute pvt_offce.



8
9
10
# File 'lib/nyc_workspace_finder/scraper.rb', line 8

def pvt_offce
  @pvt_offce
end

#ratesObject

Returns the value of attribute rates.



8
9
10
# File 'lib/nyc_workspace_finder/scraper.rb', line 8

def rates
  @rates
end

#virtualObject

Returns the value of attribute virtual.



8
9
10
# File 'lib/nyc_workspace_finder/scraper.rb', line 8

def virtual
  @virtual
end

Instance Method Details

#scrape_brooklyncreativeleagueObject



25
26
27
28
29
30
31
# File 'lib/nyc_workspace_finder/scraper.rb', line 25

def scrape_brooklyncreativeleague
  doc = Nokogiri::HTML(open("http://brooklyncreativeleague.com/workspace/"))
  self.pvt_offce = "Private Offices: #{doc.search("section p")[1].text.gsub(" Details »", "")}"
  self.ft_desks = "Full-time desks: #{doc.search("section p")[2].text.gsub(" Details »", "")}"
  self.pt_workspace = "Part-time Workspace: #{doc.search("section p")[3].text.gsub(" Details »", "")}"
  self.virtual = "Virtual Office: #{doc.search("section p")[4].text.gsub(" Details »", "")}"
end

#scrape_conartist_nycObject



33
34
35
36
37
# File 'lib/nyc_workspace_finder/scraper.rb', line 33

def scrape_conartist_nyc
  doc = Nokogiri::HTML(open("http://conartistnyc.com/blogs/news/10543057-need-workspace"))
  self.limited = doc.search("div.post-content p").text.match(/LIMITED(.*)9\sa\sweek./).to_s
  self.monthly = doc.search("div.post-content p").text.match(/MONTHLY(.*)5./).to_s
end

#scrape_nospaceObject



20
21
22
23
# File 'lib/nyc_workspace_finder/scraper.rb', line 20

def scrape_nospace
  doc = Nokogiri::HTML(open("http://notanalternative.org/2011/05/17/coworking-no%E2%86%94space-featured-in-ny-post/"))
  self.rates = doc.search("div p")[1].text
end

#scrape_productiveObject



12
13
14
15
16
17
18
# File 'lib/nyc_workspace_finder/scraper.rb', line 12

def scrape_productive
  doc = Nokogiri::HTML(open("http://theproductivenyc.com/prices/"))
  self.open_desk = doc.search("tr td").first.text[1..-1].split.join(' ')
  self.computer_station = doc.search("tr td")[1].text[1..-1].split.join(' ')
  self.nights_weekends = doc.search("tr td")[2].text.split.join(' ')
  self.dedicated_desk = doc.search("tr td")[3].text[1..-1].split.join(' ')
end