Class: SeleniumShots::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium_shots/cli/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key, host = 'www.seleniumshots.com') ⇒ Client



10
11
12
13
# File 'lib/selenium_shots/cli/client.rb', line 10

def initialize(api_key, host='www.seleniumshots.com')
  @api_key  = api_key
  @host     = host
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



8
9
10
# File 'lib/selenium_shots/cli/client.rb', line 8

def api_key
  @api_key
end

#hostObject (readonly)

Returns the value of attribute host.



8
9
10
# File 'lib/selenium_shots/cli/client.rb', line 8

def host
  @host
end

Instance Method Details

#delete(uri) ⇒ Object



32
33
34
# File 'lib/selenium_shots/cli/client.rb', line 32

def delete(uri)
  resource(uri).delete
end

#get(uri) ⇒ Object



20
21
22
# File 'lib/selenium_shots/cli/client.rb', line 20

def get(uri)
  resource(uri).get
end

#post(uri) ⇒ Object



24
25
26
# File 'lib/selenium_shots/cli/client.rb', line 24

def post(uri)
  resource(uri).post
end

#put(uri) ⇒ Object



28
29
30
# File 'lib/selenium_shots/cli/client.rb', line 28

def put(uri)
  resource(uri).put
end

#resource(uri) ⇒ Object



16
17
18
# File 'lib/selenium_shots/cli/client.rb', line 16

def resource(uri)
  RestClient::Resource.new("http://#{host}", api_key)[uri]
end