Module: Hubspot

Extended by:
Forwardable
Defined in:
lib/hubspot.rb,
lib/hubspot/form.rb,
lib/hubspot/user.rb,
lib/hubspot/batch.rb,
lib/hubspot/config.rb,
lib/hubspot/company.rb,
lib/hubspot/contact.rb,
lib/hubspot/version.rb,
lib/hubspot/property.rb,
lib/hubspot/resource.rb,
lib/hubspot/api_client.rb,
lib/hubspot/exceptions.rb,
lib/hubspot/paged_batch.rb,
lib/hubspot/resource_filter.rb,
lib/hubspot/paged_collection.rb

Overview

The main hubspot module

Defined Under Namespace

Modules: ResourceFilter Classes: ApiClient, ArgumentError, Batch, BatchResponse, Company, Config, Contact, Form, NotConfiguredError, NotFoundError, NotImplementedError, NothingToDoError, OauthScopeError, PagedBatch, PagedCollection, Property, RateLimitExceededError, RequestError, Resource, User

Constant Summary collapse

Owner =
User
VERSION =
'0.3.3'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject



15
16
17
# File 'lib/hubspot.rb', line 15

def config
  @config ||= Config.new
end

Class Method Details

.configure {|config| ... } ⇒ Object

Yields:



19
20
21
22
23
24
# File 'lib/hubspot.rb', line 19

def configure
  yield(config) if block_given?
  set_client_headers if config.access_token
  set_request_timeouts
  config.apply_log_level
end

.configured?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/hubspot.rb', line 26

def configured?
  true unless @config.nil?
end

.error_from_response(response) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/hubspot/exceptions.rb', line 28

def error_from_response(response)
  return NotFoundError.new(response) if response.not_found?
  return RateLimitExceededError.new(response) if response.code == 429

  case response.body
  when /MISSING_SCOPES/, /You do not have permissions/i
    OauthScopeError.new(response, 'Private app missing required scopes')
  else
    RequestError.new(response)
  end
end