Class: BaseCRM::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Client

Instantiate a new BaseCRM API V2 client

Options Hash (options):

  • :access_token (String)

    Personal access token

  • :base_url (String) — default: https://api.getbase.com

    Base url for the api

  • :use_agent (String) — default: BaseCRM/v2 Ruby/{Version}

    Client user agent

  • :timeout (Integer) — default: 30

    Request timeout

  • :verbose (Boolean) — default: false

    Verbose/debug mode

  • :logger (Logger) — default: STDOUT

    Logged used in verbose mode

Raises:


62
63
64
65
66
67
# File 'lib/basecrm.rb', line 62

def initialize(options={})
  @config = Configuration.new(options)
  @config.validate!

  @http_client = HttpClient.new(@config)
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config


43
44
45
# File 'lib/basecrm.rb', line 43

def config
  @config
end

#http_clientObject (readonly)

Returns the value of attribute http_client


44
45
46
# File 'lib/basecrm.rb', line 44

def http_client
  @http_client
end

Instance Method Details

#accountsAccountsService

Access all Accounts related actions.


74
75
76
# File 'lib/basecrm.rb', line 74

def accounts
  @accounts ||= AccountsService.new(@http_client)
end

#associated_contactsAssociatedContactsService

Access all AssociatedContacts related actions.


83
84
85
# File 'lib/basecrm.rb', line 83

def associated_contacts
  @associated_contacts ||= AssociatedContactsService.new(@http_client)
end

#contactsContactsService

Access all Contacts related actions.


92
93
94
# File 'lib/basecrm.rb', line 92

def contacts
  @contacts ||= ContactsService.new(@http_client)
end

#dealsDealsService

Access all Deals related actions.

See Also:


101
102
103
# File 'lib/basecrm.rb', line 101

def deals
  @deals ||= DealsService.new(@http_client)
end

#leadsLeadsService

Access all Leads related actions.

See Also:


110
111
112
# File 'lib/basecrm.rb', line 110

def leads
  @leads ||= LeadsService.new(@http_client)
end

#loss_reasonsLossReasonsService

Access all LossReasons related actions.


119
120
121
# File 'lib/basecrm.rb', line 119

def loss_reasons
  @loss_reasons ||= LossReasonsService.new(@http_client)
end

#notesNotesService

Access all Notes related actions.

See Also:


128
129
130
# File 'lib/basecrm.rb', line 128

def notes
  @notes ||= NotesService.new(@http_client)
end

#pipelinesPipelinesService

Access all Pipelines related actions.


137
138
139
# File 'lib/basecrm.rb', line 137

def pipelines
  @pipelines ||= PipelinesService.new(@http_client)
end

#sourcesSourcesService

Access all Sources related actions.


146
147
148
# File 'lib/basecrm.rb', line 146

def sources
  @sources ||= SourcesService.new(@http_client)
end

#stagesStagesService

Access all Stages related actions.

See Also:


155
156
157
# File 'lib/basecrm.rb', line 155

def stages
  @stages ||= StagesService.new(@http_client)
end

#tagsTagsService

Access all Tags related actions.

See Also:


164
165
166
# File 'lib/basecrm.rb', line 164

def tags
  @tags ||= TagsService.new(@http_client)
end

#tasksTasksService

Access all Tasks related actions.

See Also:


173
174
175
# File 'lib/basecrm.rb', line 173

def tasks
  @tasks ||= TasksService.new(@http_client)
end

#usersUsersService

Access all Users related actions.

See Also:


182
183
184
# File 'lib/basecrm.rb', line 182

def users
  @users ||= UsersService.new(@http_client)
end