class HelpScout::API::AccessToken::Request
Attributes
response[R]
Public Instance Methods
execute()
click to toggle source
# File lib/help_scout/api/access_token/request.rb, line 9 def execute @response = request_token end
Private Instance Methods
request_token()
click to toggle source
# File lib/help_scout/api/access_token/request.rb, line 15 def request_token connection = API::Client.new(authorize: false).connection http_response = connection.post('oauth2/token', token_request_params) case http_response.status when 200 then AccessToken.new(Response.new(http_response).body) when 429 then raise API::ThrottleLimitReached, http_response.body&.dig('error') else raise API::InternalError, "unexpected response (status #{http_response.status})" end end
token_request_params()
click to toggle source
# File lib/help_scout/api/access_token/request.rb, line 26 def token_request_params @_token_request_params ||= { grant_type: 'client_credentials', client_id: HelpScout.app_id, client_secret: HelpScout.app_secret } end