Class: NutshellCrmAPI::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/nutshell-crm-api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(username, api_key) ⇒ Client

A new instance of the NutshellCrm client. Configure at app01.nutshell.com/setup/api-key

Parameters:

  • username (String)
  • api_key (String)

    API key



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/nutshell-crm-api.rb', line 24

def initialize(username, api_key)
  @username = username
  @api_key = api_key
  @stub_responses = nil

  params ={username: @username}
  payload = build_payload(params)
  result = exec_request(payload, 'http://api.nutshell.com/v1/json')
  api_host = result['api']
  @api_url = "https://#{api_host}/api/v1/json"
end

Instance Attribute Details

#api_urlObject

Returns the value of attribute api_url.



10
11
12
# File 'lib/nutshell-crm-api.rb', line 10

def api_url
  @api_url
end

#stub_responsesObject

Global setting for stubResponses parameter.



13
14
15
# File 'lib/nutshell-crm-api.rb', line 13

def stub_responses
  @stub_responses
end

Instance Method Details

#add(num1, num2) ⇒ Object

For testing.



37
38
39
40
41
# File 'lib/nutshell-crm-api.rb', line 37

def add(num1, num2)
  params = {num1: num1, num2: num2}
  payload = build_payload(params)
  exec_request(payload)
end

#delete_account(account_id, rev) ⇒ Object

Delete an account.



44
45
46
47
48
# File 'lib/nutshell-crm-api.rb', line 44

def (, rev)
  params = {accountId: , rev: rev}
  payload = build_payload params
  exec_request(payload)
end

#delete_activity(activity_id, rev) ⇒ Object

Delete an activity.



51
52
53
54
55
# File 'lib/nutshell-crm-api.rb', line 51

def delete_activity(activity_id, rev)
    params = {activityId: activity_id, rev: rev}
    payload = build_payload params
    exec_request(payload)
end

#delete_contact(contact_id, rev) ⇒ Object

Delete a contact.



58
59
60
61
62
# File 'lib/nutshell-crm-api.rb', line 58

def delete_contact(contact_id, rev)
    params = {contactId: contact_id, rev: rev}
    payload = build_payload params
    exec_request(payload)
end

#delete_lead(lead_id, rev) ⇒ Object

Delete a lead.



65
66
67
68
69
# File 'lib/nutshell-crm-api.rb', line 65

def delete_lead(lead_id, rev)
    params = {leadId: activity_id, rev: rev}
    payload = build_payload params
    exec_request(payload)
end

#delete_note(note_id, rev) ⇒ Object

Deletes the given note.



72
73
74
75
76
# File 'lib/nutshell-crm-api.rb', line 72

def delete_note(note_id, rev)
    params = {noteId: activity_id, rev: rev}
    payload = build_payload params
    exec_request(payload)
end

#delete_product(product_id, rev) ⇒ Object

Delete a product.



79
80
81
82
83
# File 'lib/nutshell-crm-api.rb', line 79

def delete_product(product_id, rev)
    params = {productId: product_id, rev: rev}
    payload = build_payload params
    exec_request(payload)
end

#delete_task(task_id, rev) ⇒ Object

Delete a task.



86
87
88
89
90
# File 'lib/nutshell-crm-api.rb', line 86

def delete_task(task_id, rev)
    params = {taskId: task_id, rev: rev}
    payload = build_payload params
    exec_request(payload)
end

#delete_team(team_id, rev) ⇒ Object

Delete a team.



93
94
95
96
97
# File 'lib/nutshell-crm-api.rb', line 93

def delete_team(team_id, rev)
    params = {teamId: team_id, rev: rev}
    payload = build_payload params
    exec_request(payload)
end

#delete_user(user_id, rev) ⇒ Object

Delete a user.



100
101
102
103
104
# File 'lib/nutshell-crm-api.rb', line 100

def delete_user(user_id, rev)
    params = {userId: user_id, rev: rev}
    payload = build_payload params
    exec_request(payload)
end

#edit_account(account_id, rev, account) ⇒ Object

Edit an account.



107
108
109
110
111
# File 'lib/nutshell-crm-api.rb', line 107

