Sha256: 8fb2d96e706a6466678b31bb67c559d28341e268ecfb974fba1750719047da09

Contents?: true

Size: 585 Bytes

Versions: 4

Compression:

Stored size: 585 Bytes

Contents

require "httparty"

module Artifactory
  module GemImport
    module GemSpecs
      class Downloader
        def self.call(url, headers: {})
          new(url, headers).call
        end

        attr_reader :url, :headers

        def initialize(url, headers)
          @url = url
          @headers = headers
        end

        def call
          response = HTTParty.get url,
                                  headers: headers

          if response.success?
            response.body
          else
            response.error!
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
artifactory-gem_import-0.2.2 lib/artifactory/gem_import/gem_specs/downloader.rb
artifactory-gem_import-0.2.0 lib/artifactory/gem_import/gem_specs/downloader.rb
artifactory-gem_import-0.1.4 lib/artifactory/gem_import/gem_specs/downloader.rb
artifactory-gem_import-0.1.3 lib/artifactory/gem_import/gem_specs/downloader.rb