Class: Ribose::Client

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



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

def initialize(options = {})
  @api_token = options.fetch(:token, configuration.api_token).to_s
  @user_email = options.fetch(:email, configuration.user_email).to_s
end

Instance Attribute Details

#api_tokenObject (readonly)

Returns the value of attribute api_token.



3
4
5
# File 'lib/ribose/client.rb', line 3

def api_token
  @api_token
end

#user_emailObject (readonly)

Returns the value of attribute user_email.



3
4
5
# File 'lib/ribose/client.rb', line 3

def user_email
  @user_email
end

Class Method Details

.from_login(email:, password:) ⇒ Ribose::Client

Initiate a ribose client

This interface takes email and password and then it will do all the underlying work to find out the authentication token and retrun a ribose client.

Parameters:

  • :email (String)

    The email for your Ribose account

  • :password (String)

    The password for your account

Returns:



20
21
22
23
# File 'lib/ribose/client.rb', line 20

def self.(email:, password:)
  session = Session.create(username: email, password: password)
  new(email: email, token: session["authentication_token"])
end