def (, rev, )
  params = {accountId: , rev: rev, account: }
  payload = build_payload params
  exec_request(payload)
end

#edit_activity(activity_id, rev, activity) ⇒ Object

Edit an activity.



114
115
116
117
118
# File 'lib/nutshell-crm-api.rb', line 114

def edit_activity(activity_id, rev, activity)
  params = {activityId: activity_id, rev: rev, activity: activity}
  payload = build_payload(params)
  exec_request(payload)
end

#edit_contact(contact_id, rev, contact) ⇒ Object

Edit a contact.



121
122
123
124
125
# File 'lib/nutshell-crm-api.rb', line 121

def edit_contact(contact_id, rev, contact)
  params = {contactId: contact_id, rev: rev, contact: contact}
  payload = build_payload(params)
  exec_request(payload)
end

#edit_lead(lead_id, rev, lead) ⇒ Object

Edit a lead.



128
129
130
131
132
# File 'lib/nutshell-crm-api.rb', line 128

def edit_lead(lead_id, rev, lead)
  params = {leadId: lead_id, rev: rev, lead: lead}
  payload = build_payload(params)
  exec_request(payload)
end

#edit_note(note_id, rev, note) ⇒ Object

Edits the given note (note that notes can only be edited for 24 hours by the note author)



136
137
138
139
140
# File 'lib/nutshell-crm-api.rb', line 136

def edit_note(note_id, rev, note)
  params = {noteId: note_id, rev: rev, note: note}
  payload = build_payload(params)
  exec_request(payload)
end

#edit_product(product_id, rev, product) ⇒ Object

Edit a product.



143
144
145
146
147
# File 'lib/nutshell-crm-api.rb', line 143

def edit_product(product_id, rev, product)
  params = {productId: product_id, rev: rev, product: product}
  payload = build_payload(params)
  exec_request(payload)
end

#edit_step(step_id, rev, step) ⇒ Object

Update a process step.



150
151
152
153
154
# File 'lib/nutshell-crm-api.rb', line 150

def edit_step(step_id, rev, step)
  params = {stepId: step_id, rev: rev, step: step}
  payload = build_payload(params)
  exec_request(payload)
end

#edit_task(task_id, rev, task) ⇒ Object

Edit a task.



157
158
159
160
161
# File 'lib/nutshell-crm-api.rb', line 157

def edit_task(task_id, rev, task)
  params = {taskId: task_id, rev: rev, task: task}
  payload = build_payload(params)
  exec_request(payload)
end

#edit_team(team_id, rev, team) ⇒ Object

Edit a team.



164
165
166
167
168
# File 'lib/nutshell-crm-api.rb', line 164

def edit_team(team_id, rev, team)
  params = {teamId: team_id, rev: rev, team: team}
  payload = build_payload(params)
  exec_request(payload)
end

#edit_user(user_id, rev, user) ⇒ Object

Edit a user.



171
172
173
174
175
# File 'lib/nutshell-crm-api.rb', line 171

def edit_user(user_id, rev, user)
  params = {userId: user_id, rev: rev, user: user}
  payload = build_payload(params)
  exec_request(payload)
end

#find_account_types(order_by = nil, order_direction = nil, limit = nil, page = nil) ⇒ Object

Get all active account types (to be applied to an account).



186
187
188
189
190
# File 'lib/nutshell-crm-api.rb', line 186

def (order_by = nil, order_direction = nil, limit = nil, page = nil)
  params = {orderBy: order_by, orderDirection: order_direction, limit: limit, page: page}
  payload = build_payload(params)
  exec_request(payload)
end

#find_accounts(query, order_by = nil, order_direction = nil, limit = nil, page = nil, stub_responses = nil) ⇒ Object

Find accounts matching a specified query.



179
180
181
182
183
# File 'lib/nutshell-crm-api.rb', line 179

def find_accounts(query, order_by = nil, order_direction = nil, limit = nil, page = nil, stub_responses = nil)
  params = {query: query, orderBy: order_by, orderDirection: order_direction, limit: limit, page: page, stubResponses: stub_responses}
  payload = build_payload(params)
  exec_request(payload)
end

