Class: QueueryClient::UrlDataFile
- Defined in:
- lib/queuery_client/url_data_file.rb
Instance Attribute Summary collapse
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(url) ⇒ UrlDataFile
constructor
A new instance of UrlDataFile.
- #key ⇒ Object
- #open ⇒ Object
Methods inherited from DataFile
#data_object?, #each_row, #gzipped_object?
Constructor Details
#initialize(url) ⇒ UrlDataFile
Returns a new instance of UrlDataFile.
7 8 9 |
# File 'lib/queuery_client/url_data_file.rb', line 7 def initialize(url) @url = url end |
Instance Attribute Details
#url ⇒ Object (readonly)
Returns the value of attribute url.
11 12 13 |
# File 'lib/queuery_client/url_data_file.rb', line 11 def url @url end |
Instance Method Details
#key ⇒ Object
13 14 15 |
# File 'lib/queuery_client/url_data_file.rb', line 13 def key @url.path end |
#open ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/queuery_client/url_data_file.rb', line 17 def open http = Net::HTTP.new(@url.host, @url.port) http.use_ssl = (@url.scheme.downcase == 'https') content = http.start { res = http.get(@url.request_uri) res.body } StringIO.new(content) end |