Module: Authkeeper::VkAdsAuthApi::Requests::AccessToken
- Included in:
- Client
- Defined in:
- app/lib/authkeeper/vk_ads_auth_api/requests/access_token.rb
Instance Method Summary collapse
- #fetch_access_token(client_id:, code:) ⇒ Object
- #refresh_access_token(client_id:, refresh_token:, client_secret:) ⇒ Object
- #remove_access_token(client_id:, client_secret:, username: nil, user_id: nil) ⇒ Object
Instance Method Details
#fetch_access_token(client_id:, code:) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/lib/authkeeper/vk_ads_auth_api/requests/access_token.rb', line 9 def fetch_access_token(client_id:, code:) form_post( path: 'token.json', body: { grant_type: 'authorization_code', client_id: client_id, code: code }, headers: { 'Content-Type' => 'application/x-www-form-urlencoded' } ) end |
#refresh_access_token(client_id:, refresh_token:, client_secret:) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/lib/authkeeper/vk_ads_auth_api/requests/access_token.rb', line 23 def refresh_access_token(client_id:, refresh_token:, client_secret:) form_post( path: 'token.json', body: { grant_type: 'refresh_token', client_id: client_id, refresh_token: refresh_token, client_secret: client_secret }, headers: { 'Content-Type' => 'application/x-www-form-urlencoded' } ) end |
#remove_access_token(client_id:, client_secret:, username: nil, user_id: nil) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/lib/authkeeper/vk_ads_auth_api/requests/access_token.rb', line 38 def remove_access_token(client_id:, client_secret:, username: nil, user_id: nil) form_post( path: 'token/delete.json', body: { client_id: client_id, client_secret: client_secret, username: username, user_id: user_id }.compact, headers: { 'Content-Type' => 'application/x-www-form-urlencoded' } ) end |