Class: Sumo::Client
Overview
This class has the lowest-level interface to interact with the Sumo Job API.
Constant Summary collapse
- DEFAULT_ERROR_MESSAGE =
The error message raised when the result can be parsed from Sumo.
'Error sending API request'
Instance Attribute Summary collapse
-
#cookie ⇒ Object
readonly
Returns the value of attribute cookie.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
Instance Method Summary collapse
-
#initialize(credentials = Sumo.creds) ⇒ Client
constructor
Create a new ‘Sumo::Client` with the given credentials.
-
#request(hash, &block) ⇒ Object
Send a HTTP request to the server, handling any errors that may occur.
Constructor Details
#initialize(credentials = Sumo.creds) ⇒ Client
Create a new ‘Sumo::Client` with the given credentials.
11 12 13 14 |
# File 'lib/sumo/client.rb', line 11 def initialize(credentials = Sumo.creds) @email = credentials['email'].freeze @password = credentials['password'].freeze end |
Instance Attribute Details
#cookie ⇒ Object (readonly)
Returns the value of attribute cookie.
5 6 7 |
# File 'lib/sumo/client.rb', line 5 def end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
5 6 7 |
# File 'lib/sumo/client.rb', line 5 def email @email end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
5 6 7 |
# File 'lib/sumo/client.rb', line 5 def password @password end |
Instance Method Details
#request(hash, &block) ⇒ Object
Send a HTTP request to the server, handling any errors that may occur.
17 18 19 20 21 22 |
# File 'lib/sumo/client.rb', line 17 def request(hash, &block) response = connection.request(add_defaults(hash), &block) handle_errors!(response) (response) response.body end |