Class: Scraper
- Inherits:
-
Object
- Object
- Scraper
- Defined in:
- lib/scraper.rb
Class Method Summary collapse
Class Method Details
.create_symbols ⇒ Object
14 15 16 17 18 |
# File 'lib/scraper.rb', line 14 def self.create_symbols self.gardens_api.map do |gardens_hash| gardens_hash.transform_keys(&:to_sym) end end |
.garden_hashes ⇒ Object
20 21 22 23 24 |
# File 'lib/scraper.rb', line 20 def self.garden_hashes self.create_symbols.map do |g| Garden.new(g[:borough], g[:gardenname], g[:multipolygon], g[:parksid], g[:status], g[:zipcode]) end end |
.gardens_api ⇒ Object
7 8 9 10 11 12 |
# File 'lib/scraper.rb', line 7 def self.gardens_api site = 'https://data.cityofnewyork.us/resource/p78i-pat6.json' page = HTTParty.get(site) greenthumb_gardens = page.to_a greenthumb_gardens end |