Class: RendertronRuby::Client

Inherits:
Object
  • Object
show all
Includes:
Connection, Request
Defined in:
lib/rendertron_ruby/client.rb

Constant Summary collapse

DEFAULT_HOST =
'localhost:3000'.freeze
DEFAULT_SCHEME =
'https'.freeze
DEFAULT_RENDER_PATH =
'/render'.freeze
DEFAULT_SS_PATH =
'/screenshot'.freeze

Instance Method Summary collapse

Methods included from Request

#request

Methods included from Connection

#connection

Constructor Details

#initialize(options) ⇒ Client

Returns a new instance of Client.



16
17
18
19
20
21
# File 'lib/rendertron_ruby/client.rb', line 16

def initialize(options)
  @host = options[:host] || default_host
  @scheme = options[:scheme] || default_scheme
  @render_path = options[:render_path] || default_render_path
  @ss_path = options[:ss_path] || default_ss_path
end

Instance Method Details

#get(url) ⇒ Object



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

def get(url)
  request(:get, "#{render_path}/#{url}")
end

#get_ss(url) ⇒ Object



27
28
29
# File 'lib/rendertron_ruby/client.rb', line 27

def get_ss(url)
  request(:get, "#{ss_path}/#{url}")
end