#find_activities(query, order_by = nil, order_direction = nil, limit = nil, page = nil, stub_responses = nil) ⇒ Object

Find activities matching a specified query.



193
194
195
196
197
# File 'lib/nutshell-crm-api.rb', line 193

def find_activities(query, order_by = nil, order_direction = nil, limit = nil, page = nil, stub_responses = nil)
  params = {query: query, orderBy: order_by, orderDirection: order_direction, limit: limit, page: page, stubResponses: stub_responses}
  payload = build_payload(params)
  exec_request(payload)
end

#find_activity_types(order_by = nil, order_direction = nil, limit = nil, page = nil) ⇒ Object

Get all active activity types.



200
201
202
203
204
# File 'lib/nutshell-crm-api.rb', line 200

def find_activity_types(order_by = nil, order_direction = nil, limit = nil, page = nil)
  params = {orderBy: order_by, orderDirection: order_direction, limit: limit, page: page}
  payload = build_payload(params)
  exec_request(payload)
end

#find_backupsObject

List available and running backups.



207
208
209
# File 'lib/nutshell-crm-api.rb', line 207

def find_backups
  exec_request build_payload
end

#find_competitors(order_by = nil, order_direction = nil, limit = nil, page = nil) ⇒ Object

Returns stubs for all active Competitors.



212
213
214
215
216
# File 'lib/nutshell-crm-api.rb', line 212

def find_competitors(order_by = nil, order_direction = nil, limit = nil, page = nil)
  params = {orderBy: order_by, orderDirection: order_direction, limit: limit, page: page}
  payload = build_payload(params)
  exec_request(payload)
end

#find_contacts(query, order_by = nil, order_direction = nil, limit = nil, page = nil, stub_responses = nil) ⇒ Object

Find contacts associated with a specified account or lead.



219
220
221
222
223
# File 'lib/nutshell-crm-api.rb', line 219

def find_contacts(query, order_by = nil, order_direction = nil, limit = nil, page = nil, stub_responses = nil)
  params = {query: query, orderBy: order_by, orderDirection: order_direction, limit: limit, page: page, stubResponses: stub_responses}
  payload = build_payload(params)
  exec_request(payload)
end

#find_custom_fieldsObject

Gets all of the custom fields available for Leads, Accounts and Contacts, including appropriate meta-information.



227
228
229
# File 'lib/nutshell-crm-api.rb', line 227

def find_custom_fields
  exec_request(build_payload)
end

#find_delays(order_by = nil, order_direction = nil, limit = nil, page = nil) ⇒ Object

Returns stubs for all active Delays (seen in Step responses in availableDelayIds)



233
234
235
236
237
# File 'lib/nutshell-crm-api.rb', line 233

def find_delays(order_by = nil, order_direction = nil, limit = nil, page = nil)
  params = {orderBy: order_by, orderDirection: order_direction, limit: limit, page: page}
  payload = build_payload(params)
  exec_request(payload)
end

#find_industries(order_by = nil, order_direction = nil, limit = nil, page = nil) ⇒ Object

Returns stubs for all active Industries (to be applied to an account)



240
241
242
243
244
# File 'lib/nutshell-crm-api.rb', line 240

def find_industries(order_by = nil, order_direction = nil, limit = nil, page = nil)
  params = {orderBy: order_by, orderDirection: order_direction, limit: limit, page: page}
  payload = build_payload(params)
  exec_request(payload)
end

#find_lead_outcomes(order_by = nil, order_direction = nil, limit = nil, page = nil) ⇒ Object

Get all possible outcomes for a closed lead.



247
248
249
250
251
# File 'lib/nutshell-crm-api.rb', line 247

def find_lead_outcomes(order_by = nil, order_direction = nil, limit = nil, page = nil)
  params = {orderBy: order_by, orderDirection: order_direction, limit: limit, page: page}
  payload = build_payload(params, 'findLead_Outcomes')
  exec_request(payload)
end

#find_leads(query, order_by = nil, order_direction = nil, limit = nil, page = nil, stub_responses = nil) ⇒ Object

Find leads matching a specified query.



254
255
256
257
258
# File 'lib/nutshell-crm-api.rb', line 254

