Class: ImageInfo::RequestHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/image_info/request_handler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(image) ⇒ RequestHandler

Returns a new instance of RequestHandler.



6
7
8
# File 'lib/image_info/request_handler.rb', line 6

def initialize(image)
  @image = image
end

Instance Attribute Details

#imageObject (readonly)

Returns the value of attribute image.



4
5
6
# File 'lib/image_info/request_handler.rb', line 4

def image
  @image
end

Instance Method Details

#buildObject



10
11
12
13
14
# File 'lib/image_info/request_handler.rb', line 10

def build
  ::Typhoeus::Request.new(image.uri.to_s, followlocation: true, accept_encoding: :gzip).tap do |request|
    request.on_complete { |response| on_complete(response) }
  end
end