Class: Sumo::Client

Inherits:
Object
  • Object
show all
Includes:
Error
Defined in:
lib/sumo/client.rb

Overview

This class has the lowest-level interface to interact with the Sumo Job API.

Constant Summary collapse

REDIRECT_STATUSES =
[301, 302, 303, 307, 308]
DEFAULT_ERROR_MESSAGE =

The error message raised when the result can be parsed from Sumo.

'Error sending API request'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(credentials = Sumo.creds) ⇒ Client

Create a new ‘Sumo::Client` with the given credentials.



13
14
15
16
# File 'lib/sumo/client.rb', line 13

def initialize(credentials = Sumo.creds)
  @email = credentials['email'].freeze
  @password = credentials['password'].freeze
end

Instance Attribute Details

Returns the value of attribute cookie.



5
6
7
# File 'lib/sumo/client.rb', line 5

def cookie
  @cookie
end

#emailObject (readonly)

Returns the value of attribute email.



5
6
7
# File 'lib/sumo/client.rb', line 5

def email
  @email
end

#passwordObject (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 request to the API and retrieve processed data.



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

def request(hash, &block)
  handle_request(hash, &block).body
end