Class: Remind101::Client
- Inherits:
-
Object
- Object
- Remind101::Client
- Includes:
- AccessTokens, Connection, Groups, Messages, Subscribers
- Defined in:
- lib/remind101/client.rb
Defined Under Namespace
Modules: AccessTokens, Connection, Groups, Messages, Subscribers
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
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: Creates a new access token and sets it on the client for future requests.
-
#initialize(options = {}) {|middleware| ... } ⇒ Client
constructor
A new instance of Client.
Methods included from Subscribers
#delete_group_subscriber, #delete_group_subscribers, #get_group_subscribers, #get_subscriber, #get_subscribers, #rename_subscriber
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.
28 29 30 31 |
# File 'lib/remind101/client.rb', line 28 def initialize( = {}) = yield middleware if block_given? end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
15 16 17 |
# File 'lib/remind101/client.rb', line 15 def end |
Instance Method Details
#auth_token ⇒ Object
Public: Returns the auth token that’s being used for authenticated requests.
Returns String.
36 37 38 |
# File 'lib/remind101/client.rb', line 36 def auth_token [:auth_token] end |
#auth_token=(token) ⇒ Object
Public: Sets the auth token to be used for authenticated requests.
Returns nothing.
43 44 45 |
# File 'lib/remind101/client.rb', line 43 def auth_token=(token) [:auth_token] = token end |
#authenticate!(username, password) ⇒ Object
Public: Creates a new access token and sets it on the client for future requests.
Returns the faraday response from creating the access token.
20 21 22 23 24 25 26 |
# File 'lib/remind101/client.rb', line 20 def authenticate!(username, password) post_access_tokens(user: { email: username, password: password }).tap do |response| self.auth_token = response.body.auth_token # Force the connection to be recreated to use the new auth token. @connection = nil end end |