Class: Hubspot::OAuthHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/hubspot/oauth_helper.rb

Constant Summary collapse

AUTHORIZE_URL =
'https://app.hubspot.com/oauth/authorize'.freeze

Class Method Summary collapse

Class Method Details

.authorize_url(client_id:, redirect_uri:, scope:, optional_scope: []) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/hubspot/oauth_helper.rb', line 5

def authorize_url(client_id:, redirect_uri:, scope:, optional_scope: [])
  query = URI.encode_www_form(
    client_id: client_id,
    redirect_uri: redirect_uri,
    scope: Array(scope),
    optional_scope: Array(optional_scope)
  )

  "#{AUTHORIZE_URL}?#{query}"
end