Class: Coelacanth::Client::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/coelacanth/client/base.rb

Overview

Coelacanth::Client

Direct Known Subclasses

Ferrum, Gotenberg, ScreenshotOne

Instance Method Summary collapse

Constructor Details

#initialize(url, config = Coelacanth.config) ⇒ Base

Returns a new instance of Base.

Raises:

  • (URI::InvalidURIError)


8
9
10
11
12
13
# File 'lib/coelacanth/client/base.rb', line 8

def initialize(url, config = Coelacanth.config)
  @validator = Coelacanth::Validator.new
  raise URI::InvalidURIError unless @validator.valid_url?(url)
  @config = config
  @url = url
end

Instance Method Details

#clientObject



15
16
17
# File 'lib/coelacanth/client/base.rb', line 15

def client
  @config.read("client")
end

#get_response(url = nil) ⇒ Object



19
20
21
# File 'lib/coelacanth/client/base.rb', line 19

def get_response(url = nil)
  raise "Must be implemented in subclass"
end

#get_screenshotObject



23
24
25
# File 'lib/coelacanth/client/base.rb', line 23

def get_screenshot
  raise "Must be implemented in subclass"
end