Class: SeleniumShots::Client
- Inherits:
-
Object
- Object
- SeleniumShots::Client
- Defined in:
- lib/selenium_shots/cli/client.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
Instance Method Summary collapse
- #delete(uri) ⇒ Object
- #get(uri) ⇒ Object
-
#initialize(api_key, host = 'www.seleniumshots.com') ⇒ Client
constructor
A new instance of Client.
- #post(uri) ⇒ Object
- #put(uri) ⇒ Object
- #resource(uri) ⇒ Object
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_key ⇒ Object (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 |
#host ⇒ Object (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 |