Class: Hubspot

Inherits:
Object
  • Object
show all
Includes:
Companies, Constants, Contacts, ErrorHandler
Defined in:
lib/ruby_hubspot/hubspot.rb

Overview

Hubspot main controls and regulate all methods and constants

Constant Summary

Constants included from Constants

Constants::ALL_COMPANIES, Constants::ALL_CONTACTS, Constants::ALL_DEALS, Constants::ALL_SUBMITIONS, Constants::API_URL, Constants::AUTHORIZATION_KEY, Constants::CONTENT_TYPE, Constants::CREATE_OR_UPDATE, Constants::DELETE, Constants::EMAIL, Constants::GET, Constants::INDIVIDUAL_COMPANY, Constants::INDIVIDUAL_CONTACT, Constants::INDIVIDUAL_DEAL, Constants::INDIVIDUAL_SUB, Constants::PATCH, Constants::POST, Constants::PROFILE, Constants::PUT, Constants::VID

Constants included from ErrorHandler

ErrorHandler::ACCESS_TOKEN_ERROR, ErrorHandler::EMAIL_ERROR, ErrorHandler::IDENTIFICATOR_ERROR, ErrorHandler::ID_ERROR

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Companies

#all_companies, #create_company, #delete_company, #individual_company_path, #show_company, #update_company

Methods included from Contacts

#all_contacts, #create_contact, #create_or_update_contact, #delete_contact, #find_idintificator, #show_contact, #update_contact

Constructor Details

#initialize(access_token:) ⇒ Hubspot

initializes Hubspot with access token



19
20
21
# File 'lib/ruby_hubspot/hubspot.rb', line 19

def initialize(access_token:)
  @access_token = access_token
end

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



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

def access_token
  @access_token
end

Instance Method Details

#request(http_method, path, **params) ⇒ Object

sends a request to Hubspot with access token and params



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

def request(http_method, path, **params)
  validate_access_token

  response(http_method, path, params)
end