Class: Gemstash::GemFetcher
- Inherits:
-
Object
- Object
- Gemstash::GemFetcher
- Defined in:
- lib/gemstash/gem_fetcher.rb
Overview
:nodoc:
Instance Method Summary collapse
- #fetch(gem_id, type, &block) ⇒ Object
-
#initialize(http_client) ⇒ GemFetcher
constructor
A new instance of GemFetcher.
Constructor Details
#initialize(http_client) ⇒ GemFetcher
Returns a new instance of GemFetcher.
7 8 9 10 |
# File 'lib/gemstash/gem_fetcher.rb', line 7 def initialize(http_client) @http_client = http_client @valid_headers = Set.new(["etag", "content-type", "content-length", "last-modified"]) end |
Instance Method Details
#fetch(gem_id, type, &block) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/gemstash/gem_fetcher.rb', line 12 def fetch(gem_id, type, &block) @http_client.get(path_for(gem_id, type)) do |body, headers| properties = filter_headers(headers) validate_download(body, properties) yield body, properties end end |