Class: GTFS::URLSource
Constant Summary
Constants inherited from Source
Source::DEFAULT_OPTIONS, Source::ENTITIES, Source::OPTIONAL_SOURCE_FILES, Source::REQUIRED_SOURCE_FILES, Source::SOURCE_FILES
Instance Attribute Summary
Attributes inherited from Source
Instance Method Summary collapse
Methods inherited from Source
build, #entries, #extract_to_cache, #files, finalize, #initialize, #parse_file, #raise_if_missing_source
Constructor Details
This class inherits a constructor from GTFS::Source
Instance Method Details
#load_archive(source_url) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/gtfs/url_source.rb', line 7 def load_archive(source_url) Dir.mktmpdir do |tmp| file_name = File.join(tmp, "/gtfs_temp_#{Time.now.strftime('%Y%jT%H%M%S%z')}.zip") uri = URI.parse(source_url) response = Net::HTTP.get_response(uri) open(file_name, 'wb') do |file| file.write response.body end extract_to_cache(file_name) end rescue Exception => e raise InvalidSourceException.new(e.) end |