Class: Artifactory::GemImport::GemSpecs::Downloader
- Inherits:
-
Object
- Object
- Artifactory::GemImport::GemSpecs::Downloader
- Defined in:
- lib/artifactory/gem_import/gem_specs/downloader.rb
Instance Attribute Summary collapse
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(url, headers) ⇒ Downloader
constructor
A new instance of Downloader.
Constructor Details
#initialize(url, headers) ⇒ Downloader
Returns a new instance of Downloader.
13 14 15 16 |
# File 'lib/artifactory/gem_import/gem_specs/downloader.rb', line 13 def initialize(url, headers) @url = url @headers = headers end |
Instance Attribute Details
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
11 12 13 |
# File 'lib/artifactory/gem_import/gem_specs/downloader.rb', line 11 def headers @headers end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
11 12 13 |
# File 'lib/artifactory/gem_import/gem_specs/downloader.rb', line 11 def url @url end |
Class Method Details
.call(url, headers: {}) ⇒ Object
7 8 9 |
# File 'lib/artifactory/gem_import/gem_specs/downloader.rb', line 7 def self.call(url, headers: {}) new(url, headers).call end |
Instance Method Details
#call ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/artifactory/gem_import/gem_specs/downloader.rb', line 18 def call response = HTTParty.get url, headers: headers if response.success? response.body else response.error! end end |