Module: CleverSDK::Api::Authentication
- Included in:
- CleverSDK::Api
- Defined in:
- lib/clever_sdk/api/authentication.rb
Instance Method Summary collapse
- #me(access_token:) ⇒ Object
- #tokeninfo(access_token:) ⇒ Object
-
#tokens(client_id:, client_secret:, district: nil) ⇒ Object
district - the district’s token.
- #tokens!(client_id:, client_secret:, code: nil, grant_type: nil, redirect_uri: nil) ⇒ Object
Instance Method Details
#me(access_token:) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/clever_sdk/api/authentication.rb', line 31 def me(access_token:) get( "https://api.clever.com/v3.0/me", {}, bearer_headers(access_token) ) end |
#tokeninfo(access_token:) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/clever_sdk/api/authentication.rb', line 23 def tokeninfo(access_token:) get( "https://clever.com/oauth/tokeninfo", {}, bearer_headers(access_token) ) end |
#tokens(client_id:, client_secret:, district: nil) ⇒ Object
district - the district’s token
7 8 9 10 11 12 13 |
# File 'lib/clever_sdk/api/authentication.rb', line 7 def tokens(client_id:, client_secret:, district: nil) get( "https://clever.com/oauth/tokens", params(owner_type: :district, district: district), basic_auth_headers(client_id, client_secret) ) end |
#tokens!(client_id:, client_secret:, code: nil, grant_type: nil, redirect_uri: nil) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/clever_sdk/api/authentication.rb', line 15 def tokens!(client_id:, client_secret:, code: nil, grant_type: nil, redirect_uri: nil) post( "https://clever.com/oauth/tokens", JSON.dump(params(code: code, grant_type: grant_type, redirect_uri: redirect_uri)), basic_auth_headers(client_id, client_secret).merge({"Content-Type" => "application/json"}) ) end |