def find_leads(query, order_by = nil, order_direction = nil, limit = nil, page = nil, stub_responses = nil)
  params = {query: query, orderBy: order_by, orderDirection: order_direction, limit: limit, page: page, stubResponses: stub_responses}
  payload = build_payload(params)
  exec_request(payload)
end

#find_markets(order_by = nil, order_direction = nil, limit = nil, page = nil) ⇒ Object

Returns stubs for all active Markets.



261
262
263
264
265
# File 'lib/nutshell-crm-api.rb', line 261

def find_markets(order_by = nil, order_direction = nil, limit = nil, page = nil)
  params = {orderBy: order_by, orderDirection: order_direction, limit: limit, page: page}
  payload = build_payload(params)
  exec_request(payload)
end

#find_milestones(order_by = nil, order_direction = nil, limit = nil, page = nil) ⇒ Object

Get all active milestones.



268
269
270
271
272
# File 'lib/nutshell-crm-api.rb', line 268

def find_milestones(order_by = nil, order_direction = nil, limit = nil, page = nil)
  params = {orderBy: order_by, orderDirection: order_direction, limit: limit, page: page}
  payload = build_payload(params)
  exec_request(payload)
end

#find_origins(order_by = nil, order_direction = nil, limit = nil, page = nil) ⇒ Object

Returns stubs for all active Origins.



275
276
277
278
279
# File 'lib/nutshell-crm-api.rb', line 275

def find_origins(order_by = nil, order_direction = nil, limit = nil, page = nil)
  params = {orderBy: order_by, orderDirection: order_direction, limit: limit, page: page}
  payload = build_payload(params)
  exec_request(payload)
end

#find_processes(query) ⇒ Object

Finds all processes associated with an entity.



282
283
284
285
286
# File 'lib/nutshell-crm-api.rb', line 282

def find_processes(query)
  params = {query: query}
  payload = build_payload(params)
  exec_request(payload)
end

#find_products(order_by = nil, order_direction = nil, limit = nil, page = nil, stub_responses = nil) ⇒ Object

Get all active products.



289
290
291
292
293
# File 'lib/nutshell-crm-api.rb', line 289

def find_products(order_by = nil, order_direction = nil, limit = nil, page = nil, stub_responses = nil)
  params = {orderBy: order_by, orderDirection: order_direction, limit: limit, page: page, stubResponses: stub_responses}
  payload = build_payload(params)
  exec_request(payload)
end

#find_settings(order_by = nil, order_direction = nil, limit = nil, page = nil) ⇒ Object

Return all publicly-visible settings.



296
297
298
299
300
# File 'lib/nutshell-crm-api.rb', line 296

def find_settings(order_by = nil, order_direction = nil, limit = nil, page = nil)
  params = {orderBy: order_by, orderDirection: order_direction, limit: limit, page: page}
  payload = build_payload(params)
  exec_request(payload)
end

#find_sources(order_by = nil, order_direction = nil, limit = nil, page = nil) ⇒ Object

Returns stubs for all active Sources.



303
304
305
306
307
# File 'lib/nutshell-crm-api.rb', line 303

def find_sources(order_by = nil, order_direction = nil, limit = nil, page = nil)
  params = {orderBy: order_by, orderDirection: order_direction, limit: limit, page: page}
  payload = build_payload(params)
  exec_request(payload)
end

#find_tagsObject

Get all active tags.



310
311
312
# File 'lib/nutshell-crm-api.rb', line 310

def find_tags
  exec_request(build_payload)
end

#find_tasks(query) ⇒ Object

Returns an array containing tasks for the given query.



315
316
317
318
319
# File 'lib/nutshell-crm-api.rb', line 315

def find_tasks(query)
  params = {query: query}
  payload = build_payload(params)
  exec_request(payload)
end

#find_teams(order_by = nil, order_direction = nil, limit = nil, page = nil) ⇒ Object

Get all active Teams.



322
323
324
325
326
# File 'lib/nutshell-crm-api.rb', line 322

def find_teams(order_by = nil, order_direction = nil, limit = nil, page = nil)
  params = {orderBy: order_by, orderDirection: order_direction, limit: limit, page: page}
  payload = build_payload(params)
  exec_request(payload)
