Class: OneLogin::Api
- Inherits:
-
Object
- Object
- OneLogin::Api
- Defined in:
- lib/onelogin/api.rb
Instance Method Summary collapse
- #authorazation ⇒ Object
- #generate_token(client_id, client_secret) ⇒ Object
-
#initialize(client_id, client_secret, client = ApiClient.default) ⇒ Api
constructor
A new instance of Api.
Constructor Details
#initialize(client_id, client_secret, client = ApiClient.default) ⇒ Api
Returns a new instance of Api.
8 9 10 11 |
# File 'lib/onelogin/api.rb', line 8 def initialize(client_id, client_secret, client = ApiClient.default) @client = DefaultApi.new(client) @access_token = generate_token(client_id, client_secret).access_token end |
Instance Method Details
#authorazation ⇒ Object
20 21 22 |
# File 'lib/onelogin/api.rb', line 20 def "bearer #{@access_token}" end |
#generate_token(client_id, client_secret) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/onelogin/api.rb', line 13 def generate_token(client_id, client_secret) auth = "client_id:#{client_id}, client_secret:#{client_secret}" generate_token_request = OneLogin::GenerateTokenRequest.new generate_token_request.grant_type = "client_credentials" @client.generate_token(auth, generate_token_request) end |