Class: Remind101::Client
- Inherits:
-
Object
- Object
- Remind101::Client
- Includes:
- AccessTokens, ChatMessages, Connection, Groups, Messages, Subscribers, Users
- Defined in:
- lib/remind101/client.rb
Defined Under Namespace
Modules: AccessTokens, ChatMessages, Connection, Groups, Messages, Subscribers, Users
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
-
.authenticate!(username, password, *args) ⇒ Object
Public: Helper remind Client#authenticate!.
Instance Method Summary collapse
-
#auth_token ⇒ Object
Public: Returns the auth token that’s being used for authenticated requests.
-
#auth_token=(token) ⇒ Object
Public: Sets the auth token to be used for authenticated requests.
-
#authenticate!(username, password) ⇒ Object
Public: Authenticates using this client, then returns a new client with the access token.
-
#initialize(options = {}) {|middleware| ... } ⇒ Client
constructor
A new instance of Client.
Methods included from Users
Methods included from Subscribers
#delete_group_subscriber, #delete_group_subscribers, #get_group_subscribers, #get_subscriber, #get_subscribers, #rename_subscriber
Methods included from ChatMessages
Methods included from Messages
#delete_message, #get_message, #get_messages, #post_message
Methods included from Groups
#delete_group, #get_groups, #post_group
Methods included from AccessTokens
Methods included from Connection
Constructor Details
#initialize(options = {}) {|middleware| ... } ⇒ Client
Returns a new instance of Client.
34 35 36 37 |
# File 'lib/remind101/client.rb', line 34 def initialize( = {}) = yield middleware if block_given? end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
19 20 21 |
# File 'lib/remind101/client.rb', line 19 def end |
Class Method Details
.authenticate!(username, password, *args) ⇒ Object
Public: Helper remind Client#authenticate!
22 23 24 |
# File 'lib/remind101/client.rb', line 22 def self.authenticate!(username, password, *args) new(*args).authenticate!(username, password) end |
Instance Method Details
#auth_token ⇒ Object
Public: Returns the auth token that’s being used for authenticated requests.
Returns String.
42 43 44 |
# File 'lib/remind101/client.rb', line 42 def auth_token [:auth_token] end |
#auth_token=(token) ⇒ Object
Public: Sets the auth token to be used for authenticated requests.
Returns nothing.
49 50 51 |
# File 'lib/remind101/client.rb', line 49 def auth_token=(token) [:auth_token] = token end |
#authenticate!(username, password) ⇒ Object
Public: Authenticates using this client, then returns a new client with the access token.
Returns a Remind101::Client.
29 30 31 32 |
# File 'lib/remind101/client.rb', line 29 def authenticate!(username, password) resp = post_access_tokens(user: { email: username, password: password }) self.class.new(.merge(auth_token: resp.body.token)) end |