end

#find_territories(order_by = nil, order_direction = nil, limit = nil, page = nil) ⇒ Object

Get all territories.



329
330
331
332
333
# File 'lib/nutshell-crm-api.rb', line 329

def find_territories(order_by = nil, order_direction = nil, limit = nil, page = nil)
  params = {orderBy: order_by, orderDirection: order_direction, limit: limit, page: page}
  payload = build_payload(params)
  exec_request(payload)
end

#find_timeline(query, order_by = nil, order_direction = nil, limit = nil, page = nil, stub_responses = nil) ⇒ Object

Find timeline events (Activities, Emails and Notes) for an Entity.



336
337
338
339
340
# File 'lib/nutshell-crm-api.rb', line 336

def find_timeline(query, order_by = nil, order_direction = nil, limit = nil, page = nil, stub_responses = nil)
  params = {query: query, orderBy: order_by, orderDirection: order_direction, limit: limit, page: page, stubResponses: stub_responses}
  payload = build_payload(params)
  exec_request(payload)
end

#find_users(order_by = nil, order_direction = nil, limit = nil, page = nil) ⇒ Object

Find users matching a specified query.



343
344
345
346
347
# File 'lib/nutshell-crm-api.rb', line 343

def find_users(order_by = nil, order_direction = nil, limit = nil, page = nil)
  params = {orderBy: order_by, orderDirection: order_direction, limit: limit, page: page}
  payload = build_payload(params)
  exec_request(payload)
end

#get_account(account_id, rev = nil) ⇒ Object

Get the specified Account.



350
351
352
353
# File 'lib/nutshell-crm-api.rb', line 350

def (, rev = nil)
  params = {accountId: , rev: rev}
  exec_request build_payload(params)
end

#get_activity(activity_id, rev = nil) ⇒ Object

Get the specified Activity.



356
357
358
359
# File 'lib/nutshell-crm-api.rb', line 356

def get_activity(activity_id, rev = nil)
  params = {activityId: activity_id, rev: rev}
  exec_request build_payload(params)
end

#get_contact(contact_id, rev = nil) ⇒ Object

Get the specified Contact.



368
369
370
371
# File 'lib/nutshell-crm-api.rb', line 368

def get_contact(contact_id, rev = nil)
  params = {contactId: contact_id, rev: rev}
  exec_request build_payload(params)
end

#get_email(email_id, rev = nil) ⇒ Object

Get the specified Email.



374
375
376
377
# File 'lib/nutshell-crm-api.rb', line 374

def get_email(email_id, rev = nil)
  params = {emailId: email_id, rev: rev}
  exec_request build_payload(params)
end

#get_lead(lead_id, rev = nil) ⇒ Object

Get the specified Lead.



380
381
382
383
# File 'lib/nutshell-crm-api.rb', line 380

def get_lead(lead_id, rev = nil)
  params = {leadId: lead_id, rev: rev}
  exec_request build_payload(params)
end

#get_note(note_id, rev = nil) ⇒ Object

Get the specified Note.



386
387
388
389
# File 'lib/nutshell-crm-api.rb', line 386

def get_note(note_id, rev = nil)
  params = {noteId: note_id, rev: rev}
  exec_request build_payload(params)
end

#get_product(product_id, rev = nil) ⇒ Object

Get all information for a product (including full price list).



392
393
394
395
# File 'lib/nutshell-crm-api.rb', line 392

def get_product(product_id, rev = nil)
  params = {productId: product_id, rev: rev}
  exec_request build_payload(params)
end

#get_task(team_id, rev = nil) ⇒ Object

Get the specified Team.



398
399
400
401
# File 'lib/nutshell-crm-api.rb', line 398

def get_task(task_id, rev = nil)
  params = {taskId: task_id, rev: rev}
  exec_request build_payload(params)
end

#get_update_timesObject

Gets the last-updated times of each of the provisioning bins.



410
411
412
# File 'lib/nutshell-crm-api.rb', line 410

def get_update_times
  exec_request(build_payload)
end

#get_user(user_id = nil, rev = nil) ⇒ Object

Get all info about a user.



415
416
417
418
# File 'lib/nutshell-crm-api.rb', line 415

