Class: BombBomb::ContactsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/bombbomb/api/contacts_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ContactsApi

Returns a new instance of ContactsApi.



19
20
21
# File 'lib/bombbomb/api/contacts_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/bombbomb/api/contacts_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#add_contacts_csv(mapping_data, list_data, opts = {}) ⇒ nil

Add contacts from a CSV file. Add multiple contacts through the upload importer from a CSV file.

Parameters:

  • mapping_data

    The info sent for the contacts

  • list_data

    The info sent with the import for the list

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

    the optional parameters

Returns:

  • (nil)


29
30
31
32
# File 'lib/bombbomb/api/contacts_api.rb', line 29

def add_contacts_csv(mapping_data, list_data, opts = {})
  add_contacts_csv_with_http_info(mapping_data, list_data, opts)
  return nil
end

#add_contacts_csv_with_http_info(mapping_data, list_data, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Add contacts from a CSV file. Add multiple contacts through the upload importer from a CSV file.

Parameters:

  • mapping_data

    The info sent for the contacts

  • list_data

    The info sent with the import for the list

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

    the optional parameters

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/bombbomb/api/contacts_api.rb', line 40

def add_contacts_csv_with_http_info(mapping_data, list_data, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: ContactsApi.add_contacts_csv ..."
  end
  # verify the required parameter 'mapping_data' is set
  if @api_client.config.client_side_validation && mapping_data.nil?
    fail ArgumentError, "Missing the required parameter 'mapping_data' when calling ContactsApi.add_contacts_csv"
  end
  # verify the required parameter 'list_data' is set
  if @api_client.config.client_side_validation && list_data.nil?
    fail ArgumentError, "Missing the required parameter 'list_data' when calling ContactsApi.add_contacts_csv"
  end
  # resource path
  local_var_path = "/contacts/import_csv"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])

  # form parameters
  form_params = {}
  form_params["mappingData"] = mapping_data
  form_params["listData"] = list_data

  # http body (model)
  post_body = nil
  auth_names = ['BBOAuth2']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#add_contacts_csv\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#add_new_contact(contact_email, opts = {}) ⇒ nil

Add a contact. Add a contact to the users list.

Parameters:

  • contact_email

    Email of the new contact we are adding

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

    the optional parameters

Options Hash (opts):

  • :contact_info (String)

    The info sent for this contact

Returns:

  • (nil)


91
92
93
94
# File 'lib/bombbomb/api/contacts_api.rb', line 91

def add_new_contact(contact_email, opts = {})
  add_new_contact_with_http_info(contact_email, opts)
  return nil
end

#add_new_contact_with_http_info(contact_email, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Add a contact. Add a contact to the users list.

Parameters:

  • contact_email

    Email of the new contact we are adding

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

    the optional parameters

Options Hash (opts):

  • :contact_info (String)

    The info sent for this contact

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/bombbomb/api/contacts_api.rb', line 102

def add_new_contact_with_http_info(contact_email, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: ContactsApi.add_new_contact ..."
  end
  # verify the required parameter 'contact_email' is set
  if @api_client.config.client_side_validation && contact_email.nil?
    fail ArgumentError, "Missing the required parameter 'contact_email' when calling ContactsApi.add_new_contact"
  end
  # resource path
  local_var_path = "/contacts/"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])

  # form parameters
  form_params = {}
  form_params["contactEmail"] = contact_email
  form_params["contactInfo"] = opts[:'contact_info'] if !opts[:'contact_info'].nil?

  # http body (model)
  post_body = nil
  auth_names = ['BBOAuth2']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#add_new_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#add_new_custom_field(field_name, opts = {}) ⇒ nil

Add custom fields. Add a new custom field.

Parameters:

  • field_name

    Custom field name to be added

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

    the optional parameters

Options Hash (opts):

  • :field_type (String)

    Custom field type for the field to be added

Returns:

  • (nil)


149
150
151
152
# File 'lib/bombbomb/api/contacts_api.rb', line 149

def add_new_custom_field(field_name, opts = {})
  add_new_custom_field_with_http_info(field_name, opts)
  return nil
end

#add_new_custom_field_with_http_info(field_name, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Add custom fields. Add a new custom field.

Parameters:

  • field_name

    Custom field name to be added

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

    the optional parameters

Options Hash (opts):

  • :field_type (String)

    Custom field type for the field to be added

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/bombbomb/api/contacts_api.rb', line 160

def add_new_custom_field_with_http_info(field_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: ContactsApi.add_new_custom_field ..."
  end
  # verify the required parameter 'field_name' is set
  if @api_client.config.client_side_validation && field_name.nil?
    fail ArgumentError, "Missing the required parameter 'field_name' when calling ContactsApi.add_new_custom_field"
  end
  # resource path
  local_var_path = "/contacts/custom_fields/"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])

  # form parameters
  form_params = {}
  form_params["fieldName"] = field_name
  form_params["fieldType"] = opts[:'field_type'] if !opts[:'field_type'].nil?

  # http body (model)
  post_body = nil
  auth_names = ['BBOAuth2']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#add_new_custom_field\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#add_pasted_contacts(contact_emails, opts = {}) ⇒ nil

Add pasted contacts. Add the pasted contacts to the users list.

Parameters:

  • contact_emails

    Emails array of the new contacts we are adding

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

    the optional parameters

Options Hash (opts):

  • :list_info (String)

    Information about the lists id, recalculations on totals, consent etc

Returns:

  • (nil)


