module HubSpot::OAuth::Client
Constants
- URL
Public Instance Methods
api_response()
click to toggle source
Below here are private methods
# File lib/hub_spot/oauth/client.rb, line 19 def api_response response = HubSpot::HTTP.post(url: url) if response.code.to_s != "200" raise APIError, "OAuth API call returned a #{response.code} != 200" end JSON.parse(response.body) end
token_params()
click to toggle source
# File lib/hub_spot/oauth/client.rb, line 12 def token_params expires_in, token_value = api_response.values_at("expires_in", "access_token") expires_at = Time.now + expires_in { value: token_value, expires_at: expires_at } end
url()
click to toggle source
# File lib/hub_spot/oauth/client.rb, line 27 def url URL % url_params end
url_params()
click to toggle source
# File lib/hub_spot/oauth/client.rb, line 31 def url_params { client_id: HubSpot::Configuration.client_id, client_secret: HubSpot::Configuration.client_secret, redirect_uri: HubSpot::Configuration.redirect_uri, refresh_token: HubSpot::Configuration.refresh_token, } end