def get_user(user_id = nil, rev = nil)
  params = {userId: user_id, rev: rev}
  exec_request build_payload(params)
end

#getAnalyticsReport(report_type, period, filter_entity = nil, options = nil) ⇒ Object

Returns graph data and overview information for various sales analytics reports.



362
363
364
365
# File 'lib/nutshell-crm-api.rb', line 362

def getAnalyticsReport(report_type, period, filter_entity = nil, options = nil)
  params = {reportType: report_type, period: period, filter: filter_entity, options: options}
  exec_request build_payload(params)
end

#instance_dataObject

Return data related to authenticated Nutshell instance.



421
422
423
# File 'lib/nutshell-crm-api.rb', line 421

def instance_data
  exec_request(build_payload)
end

#new_account(account) ⇒ Object

Create a new account.



426
427
428
429
430
# File 'lib/nutshell-crm-api.rb', line 426

def ()
  params = {account: }
  payload = build_payload(params)
  exec_request(payload)
end

#new_activity(activity) ⇒ Object

Create a new activity.



433
434
435
436
437
# File 'lib/nutshell-crm-api.rb', line 433

def new_activity(activity)
  params = {activity: activity}
  payload = build_payload(params)
  exec_request(payload)
end

#new_backupObject

Initiate downloadable backup.



440
441
442
# File 'lib/nutshell-crm-api.rb', line 440

def new_backup
  exec_request(build_payload)
end

#new_contact(contact) ⇒ Object

Create a new Contact.



445
446
447
448
449
# File 'lib/nutshell-crm-api.rb', line 445

def new_contact(contact)
  params = {contact: contact}
  payload = build_payload(params)
  exec_request(payload)
end

#new_email(emailString) ⇒ Object

Saves the given e-mail message.



452
453
454
455
456
# File 'lib/nutshell-crm-api.rb', line 452

def new_email(emailString)
  params = {emailString: emailString}
  payload = build_payload(params)
  exec_request(payload)
end

#new_lead(lead) ⇒ Object

Create a new Lead.



459
460
461
462
463
# File 'lib/nutshell-crm-api.rb', line 459

def new_lead(lead)
  params = {lead: lead}
  payload = build_payload(params)
  exec_request(payload)
end

#new_note(entity, note) ⇒ Object

Adds the note to the given entity.



466
467
468
469
470
# File 'lib/nutshell-crm-api.rb', line 466

def new_note(entity, note)
  params = {entity: entity, note: note}
  payload = build_payload(params)
  exec_request(payload)
end

#new_product(product) ⇒ Object

Create a new product.



473
474
475
476
477
# File 'lib/nutshell-crm-api.rb', line 473

def new_product(product)
  params = {product: product}
  payload = build_payload(params)
  exec_request(payload)
end

#new_source(name) ⇒ Object

Given a source name, fetches an existing source or creates a new one if it does not exist.



481
482
483
484
485
# File 'lib/nutshell-crm-api.rb', line 481

def new_source(name)
  params = {name: name}
  payload = build_payload(params)
  exec_request(payload)
end

#new_tag(tag) ⇒ Object

Create a new tag.



488
489
490
491
492
# File 'lib/nutshell-crm-api.rb', line 488

def new_tag(tag)
  params = {tag: tag}
  payload = build_payload(params)
  exec_request(payload)
end

#new_task(task) ⇒ Object

Create a new Task.



495
496
497
498
499
# File 'lib/nutshell-crm-api.rb', line 495

def new_task(task)
  params = {task: task}
  payload = build_payload(params)
  exec_request(payload)
end

#new_team(team) ⇒ Object

Create a new Team.



502
503
504
505
506
# File 'lib/nutshell-crm-api.rb', line 502

def new_team(team)
  params = {team: team}
  payload = build_payload(params)
  exec_request(payload)
end

#new_user(user) ⇒ Object

Create a new User.



509
510
511
512
513
# File 'lib/nutshell-crm-api.rb', line 509

def new_user(user)
  params = {user: user}
  payload = build_payload(params)
  exec_request(payload)
end

#search_accounts(query, limit = nil) ⇒ Object

