16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/hubspot/config.rb', line 16
def configure(config)
config.stringify_keys!
@hapikey = config['hapikey']
@base_url = config['base_url'] || DEFAULT_BASE_URL
@portal_id = config['portal_id']
@logger = config['logger'] || DEFAULT_LOGGER
@access_token = config['access_token']
@client_id = config['client_id'] if config['client_id'].present?
@client_secret = config['client_secret'] if config['client_secret'].present?
@redirect_uri = config['redirect_uri'] if config['redirect_uri'].present?
@read_timeout = config['read_timeout'] || config['timeout']
@open_timeout = config['open_timeout'] || config['timeout']
@custom_event_prefix = config['custom_event_prefix']
unless authentication_uncertain?
raise Hubspot::ConfigurationError.new("You must provide either an access_token or an hapikey")
end
if hapikey.present?
Hubspot::Deprecator.build.deprecation_warning("hapikey", "please use access_token instead. See https://developers.hubspot.com/docs/api/migrate-an-api-key-integration-to-a-private-app")
end
if access_token.present?
Hubspot::Connection.("Authorization" => "Bearer #{access_token}")
end
self
end
|