Class: Goldfinger::Client
- Inherits:
-
Object
- Object
- Goldfinger::Client
- Includes:
- Utils
- Defined in:
- lib/goldfinger/client.rb
Instance Method Summary collapse
- #finger ⇒ Object
-
#initialize(uri, opts = {}) ⇒ Client
constructor
A new instance of Client.
Methods included from Utils
#perform_get, #perform_request
Constructor Details
#initialize(uri, opts = {}) ⇒ Client
Returns a new instance of Client.
10 11 12 13 14 15 |
# File 'lib/goldfinger/client.rb', line 10 def initialize(uri, opts = {}) @uri = uri @ssl = opts.delete(:ssl) { true } @scheme = @ssl ? 'https' : 'http' @opts = opts end |
Instance Method Details
#finger ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/goldfinger/client.rb', line 17 def finger response = perform_get(standard_url, @opts) return finger_from_template if response.code != 200 Goldfinger::Result.new(response) rescue Addressable::URI::InvalidURIError raise Goldfinger::NotFoundError, 'Invalid URI' end |