Class: Ribose::Client
- Inherits:
-
Object
- Object
- Ribose::Client
- Defined in:
- lib/ribose/client.rb
Instance Attribute Summary collapse
-
#api_token ⇒ Object
readonly
Returns the value of attribute api_token.
-
#user_email ⇒ Object
readonly
Returns the value of attribute user_email.
Class Method Summary collapse
-
.from_login(email:, password:) ⇒ Ribose::Client
Initiate a ribose client.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
5 6 7 8 |
# File 'lib/ribose/client.rb', line 5 def initialize( = {}) @api_token = .fetch(:token, configuration.api_token).to_s @user_email = .fetch(:email, configuration.user_email).to_s end |
Instance Attribute Details
#api_token ⇒ Object (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_email ⇒ Object (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.
20 21 22 23 |
# File 'lib/ribose/client.rb', line 20 def self.from_login(email:, password:) session = Session.create(username: email, password: password) new(email: email, token: session["authentication_token"]) end |