Class: HttpDownloader::DownloadResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/http_downloader/download_response.rb

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ DownloadResponse

Returns a new instance of DownloadResponse.



4
5
6
# File 'lib/http_downloader/download_response.rb', line 4

def initialize(response)
  @response = response
end

Instance Method Details

#read_body(content_types = []) ⇒ Object



8
9
10
11
12
# File 'lib/http_downloader/download_response.rb', line 8

def read_body(content_types = [])
  if allowed_content_type?(content_types)
    block_given? ? @response.read_body { |chunk| yield(chunk) } : @response.read_body
  end
end