Return a list of Account stubs matching a given search string.



516
517
518
519
520
# File 'lib/nutshell-crm-api.rb', line 516

def search_accounts(query, limit = nil)
  params = {string: query, limit: limit}
  payload = build_payload(params)
  exec_request(payload)
end

#search_activity_participants(query, limit = nil) ⇒ Object

Return a list of stubs matching a given search string for all entities that could be participants in an Activity.



524
525
526
527
528
# File 'lib/nutshell-crm-api.rb', line 524

def search_activity_participants(query, limit = nil)
  params = {string: query, limit: limit}
  payload = build_payload(params)
  exec_request(payload)
end

#search_by_email(email_address) ⇒ Object

Works just like searchUniversal, but only searches by email address.



531
532
533
534
535
# File 'lib/nutshell-crm-api.rb', line 531

def search_by_email(email_address)
  params = {emailAddressString: email_address}
  payload = build_payload(params)
  exec_request(payload)
end

#search_competitors(query, limit = nil) ⇒ Object

Return a list of Competitor stubs matching a given search string.



538
539
540
541
542
# File 'lib/nutshell-crm-api.rb', line 538

def search_competitors(query, limit = nil)
  params = {string: query, limit: limit}
  payload = build_payload(params)
  exec_request(payload)
end

#search_contacts(query, limit = nil) ⇒ Object

Return a list of Contact stubs matching a given search string.



545
546
547
548
549
# File 'lib/nutshell-crm-api.rb', line 545

def search_contacts(query, limit = nil)
  params = {string: query, limit: limit}
  payload = build_payload(params)
  exec_request(payload)
end

#search_contacts_and_users(query, limit = nil) ⇒ Object

Return a list of Contact and User stubs matching a given search string.



552
553
554
555
556
# File 'lib/nutshell-crm-api.rb', line 552

def search_contacts_and_users(query, limit = nil)
  params = {string: query, limit: limit}
  payload = build_payload(params)
  exec_request(payload)
end

#search_leads(query, limit = nil) ⇒ Object

Return a list of Lead stubs matching a given search string.



559
560
561
562
563
# File 'lib/nutshell-crm-api.rb', line 559

def search_leads(query, limit = nil)
  params = {string: query, limit: limit}
  payload = build_payload(params)
  exec_request(payload)
end

#search_mentionable_entities(query, entityType, entityId, knownLocalEntities, limit = nil) ⇒ Object

Returns an array of mentionable entities matching the string, but excluding any that the client already knows about, as indicated by knownLocalResults.



568
569
570
571
572
# File 'lib/nutshell-crm-api.rb', line 568

def search_mentionable_entities(query, entityType, entityId, knownLocalEntities, limit = nil)
  params = {string: query, entityType: entityType, entityId: entityId, knownLocalEntities: knownLocalEntities, limit: limit}
  payload = build_payload(params)
  exec_request(payload)
end

#search_products(query, limit = nil) ⇒ Object

Return a list of Product stubs matching a given search string.



575
576
577
578
579
# File 'lib/nutshell-crm-api.rb', line 575

def search_products(query, limit = nil)
  params = {string: query, limit: limit}
  payload = build_payload(params)
  exec_request(payload)
end

#search_sources(query, limit = nil) ⇒ Object

Return a list of Source stubs matching a given search string.



582
583
584
585
586
# File 'lib/nutshell-crm-api.rb', line 582

def search_sources(query, limit = nil)
  params = {string: query, limit: limit}
  payload = build_payload(params)
  exec_request(payload)
end

#search_universal(query) ⇒ Object

Return a list of Contact, Lead, and Account stubs matching a given search string.



589
590
591
592
593
# File 'lib/nutshell-crm-api.rb', line 589

def search_universal(query)
  params = {string: query}
  payload = build_payload(params)
  exec_request(payload)
end

#search_users_and_teams(query, limit = nil) ⇒ Object

Return a list of User and Team stubs matching a given search string.



596
597
598
599
600
# File 'lib/nutshell-crm-api.rb', line 596

def search_users_and_teams(query, limit = nil)
  params = {string: query, limit: limit}
  payload = build_payload(params)
  exec_request(payload)
end