sendx-ruby-sdk 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +156 -0
  3. data/lib/sendx-ruby-sdk/api/campaign_api.rb +356 -0
  4. data/lib/sendx-ruby-sdk/api/contact_api.rb +426 -0
  5. data/lib/sendx-ruby-sdk/api/list_api.rb +356 -0
  6. data/lib/sendx-ruby-sdk/api/reports_api.rb +88 -0
  7. data/lib/sendx-ruby-sdk/api/sender_api.rb +156 -0
  8. data/lib/sendx-ruby-sdk/api/tags_api.rb +356 -0
  9. data/lib/sendx-ruby-sdk/api_client.rb +394 -0
  10. data/lib/sendx-ruby-sdk/api_error.rb +58 -0
  11. data/lib/sendx-ruby-sdk/configuration.rb +316 -0
  12. data/lib/sendx-ruby-sdk/models/campaign.rb +483 -0
  13. data/lib/sendx-ruby-sdk/models/campaign_dashboard_data.rb +255 -0
  14. data/lib/sendx-ruby-sdk/models/campaign_request.rb +441 -0
  15. data/lib/sendx-ruby-sdk/models/contact.rb +425 -0
  16. data/lib/sendx-ruby-sdk/models/contact_request.rb +292 -0
  17. data/lib/sendx-ruby-sdk/models/create_response.rb +232 -0
  18. data/lib/sendx-ruby-sdk/models/dashboard_stats.rb +234 -0
  19. data/lib/sendx-ruby-sdk/models/delete_campaign200_response.rb +225 -0
  20. data/lib/sendx-ruby-sdk/models/delete_request.rb +215 -0
  21. data/lib/sendx-ruby-sdk/models/delete_response.rb +223 -0
  22. data/lib/sendx-ruby-sdk/models/last_sent_campaign_stat.rb +284 -0
  23. data/lib/sendx-ruby-sdk/models/list_model.rb +410 -0
  24. data/lib/sendx-ruby-sdk/models/list_request.rb +379 -0
  25. data/lib/sendx-ruby-sdk/models/report_data.rb +358 -0
  26. data/lib/sendx-ruby-sdk/models/response.rb +235 -0
  27. data/lib/sendx-ruby-sdk/models/sender.rb +256 -0
  28. data/lib/sendx-ruby-sdk/models/sender_request.rb +239 -0
  29. data/lib/sendx-ruby-sdk/models/sender_response.rb +273 -0
  30. data/lib/sendx-ruby-sdk/models/tag.rb +241 -0
  31. data/lib/sendx-ruby-sdk/models/tag_request.rb +214 -0
  32. data/lib/sendx-ruby-sdk/version.rb +15 -0
  33. data/lib/sendx-ruby-sdk.rb +65 -0
  34. data/spec/api/campaign_api_spec.rb +98 -0
  35. data/spec/api/contact_api_spec.rb +111 -0
  36. data/spec/api/list_api_spec.rb +98 -0
  37. data/spec/api/reports_api_spec.rb +48 -0
  38. data/spec/api/sender_api_spec.rb +61 -0
  39. data/spec/api/tags_api_spec.rb +98 -0
  40. data/spec/models/campaign_dashboard_data_spec.rb +60 -0
  41. data/spec/models/campaign_request_spec.rb +148 -0
  42. data/spec/models/campaign_spec.rb +170 -0
  43. data/spec/models/contact_request_spec.rb +78 -0
  44. data/spec/models/contact_spec.rb +142 -0
  45. data/spec/models/create_response_spec.rb +48 -0
  46. data/spec/models/dashboard_stats_spec.rb +48 -0
  47. data/spec/models/delete_campaign200_response_spec.rb +42 -0
  48. data/spec/models/delete_request_spec.rb +36 -0
  49. data/spec/models/delete_response_spec.rb +42 -0
  50. data/spec/models/last_sent_campaign_stat_spec.rb +78 -0
  51. data/spec/models/list_model_spec.rb +136 -0
  52. data/spec/models/list_request_spec.rb +118 -0
  53. data/spec/models/report_data_spec.rb +120 -0
  54. data/spec/models/response_spec.rb +48 -0
  55. data/spec/models/sender_request_spec.rb +42 -0
  56. data/spec/models/sender_response_spec.rb +54 -0
  57. data/spec/models/sender_spec.rb +48 -0
  58. data/spec/models/tag_request_spec.rb +36 -0
  59. data/spec/models/tag_spec.rb +54 -0
  60. data/spec/spec_helper.rb +111 -0
  61. metadata +171 -0
