Class: Bloopi::API::Auth
- Inherits:
-
Object
- Object
- Bloopi::API::Auth
- Defined in:
- lib/bloopi/api/auth.rb
Instance Attribute Summary collapse
-
#client_id ⇒ Object
readonly
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
readonly
Returns the value of attribute client_secret.
Instance Method Summary collapse
-
#get_access_token(options = {}) ⇒ Object
Fetches the application’s access token (ignoring expiration and other info).
-
#get_access_token_info(options = {}) ⇒ Object
Fetches an access token, token expiration, and other info from Bloopi.
-
#initialize(client_id = nil, client_secret = nil) ⇒ Auth
constructor
Creates a new client.
Constructor Details
#initialize(client_id = nil, client_secret = nil) ⇒ Auth
Creates a new client.
14 15 16 17 |
# File 'lib/bloopi/api/auth.rb', line 14 def initialize(client_id = nil, client_secret = nil) @client_id = client_id || Bloopi.config.client_id @client_secret = client_secret || Bloopi.config.client_secret end |
Instance Attribute Details
#client_id ⇒ Object (readonly)
Returns the value of attribute client_id.
8 9 10 |
# File 'lib/bloopi/api/auth.rb', line 8 def client_id @client_id end |
#client_secret ⇒ Object (readonly)
Returns the value of attribute client_secret.
8 9 10 |
# File 'lib/bloopi/api/auth.rb', line 8 def client_secret @client_secret end |
Instance Method Details
#get_access_token(options = {}) ⇒ Object
Fetches the application’s access token (ignoring expiration and other info).
44 45 46 47 48 |
# File 'lib/bloopi/api/auth.rb', line 44 def get_access_token( = {}) if info = get_access_token_info() Bloopi.config.access_token = info["access_token"] end end |
#get_access_token_info(options = {}) ⇒ Object
Fetches an access token, token expiration, and other info from Bloopi. Useful when you’ve received an OAuth code using the server-side authentication process.
33 34 35 36 |
# File 'lib/bloopi/api/auth.rb', line 33 def get_access_token_info( = {}) # convenience method to get a the application's sessionless access token get_token_from_server({}, true, ) end |