Class: RedshiftConnector::UrlDataFile

Inherits:
AbstractDataFile show all
Defined in:
lib/redshift_connector/url_data_file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractDataFile

#data_object?, #each_row, #gzipped_object?

Constructor Details

#initialize(url, reader_class:) ⇒ UrlDataFile

Returns a new instance of UrlDataFile.



6
7
8
9
# File 'lib/redshift_connector/url_data_file.rb', line 6

def initialize(url, reader_class:)
  super reader_class: reader_class
  @url = url
end

Instance Attribute Details

#urlObject (readonly)

Returns the value of attribute url.



11
12
13
# File 'lib/redshift_connector/url_data_file.rb', line 11

def url
  @url
end

Instance Method Details

#keyObject



13
14
15
# File 'lib/redshift_connector/url_data_file.rb', line 13

def key
  @url.path
end

#openObject



17
18
19
20
21
22
# File 'lib/redshift_connector/url_data_file.rb', line 17

def open
  stdin, stdout, stderr, wait_th = Open3.popen3('curl', @url.to_s)
  stdin.close
  stderr.close
  stdout
end