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

Parameters:

  • options (Hash) (defaults to: {})

    Client options

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:



96
97
98
99
100
101
# File 'lib/basecrm.rb', line 96

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.



77
78
79
# File 'lib/basecrm.rb', line 77

def config
  @config
end

#http_clientObject (readonly)

Returns the value of attribute http_client.



78
79
80
# File 'lib/basecrm.rb', line 78

def http_client
  @http_client
end

Instance Method Details

#accountsAccountsService

Access all Accounts related actions.

Returns:

See Also:



108
109
110
# File 'lib/basecrm.rb', line 108

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

#associated_contactsAssociatedContactsService

Access all AssociatedContacts related actions.

Returns:

See Also:



117
118
119
# File 'lib/basecrm.rb', line 117

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

#call_outcomesCallOutcomesService

Access all CallOutcomes related actions.

Returns:

See Also:



135
136
137
# File 'lib/basecrm.rb', line 135

def call_outcomes
  @call_outcomes ||= CallOutcomesService.new(@http_client)
end

#callsCallsService

Access all Calls related actions.

Returns:

See Also:



126
127
128
# File 'lib/basecrm.rb', line 126

def calls
  @calls ||= CallsService.new(@http_client)
end

#contactsContactsService

Access all Contacts related actions.

Returns:

See Also:



144
145
146
# File 'lib/basecrm.rb', line 144

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

#deal_sourcesDealSourcesService

Access all DealSources related actions.

Returns:

See Also:



162
163
164
# File 'lib/basecrm.rb', line 162

def deal_sources
  @deal_sources ||= DealSourcesService.new(@http_client)
end

#deal_unqualified_reasonsDealUnqualifiedReasonsService

Access all DealUnqualifiedReasons related actions.

Returns:

See Also:



171
172
173
# File 'lib/basecrm.rb', line 171

def deal_unqualified_reasons
  @deal_unqualified_reasons ||= DealUnqualifiedReasonsService.new(@http_client)
end

#dealsDealsService

Access all Deals related actions.

Returns:

See Also:



153
154
155
# File 'lib/basecrm.rb', line 153

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

#lead_sourcesLeadSourcesService

Access all LeadSources related actions.

Returns:

See Also:



189
190
191
# File 'lib/basecrm.rb', line 189

def lead_sources
  @lead_sources ||= LeadSourcesService.new(@http_client)
end

#lead_unqualified_reasonsLeadUnqualifiedReasonsService

Access all LeadUnqualifiedReasons related actions.

Returns:

See Also:



198
199
200
# File 'lib/basecrm.rb', line 198

def lead_unqualified_reasons
  @lead_unqualified_reasons ||= LeadUnqualifiedReasonsService.new(@http_client)
end

#leadsLeadsService

Access all Leads related actions.

Returns:

See Also:



180
181
182
# File 'lib/basecrm.rb', line 180

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

#line_itemsLineItemsService

Access all LineItems related actions.

Returns:

See Also:



207
208
209
# File 'lib/basecrm.rb', line 207

def line_items
  @line_items ||= LineItemsService.new(@http_client)
end

#loss_reasonsLossReasonsService

Access all LossReasons related actions.

Returns:

See Also:



216
217
218
# File 'lib/basecrm.rb', line 216

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

#notesNotesService

Access all Notes related actions.

Returns:

See Also:



225
226
227
# File 'lib/basecrm.rb', line 225

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

#ordersOrdersService

Access all Orders related actions.

Returns:

See Also:



234
235
236
# File 'lib/basecrm.rb', line 234

def orders
  @orders ||= OrdersService.new(@http_client)
end

#pipelinesPipelinesService

Access all Pipelines related actions.

Returns:

See Also:



243
244
245
# File 'lib/basecrm.rb', line 243

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

#productsProductsService

Access all Products related actions.

Returns:

See Also:



252
253
254
# File 'lib/basecrm.rb', line 252

def products
  @products ||= ProductsService.new(@http_client)
end

#sourcesSourcesService

Access all Sources related actions.

Returns:

See Also:



261
262
263
# File 'lib/basecrm.rb', line 261

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

#stagesStagesService

Access all Stages related actions.

Returns:

See Also:



270
271
272
# File 'lib/basecrm.rb', line 270

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

#syncSyncService

Access Sync API related low-level actions.

Returns:

See Also:



332
333
334
# File 'lib/basecrm.rb', line 332

def sync
  @sync ||= SyncService.new(@http_client)
end

#tagsTagsService

Access all Tags related actions.

Returns:

See Also:



279
280
281
# File 'lib/basecrm.rb', line 279

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

#tasksTasksService

Access all Tasks related actions.

Returns:

See Also:



288
289
290
# File 'lib/basecrm.rb', line 288

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

#text_messagesTextMessagesService

Access all TextMessages related actions.

Returns:

See Also:



297
298
299
# File 'lib/basecrm.rb', line 297

def text_messages
  @text_messages ||= TextMessagesService.new(@http_client)
end

#usersUsersService

Access all Users related actions.

Returns:

See Also:



306
307
308
# File 'lib/basecrm.rb', line 306

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

#visit_outcomesVisitOutcomesService

Access all VisitOutcomes related actions.

Returns:

See Also:



324
325
326
# File 'lib/basecrm.rb', line 324

def visit_outcomes
  @visit_outcomes ||= VisitOutcomesService.new(@http_client)
end

#visitsVisitsService

Access all Visits related actions.

Returns:

See Also:



315
316
317
# File 'lib/basecrm.rb', line 315

def visits
  @visits ||= VisitsService.new(@http_client)
end