Class: RateCenter::DataSource::SimpleMaps::ResponseParser

Inherits:
Object
  • Object
show all
Defined in:
lib/rate_center/data_source/simple_maps.rb

Defined Under Namespace

Classes: City

Instance Method Summary collapse

Instance Method Details

#parse(response, database_filename:) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/rate_center/data_source/simple_maps.rb', line 17

def parse(response, database_filename:)
  database_file = extract_zipped_file(response, filename: database_filename)

  CSV.parse(database_file.read, headers: true).each_with_object([]) do |row_data, result|
    result << City.new(row_data.to_h)
  end
end