Class: QueueryClient::UrlDataFileBundle
- Inherits:
-
DataFileBundle
- Object
- DataFileBundle
- QueueryClient::UrlDataFileBundle
- Defined in:
- lib/queuery_client/url_data_file_bundle.rb
Instance Attribute Summary collapse
-
#data_files ⇒ Object
readonly
Returns the value of attribute data_files.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#manifest_file ⇒ Object
readonly
Returns the value of attribute manifest_file.
-
#s3_prefix ⇒ Object
readonly
Returns the value of attribute s3_prefix.
Instance Method Summary collapse
- #direct(bucket_opts = {}, bundle_opts = {}) ⇒ Object
- #has_manifest? ⇒ Boolean
-
#initialize(data_urls, manifest_url, s3_prefix:, logger: Logger.new($stderr)) ⇒ UrlDataFileBundle
constructor
A new instance of UrlDataFileBundle.
- #url ⇒ Object
Methods inherited from DataFileBundle
Constructor Details
#initialize(data_urls, manifest_url, s3_prefix:, logger: Logger.new($stderr)) ⇒ UrlDataFileBundle
Returns a new instance of UrlDataFileBundle.
9 10 11 12 13 14 15 |
# File 'lib/queuery_client/url_data_file_bundle.rb', line 9 def initialize(data_urls, manifest_url, s3_prefix:, logger: Logger.new($stderr)) raise ArgumentError, 'no URL given' if data_urls.empty? @data_files = data_urls.map {|url| UrlDataFile.new(URI.parse(url)) } @manifest_file = UrlManifestFile.new(URI.parse(manifest_url)) if manifest_url @s3_prefix = s3_prefix @logger = logger end |
Instance Attribute Details
#data_files ⇒ Object (readonly)
Returns the value of attribute data_files.
17 18 19 |
# File 'lib/queuery_client/url_data_file_bundle.rb', line 17 def data_files @data_files end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
20 21 22 |
# File 'lib/queuery_client/url_data_file_bundle.rb', line 20 def logger @logger end |
#manifest_file ⇒ Object (readonly)
Returns the value of attribute manifest_file.
18 19 20 |
# File 'lib/queuery_client/url_data_file_bundle.rb', line 18 def manifest_file @manifest_file end |
#s3_prefix ⇒ Object (readonly)
Returns the value of attribute s3_prefix.
19 20 21 |
# File 'lib/queuery_client/url_data_file_bundle.rb', line 19 def s3_prefix @s3_prefix end |
Instance Method Details
#direct(bucket_opts = {}, bundle_opts = {}) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/queuery_client/url_data_file_bundle.rb', line 29 def direct(bucket_opts = {}, bundle_opts = {}) s3_uri = URI.parse(s3_prefix) bucket = s3_uri.host prefix = s3_uri.path[1..-1] # trim heading slash S3DataFileBundle.new(bucket, prefix) end |
#has_manifest? ⇒ Boolean
36 37 38 |
# File 'lib/queuery_client/url_data_file_bundle.rb', line 36 def has_manifest? !@manifest_file.nil? end |
#url ⇒ Object
22 23 24 25 26 27 |
# File 'lib/queuery_client/url_data_file_bundle.rb', line 22 def url uri = data_files.first.url.dup uri.query = nil uri.path = File.dirname(uri.path) uri.to_s end |