Class: FirehouseReader
- Inherits:
-
Object
- Object
- FirehouseReader
- Defined in:
- lib/firehouse_reader.rb
Instance Attribute Summary collapse
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(url) ⇒ FirehouseReader
constructor
A new instance of FirehouseReader.
- #seed_db ⇒ Object
Constructor Details
#initialize(url) ⇒ FirehouseReader
Returns a new instance of FirehouseReader.
5 6 7 |
# File 'lib/firehouse_reader.rb', line 5 def initialize(url) @url = url end |
Instance Attribute Details
#url ⇒ Object (readonly)
Returns the value of attribute url.
3 4 5 |
# File 'lib/firehouse_reader.rb', line 3 def url @url end |
Instance Method Details
#seed_db ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/firehouse_reader.rb', line 9 def seed_db JSON.parse(RestClient.get(url))["data"].each do |line| next if line.last == "Borough" f = Firehouse.create f.address = "#{line[9]} #{line[10]}, NY" f.save puts "Geocoding: #{f.address}" sleep 5 end end |