207
208
209
210
# File 'lib/bombbomb/api/contacts_api.rb', line 207

def add_pasted_contacts(contact_emails, opts = {})
  add_pasted_contacts_with_http_info(contact_emails, opts)
  return nil
end

#add_pasted_contacts_with_http_info(contact_emails, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Add pasted contacts. Add the pasted contacts to the users list.

Parameters:

  • contact_emails

    Emails array of the new contacts we are adding

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

    the optional parameters

Options Hash (opts):

  • :list_info (String)

    Information about the lists id, recalculations on totals, consent etc

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# File 'lib/bombbomb/api/contacts_api.rb', line 218

def add_pasted_contacts_with_http_info(contact_emails, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: ContactsApi.add_pasted_contacts ..."
  end
  # verify the required parameter 'contact_emails' is set
  if @api_client.config.client_side_validation && contact_emails.nil?
    fail ArgumentError, "Missing the required parameter 'contact_emails' when calling ContactsApi.add_pasted_contacts"
  end
  # resource path
  local_var_path = "/contacts/paste"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])

  # form parameters
  form_params = {}
  form_params["contactEmails"] = contact_emails
  form_params["listInfo"] = opts[:'list_info'] if !opts[:'list_info'].nil?

  # http body (model)
  post_body = nil
  auth_names = ['BBOAuth2']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#add_pasted_contacts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#c_sv_to_object(file, opts = {}) ⇒ nil

Format CSV. Format a CSV file to an object.

Parameters:

  • file

    The CSV file being uploaded

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

    the optional parameters

Returns:

  • (nil)


264
265
266
267
# File 'lib/bombbomb/api/contacts_api.rb', line 264

def c_sv_to_object(file, opts = {})
  c_sv_to_object_with_http_info(file, opts)
  return nil
end

#c_sv_to_object_with_http_info(file, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Format CSV. Format a CSV file to an object.

Parameters:

  • file

    The CSV file being uploaded

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

    the optional parameters

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'lib/bombbomb/api/contacts_api.rb', line 274

def c_sv_to_object_with_http_info(file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: ContactsApi.c_sv_to_object ..."
  end
  # verify the required parameter 'file' is set
  if @api_client.config.client_side_validation && file.nil?
    fail ArgumentError, "Missing the required parameter 'file' when calling ContactsApi.c_sv_to_object"
  end
  # resource path
  local_var_path = "/csv-to-object"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])

  # form parameters
  form_params = {}
  form_params["file"] = file

  # http body (model)
  post_body = nil
  auth_names = ['BBOAuth2']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#c_sv_to_object\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_contacts(opts = {}) ⇒ nil

Delete Contacts Delete all contacts within a list, or provide a comma separated list of contactIds to delete.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :list_id (String)

    The list of contacts to be deleted.

  • :contact_ids (String)

    comma separated list of contact ids to delete

Returns:

  • (nil)


320
321
322
323
# File 'lib/bombbomb/api/contacts_api.rb', line 320

def delete_contacts(opts = {})
  delete_contacts_with_http_info(opts)
  return nil
end

#delete_contacts_with_http_info(opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Delete Contacts Delete all contacts within a list, or provide a comma separated list of contactIds to delete.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :list_id (String)

    The list of contacts to be deleted.

  • :contact_ids (String)

    comma separated list of contact ids to delete

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
# File 'lib/bombbomb/api/contacts_api.rb', line 331

def delete_contacts_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: ContactsApi.delete_contacts ..."
  end
  # resource path
  local_var_path = "/contacts/delete"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])

  # form parameters
  form_params = {}
  form_params["listId"] = opts[:'list_id'] if !opts[:'list_id'].nil?
  form_params["contactIds"] = opts[:'contact_ids'] if !opts[:'contact_ids'].nil?

  # http body (model)
  post_body = nil
  auth_names = ['BBOAuth2']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#delete_contacts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_contact_by_id(id, opts = {}) ⇒ nil

Get Contact Details Get the contact details

Parameters:

  • id

    Guid for the contact.

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

    the optional parameters

Returns:

  • (nil)


373
374
375
376
# File 'lib/bombbomb/api/contacts_api.rb', line 373

def get_contact_by_id(id, opts = {})
  get_contact_by_id_with_http_info(id, opts)
  return nil
end

#get_contact_by_id_with_http_info(id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Get Contact Details Get the contact details

Parameters:

  • id

    Guid for the contact.

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

    the optional parameters

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
# File 'lib/bombbomb/api/contacts_api.rb', line 383

def get_contact_by_id_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: ContactsApi.get_contact_by_id ..."
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ContactsApi.get_contact_by_id"
  end
  # resource path
  local_var_path = "/contact/{id}".sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['BBOAuth2']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#get_contact_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_custom_fields(opts = {}) ⇒ nil

Get custom fields. Get the current users custom fields.

Parameters:

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

    the optional parameters

Returns:

  • (nil)


426
427
428
429
# File 'lib/bombbomb/api/contacts_api.rb', line 426

def get_custom_fields(opts = {})
  get_custom_fields_with_http_info(opts)
  return nil
end

#get_custom_fields_with_http_info(opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Get custom fields. Get the current users custom fields.

Parameters:

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

    the optional parameters

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
# File 'lib/bombbomb/api/contacts_api.rb', line 435

def get_custom_fields_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: ContactsApi.get_custom_fields ..."
  end
  # resource path
  local_var_path = "/contacts/custom_fields/"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['BBOAuth2']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#get_custom_fields\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end