@@ -0,0 +1,426 @@
1
+ =begin
2
+ #SendX REST API
3
+
4
+ ## Introduction SendX is an email marketing product. It helps you convert website visitors to customers, send them promotional emails, engage with them using drip sequences and craft custom journeys using powerful but simple automations. The SendX API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The SendX Rest API doesn’t support bulk updates. You can work on only one object per request. <br>
5
+
6
+ The version of the OpenAPI document: 1.0.1
7
+ Contact: support@sendx.io
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.8.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module SendX
16
+ class ContactApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create a contact
23
+ # Create Contact with given data
24
+ # @param contact_request [ContactRequest]
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [Response]
27
+ def create_contact(contact_request, opts = {})
28
+ data, _status_code, _headers = create_contact_with_http_info(contact_request, opts)
29
+ data
30
+ end
31
+
32
+ # Create a contact
33
+ # Create Contact with given data
34
+ # @param contact_request [ContactRequest]
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(Response, Integer, Hash)>] Response data, response status code and response headers
37
+ def create_contact_with_http_info(contact_request, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: ContactApi.create_contact ...'
40
+ end
41
+ # verify the required parameter 'contact_request' is set
42
+ if @api_client.config.client_side_validation && contact_request.nil?
43
+ fail ArgumentError, "Missing the required parameter 'contact_request' when calling ContactApi.create_contact"
44
+ end
45
+ # resource path
46
+ local_var_path = '/contact'
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+
51
+ # header parameters
52
+ header_params = opts[:header_params] || {}
53
+ # HTTP header 'Accept' (if needed)
54
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
55
+ # HTTP header 'Content-Type'
56
+ content_type = @api_client.select_header_content_type(['application/json'])
57
+ if !content_type.nil?
58
+ header_params['Content-Type'] = content_type
59
+ end
60
+
61
+ # form parameters
62
+ form_params = opts[:form_params] || {}
63
+
64
+ # http body (model)
65
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(contact_request)
66
+
67
+ # return_type
68
+ return_type = opts[:debug_return_type] || 'Response'
69
+
70
+ # auth_names
71
+ auth_names = opts[:debug_auth_names] || ['apiKeyAuth']
72
+
73
+ new_options = opts.merge(
74
+ :operation => :"ContactApi.create_contact",
75
+ :header_params => header_params,
76
+ :query_params => query_params,
77
+ :form_params => form_params,
78
+ :body => post_body,
79
+ :auth_names => auth_names,
80
+ :return_type => return_type
81
+ )
82
+
83
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
84
+ if @api_client.config.debugging
85
+ @api_client.config.logger.debug "API called: ContactApi#create_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
86
+ end
87
+ return data, status_code, headers
88
+ end
89
+
90
+ # Delete Contact
91
+ # Deletes Contact
92
+ # @param contact_id [String] The Contact ID to delete
93
+ # @param [Hash] opts the optional parameters
94
+ # @return [Response]
95
+ def delete_contact(contact_id, opts = {})
96
+ data, _status_code, _headers = delete_contact_with_http_info(contact_id, opts)
97
+ data
98
+ end
99
+
100
+ # Delete Contact
101
+ # Deletes Contact
102
+ # @param contact_id [String] The Contact ID to delete
103
+ # @param [Hash] opts the optional parameters
104
+ # @return [Array<(Response, Integer, Hash)>] Response data, response status code and response headers
105
+ def delete_contact_with_http_info(contact_id, opts = {})
106
+ if @api_client.config.debugging
107
+ @api_client.config.logger.debug 'Calling API: ContactApi.delete_contact ...'
108
+ end
109
+ # verify the required parameter 'contact_id' is set
110
+ if @api_client.config.client_side_validation && contact_id.nil?
111
+ fail ArgumentError, "Missing the required parameter 'contact_id' when calling ContactApi.delete_contact"
112
+ end
113
+ # resource path
114
+ local_var_path = '/contact/{contactId}'.sub('{' + 'contactId' + '}', CGI.escape(contact_id.to_s))
115
+
116
+ # query parameters
117
+ query_params = opts[:query_params] || {}
118
+
119
+ # header parameters
120
+ header_params = opts[:header_params] || {}
121
+ # HTTP header 'Accept' (if needed)
122
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
123
+
124
+ # form parameters
125
+ form_params = opts[:form_params] || {}
126
+
127
+ # http body (model)
128
+ post_body = opts[:debug_body]
129
+
130
+ # return_type
131
+ return_type = opts[:debug_return_type] || 'Response'
132
+
133
+ # auth_names
134
+ auth_names = opts[:debug_auth_names] || ['apiKeyAuth']
135
+
136
+ new_options = opts.merge(
137
+ :operation => :"ContactApi.delete_contact",
138
+ :header_params => header_params,
139
+ :query_params => query_params,
140
+ :form_params => form_params,
141
+ :body => post_body,
142
+ :auth_names => auth_names,
143
+ :return_type => return_type
144
+ )
145
+
146
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
147
+ if @api_client.config.debugging
148
+ @api_client.config.logger.debug "API called: ContactApi#delete_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
149
+ end
150
+ return data, status_code, headers
151
+ end
152
+
153
+ # Get All Contacts
154
+ # Find all contacts with optional filters
155
+ # @param [Hash] opts the optional parameters
156
+ # @option opts [Integer] :offset Offset for pagination (default to 0)
157
+ # @option opts [Integer] :limit Limit for pagination (default to 10)
158
+ # @option opts [String] :contact_type Filter contacts by type
159
+ # @option opts [String] :search Search term to filter contacts
160
+ # @return [Array<Contact>]
161
+ def get_all_contacts(opts = {})
162
+ data, _status_code, _headers = get_all_contacts_with_http_info(opts)
163
+ data
164
+ end
165
+
166
+ # Get All Contacts
167
+ # Find all contacts with optional filters
168
+ # @param [Hash] opts the optional parameters
169
+ # @option opts [Integer] :offset Offset for pagination (default to 0)
170
+ # @option opts [Integer] :limit Limit for pagination (default to 10)
171
+ # @option opts [String] :contact_type Filter contacts by type
172
+ # @option opts [String] :search Search term to filter contacts
173
+ # @return [Array<(Array<Contact>, Integer, Hash)>] Array<Contact> data, response status code and response headers
174
+ def get_all_contacts_with_http_info(opts = {})
175
+ if @api_client.config.debugging
176
+ @api_client.config.logger.debug 'Calling API: ContactApi.get_all_contacts ...'
177
+ end
178
+ allowable_values = ["all", "unsubscribed", "bounced", "markedspam"]
179
+ if @api_client.config.client_side_validation && opts[:'contact_type'] && !allowable_values.include?(opts[:'contact_type'])
180
+ fail ArgumentError, "invalid value for \"contact_type\", must be one of #{allowable_values}"
181
+ end
182
+ # resource path
183
+ local_var_path = '/contact'
184
+
185
+ # query parameters
186
+ query_params = opts[:query_params] || {}
187
+ query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
188
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
189
+ query_params[:'contactType'] = opts[:'contact_type'] if !opts[:'contact_type'].nil?
190
+ query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?
191
+
192
+ # header parameters
193
+ header_params = opts[:header_params] || {}
194
+ # HTTP header 'Accept' (if needed)
195
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
196
+
197
+ # form parameters
198
+ form_params = opts[:form_params] || {}
199
+
200
+ # http body (model)
201
+ post_body = opts[:debug_body]
202
+
203
+ # return_type
204
+ return_type = opts[:debug_return_type] || 'Array<Contact>'
205
+
206
+ # auth_names
207
+ auth_names = opts[:debug_auth_names] || ['apiKeyAuth']
208
+
209
+ new_options = opts.merge(
210
+ :operation => :"ContactApi.get_all_contacts",
211
+ :header_params => header_params,
212
+ :query_params => query_params,
213
+ :form_params => form_params,
214
+ :body => post_body,
215
+ :auth_names => auth_names,
216
+ :return_type => return_type
217
+ )
218
+
219
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
220
+ if @api_client.config.debugging
221
+ @api_client.config.logger.debug "API called: ContactApi#get_all_contacts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
222
+ end
223
+ return data, status_code, headers
224
+ end
225
+
226
+ # Get Contact by ID
227
+ # Retrieve a specific contact by its contactId.
228
+ # @param contact_id [String] The ID of the contact to retrieve.
229
+ # @param [Hash] opts the optional parameters
230
+ # @return [Contact]
231
+ def get_contact_by_id(contact_id, opts = {})
232
+ data, _status_code, _headers = get_contact_by_id_with_http_info(contact_id, opts)
233
+ data
234
+ end
235
+
236
+ # Get Contact by ID
237
+ # Retrieve a specific contact by its contactId.
238
+ # @param contact_id [String] The ID of the contact to retrieve.
239
+ # @param [Hash] opts the optional parameters
240
+ # @return [Array<(Contact, Integer, Hash)>] Contact data, response status code and response headers
241
+ def get_contact_by_id_with_http_info(contact_id, opts = {})
242
+ if @api_client.config.debugging
243
+ @api_client.config.logger.debug 'Calling API: ContactApi.get_contact_by_id ...'
244
+ end
245
+ # verify the required parameter 'contact_id' is set
246
+ if @api_client.config.client_side_validation && contact_id.nil?
247
+ fail ArgumentError, "Missing the required parameter 'contact_id' when calling ContactApi.get_contact_by_id"
248
+ end
249
+ # resource path
250
+ local_var_path = '/contact/{contactId}'.sub('{' + 'contactId' + '}', CGI.escape(contact_id.to_s))
251
+
252
+ # query parameters
253
+ query_params = opts[:query_params] || {}
254
+
255
+ # header parameters
256
+ header_params = opts[:header_params] || {}
257
+ # HTTP header 'Accept' (if needed)
258
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
259
+
260
+ # form parameters
261
+ form_params = opts[:form_params] || {}
262
+
263
+ # http body (model)
264
+ post_body = opts[:debug_body]
265
+
266
+ # return_type
267
+ return_type = opts[:debug_return_type] || 'Contact'
268
+
269
+ # auth_names
270
+ auth_names = opts[:debug_auth_names] || ['apiKeyAuth']
271
+
272
+ new_options = opts.merge(
273
+ :operation => :"ContactApi.get_contact_by_id",
274
+ :header_params => header_params,
275
+ :query_params => query_params,
276
+ :form_params => form_params,
277
+ :body => post_body,
278
+ :auth_names => auth_names,
279
+ :return_type => return_type
280
+ )
281
+
282
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
283
+ if @api_client.config.debugging
284
+ @api_client.config.logger.debug "API called: ContactApi#get_contact_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
285
+ end
286
+ return data, status_code, headers
287
+ end
288
+
289
+ # Unsubscribe Contact
290
+ # Unsubscribe a globally existing contact
291
+ # @param contact_id [String] The Contact ID to unsubscribe
292
+ # @param [Hash] opts the optional parameters
293
+ # @return [Response]
294
+ def unsubscribe_contact(contact_id, opts = {})
295
+ data, _status_code, _headers = unsubscribe_contact_with_http_info(contact_id, opts)
296
+ data
297
+ end
298
+
299
+ # Unsubscribe Contact
300
+ # Unsubscribe a globally existing contact
301
+ # @param contact_id [String] The Contact ID to unsubscribe
302
+ # @param [Hash] opts the optional parameters
303
+ # @return [Array<(Response, Integer, Hash)>] Response data, response status code and response headers
304
+ def unsubscribe_contact_with_http_info(contact_id, opts = {})
305
+ if @api_client.config.debugging
306
+ @api_client.config.logger.debug 'Calling API: ContactApi.unsubscribe_contact ...'
307
+ end
308
+ # verify the required parameter 'contact_id' is set
309
+ if @api_client.config.client_side_validation && contact_id.nil?
310
+ fail ArgumentError, "Missing the required parameter 'contact_id' when calling ContactApi.unsubscribe_contact"
311
+ end
312
+ # resource path
313
+ local_var_path = '/contact/unsubscribe/{contactId}'.sub('{' + 'contactId' + '}', CGI.escape(contact_id.to_s))
314
+
315
+ # query parameters
316
+ query_params = opts[:query_params] || {}
317
+
318
+ # header parameters
319
+ header_params = opts[:header_params] || {}
320
+ # HTTP header 'Accept' (if needed)
321
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
322
+
323
+ # form parameters
324
+ form_params = opts[:form_params] || {}
325
+
326
+ # http body (model)
327
+ post_body = opts[:debug_body]
328
+
329
+ # return_type
330
+ return_type = opts[:debug_return_type] || 'Response'
331
+
332
+ # auth_names
333
+ auth_names = opts[:debug_auth_names] || ['apiKeyAuth']
334
+
335
+ new_options = opts.merge(
336
+ :operation => :"ContactApi.unsubscribe_contact",
337
+ :header_params => header_params,
338
+ :query_params => query_params,
339
+ :form_params => form_params,
340
+ :body => post_body,
341
+ :auth_names => auth_names,
342
+ :return_type => return_type
343
+ )
344
+
345
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
346
+ if @api_client.config.debugging
347
+ @api_client.config.logger.debug "API called: ContactApi#unsubscribe_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
348
+ end
349
+ return data, status_code, headers
350
+ end
351
+
352
+ # Update Contact
353
+ # Update Contact with given data
354
+ # @param contact_request [ContactRequest]
355
+ # @param contact_id [String] The ID of the Contact to update
356
+ # @param [Hash] opts the optional parameters
357
+ # @return [Contact]
358
+ def update_contact(contact_request, contact_id, opts = {})
359
+ data, _status_code, _headers = update_contact_with_http_info(contact_request, contact_id, opts)
360
+ data
361
+ end
362
+
363
+ # Update Contact
364
+ # Update Contact with given data
365
+ # @param contact_request [ContactRequest]
366
+ # @param contact_id [String] The ID of the Contact to update
367
+ # @param [Hash] opts the optional parameters
368
+ # @return [Array<(Contact, Integer, Hash)>] Contact data, response status code and response headers
369
+ def update_contact_with_http_info(contact_request, contact_id, opts = {})
370
+ if @api_client.config.debugging
371
+ @api_client.config.logger.debug 'Calling API: ContactApi.update_contact ...'
372
+ end
373
+ # verify the required parameter 'contact_request' is set
374
+ if @api_client.config.client_side_validation && contact_request.nil?
375
+ fail ArgumentError, "Missing the required parameter 'contact_request' when calling ContactApi.update_contact"
376
+ end
377
+ # verify the required parameter 'contact_id' is set
378
+ if @api_client.config.client_side_validation && contact_id.nil?
379
+ fail ArgumentError, "Missing the required parameter 'contact_id' when calling ContactApi.update_contact"
380
+ end
381
+ # resource path
382
+ local_var_path = '/contact/{contactId}'.sub('{' + 'contactId' + '}', CGI.escape(contact_id.to_s))
383
+
384
+ # query parameters
385
+ query_params = opts[:query_params] || {}
386
+
387
+ # header parameters
388
+ header_params = opts[:header_params] || {}
389
+ # HTTP header 'Accept' (if needed)
390
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
391
+ # HTTP header 'Content-Type'
392
+ content_type = @api_client.select_header_content_type(['application/json'])
393
+ if !content_type.nil?
394
+ header_params['Content-Type'] = content_type
395
+ end
396
+
397
+ # form parameters
398
+ form_params = opts[:form_params] || {}
399
+
400
+ # http body (model)
401
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(contact_request)
402
+
403
+ # return_type
404
+ return_type = opts[:debug_return_type] || 'Contact'
405
+
406
+ # auth_names
407
+ auth_names = opts[:debug_auth_names] || ['apiKeyAuth']
408
+
409
+ new_options = opts.merge(
410
+ :operation => :"ContactApi.update_contact",
411
+ :header_params => header_params,
412
+ :query_params => query_params,
413
+ :form_params => form_params,
414
+ :body => post_body,
415
+ :auth_names => auth_names,
416
+ :return_type => return_type
417
+ )
418
+
419
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
420
+ if @api_client.config.debugging
421
+ @api_client.config.logger.debug "API called: ContactApi#update_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
422
+ end
423
+ return data, status_code, headers
424
+ end
425
+ end
426
+ end