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,356 @@
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 TagsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create a Tag
23
+ # Create a new tag for the account
24
+ # @param tag_request [TagRequest] The tag content
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [CreateResponse]
27
+ def create_tag(tag_request, opts = {})
28
+ data, _status_code, _headers = create_tag_with_http_info(tag_request, opts)
29
+ data
30
+ end
31
+
32
+ # Create a Tag
33
+ # Create a new tag for the account
34
+ # @param tag_request [TagRequest] The tag content
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(CreateResponse, Integer, Hash)>] CreateResponse data, response status code and response headers
37
+ def create_tag_with_http_info(tag_request, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: TagsApi.create_tag ...'
40
+ end
41
+ # verify the required parameter 'tag_request' is set
42
+ if @api_client.config.client_side_validation && tag_request.nil?
43
+ fail ArgumentError, "Missing the required parameter 'tag_request' when calling TagsApi.create_tag"
44
+ end
45
+ # resource path
46
+ local_var_path = '/tag'
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(tag_request)
66
+
67
+ # return_type
68
+ return_type = opts[:debug_return_type] || 'CreateResponse'
69
+
70
+ # auth_names
71
+ auth_names = opts[:debug_auth_names] || ['apiKeyAuth']
72
+
73
+ new_options = opts.merge(
74
+ :operation => :"TagsApi.create_tag",
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: TagsApi#create_tag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
86
+ end
87
+ return data, status_code, headers
88
+ end
89
+
90
+ # Delete a Tag
91
+ # Delete an existing tag by ID
92
+ # @param tag_id [String] ID of the tag to delete
93
+ # @param [Hash] opts the optional parameters
94
+ # @return [DeleteResponse]
95
+ def delete_tag(tag_id, opts = {})
96
+ data, _status_code, _headers = delete_tag_with_http_info(tag_id, opts)
97
+ data
98
+ end
99
+
100
+ # Delete a Tag
101
+ # Delete an existing tag by ID
102
+ # @param tag_id [String] ID of the tag to delete
103
+ # @param [Hash] opts the optional parameters
104
+ # @return [Array<(DeleteResponse, Integer, Hash)>] DeleteResponse data, response status code and response headers
105
+ def delete_tag_with_http_info(tag_id, opts = {})
106
+ if @api_client.config.debugging
107
+ @api_client.config.logger.debug 'Calling API: TagsApi.delete_tag ...'
108
+ end
109
+ # verify the required parameter 'tag_id' is set
110
+ if @api_client.config.client_side_validation && tag_id.nil?
111
+ fail ArgumentError, "Missing the required parameter 'tag_id' when calling TagsApi.delete_tag"
112
+ end
113
+ # resource path
114
+ local_var_path = '/tag/{tagId}'.sub('{' + 'tagId' + '}', CGI.escape(tag_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] || 'DeleteResponse'
132
+
133
+ # auth_names
134
+ auth_names = opts[:debug_auth_names] || ['apiKeyAuth']
135
+
136
+ new_options = opts.merge(
137
+ :operation => :"TagsApi.delete_tag",
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: TagsApi#delete_tag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
149
+ end
150
+ return data, status_code, headers
151
+ end
152
+
153
+ # Get All Tags
154
+ # Retrieve all tags for the account with optional pagination and search filters
155
+ # @param [Hash] opts the optional parameters
156
+ # @option opts [Integer] :offset Offset for pagination
157
+ # @option opts [Integer] :limit Limit the number of results
158
+ # @option opts [String] :search Search term to filter tags
159
+ # @return [Array<Tag>]
160
+ def get_all_tags(opts = {})
161
+ data, _status_code, _headers = get_all_tags_with_http_info(opts)
162
+ data
163
+ end
164
+
165
+ # Get All Tags
166
+ # Retrieve all tags for the account with optional pagination and search filters
167
+ # @param [Hash] opts the optional parameters
168
+ # @option opts [Integer] :offset Offset for pagination
169
+ # @option opts [Integer] :limit Limit the number of results
170
+ # @option opts [String] :search Search term to filter tags
171
+ # @return [Array<(Array<Tag>, Integer, Hash)>] Array<Tag> data, response status code and response headers
172
+ def get_all_tags_with_http_info(opts = {})
173
+ if @api_client.config.debugging
174
+ @api_client.config.logger.debug 'Calling API: TagsApi.get_all_tags ...'
175
+ end
176
+ # resource path
177
+ local_var_path = '/tag'
178
+
179
+ # query parameters
180
+ query_params = opts[:query_params] || {}
181
+ query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
182
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
183
+ query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?
184
+
185
+ # header parameters
186
+ header_params = opts[:header_params] || {}
187
+ # HTTP header 'Accept' (if needed)
188
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
189
+
190
+ # form parameters
191
+ form_params = opts[:form_params] || {}
192
+
193
+ # http body (model)
194
+ post_body = opts[:debug_body]
195
+
196
+ # return_type
197
+ return_type = opts[:debug_return_type] || 'Array<Tag>'
198
+
199
+ # auth_names
200
+ auth_names = opts[:debug_auth_names] || ['apiKeyAuth']
201
+
202
+ new_options = opts.merge(
203
+ :operation => :"TagsApi.get_all_tags",
204
+ :header_params => header_params,
205
+ :query_params => query_params,
206
+ :form_params => form_params,
207
+ :body => post_body,
208
+ :auth_names => auth_names,
209
+ :return_type => return_type
210
+ )
211
+
212
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
213
+ if @api_client.config.debugging
214
+ @api_client.config.logger.debug "API called: TagsApi#get_all_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
215
+ end
216
+ return data, status_code, headers
217
+ end
218
+
219
+ # Get a Tag by ID
220
+ # Retrieve a tag based on the provided tag ID
221
+ # @param tag_id [String] ID of the tag you want to fetch
222
+ # @param [Hash] opts the optional parameters
223
+ # @return [Tag]
224
+ def get_tag_by_id(tag_id, opts = {})
225
+ data, _status_code, _headers = get_tag_by_id_with_http_info(tag_id, opts)
226
+ data
227
+ end
228
+
229
+ # Get a Tag by ID
230
+ # Retrieve a tag based on the provided tag ID
231
+ # @param tag_id [String] ID of the tag you want to fetch
232
+ # @param [Hash] opts the optional parameters
233
+ # @return [Array<(Tag, Integer, Hash)>] Tag data, response status code and response headers
234
+ def get_tag_by_id_with_http_info(tag_id, opts = {})
235
+ if @api_client.config.debugging
236
+ @api_client.config.logger.debug 'Calling API: TagsApi.get_tag_by_id ...'
237
+ end
238
+ # verify the required parameter 'tag_id' is set
239
+ if @api_client.config.client_side_validation && tag_id.nil?
240
+ fail ArgumentError, "Missing the required parameter 'tag_id' when calling TagsApi.get_tag_by_id"
241
+ end
242
+ # resource path
243
+ local_var_path = '/tag/{tagId}'.sub('{' + 'tagId' + '}', CGI.escape(tag_id.to_s))
244
+
245
+ # query parameters
246
+ query_params = opts[:query_params] || {}
247
+
248
+ # header parameters
249
+ header_params = opts[:header_params] || {}
250
+ # HTTP header 'Accept' (if needed)
251
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/plain']) unless header_params['Accept']
252
+
253
+ # form parameters
254
+ form_params = opts[:form_params] || {}
255
+
256
+ # http body (model)
257
+ post_body = opts[:debug_body]
258
+
259
+ # return_type
260
+ return_type = opts[:debug_return_type] || 'Tag'
261
+
262
+ # auth_names
263
+ auth_names = opts[:debug_auth_names] || ['apiKeyAuth']
264
+
265
+ new_options = opts.merge(
266
+ :operation => :"TagsApi.get_tag_by_id",
267
+ :header_params => header_params,
268
+ :query_params => query_params,
269
+ :form_params => form_params,
270
+ :body => post_body,
271
+ :auth_names => auth_names,
272
+ :return_type => return_type
273
+ )
274
+
275
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
276
+ if @api_client.config.debugging
277
+ @api_client.config.logger.debug "API called: TagsApi#get_tag_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
278
+ end
279
+ return data, status_code, headers
280
+ end
281
+
282
+ # Update a Tag
283
+ # Update an existing tag
284
+ # @param tag_request [TagRequest] The tag content
285
+ # @param tag_id [String] ID of the tag to update
286
+ # @param [Hash] opts the optional parameters
287
+ # @return [Response]
288
+ def update_tag(tag_request, tag_id, opts = {})
289
+ data, _status_code, _headers = update_tag_with_http_info(tag_request, tag_id, opts)
290
+ data
291
+ end
292
+
293
+ # Update a Tag
294
+ # Update an existing tag
295
+ # @param tag_request [TagRequest] The tag content
296
+ # @param tag_id [String] ID of the tag to update
297
+ # @param [Hash] opts the optional parameters
298
+ # @return [Array<(Response, Integer, Hash)>] Response data, response status code and response headers
299
+ def update_tag_with_http_info(tag_request, tag_id, opts = {})
300
+ if @api_client.config.debugging
301
+ @api_client.config.logger.debug 'Calling API: TagsApi.update_tag ...'
302
+ end
303
+ # verify the required parameter 'tag_request' is set
304
+ if @api_client.config.client_side_validation && tag_request.nil?
305
+ fail ArgumentError, "Missing the required parameter 'tag_request' when calling TagsApi.update_tag"
306
+ end
307
+ # verify the required parameter 'tag_id' is set
308
+ if @api_client.config.client_side_validation && tag_id.nil?
309
+ fail ArgumentError, "Missing the required parameter 'tag_id' when calling TagsApi.update_tag"
310
+ end
311
+ # resource path
312
+ local_var_path = '/tag/{tagId}'.sub('{' + 'tagId' + '}', CGI.escape(tag_id.to_s))
313
+
314
+ # query parameters
315
+ query_params = opts[:query_params] || {}
316
+
317
+ # header parameters
318
+ header_params = opts[:header_params] || {}
319
+ # HTTP header 'Accept' (if needed)
320
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
321
+ # HTTP header 'Content-Type'
322
+ content_type = @api_client.select_header_content_type(['application/json'])
323
+ if !content_type.nil?
324
+ header_params['Content-Type'] = content_type
325
+ end
326
+
327
+ # form parameters
328
+ form_params = opts[:form_params] || {}
329
+
330
+ # http body (model)
331
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(tag_request)
332
+
333
+ # return_type
334
+ return_type = opts[:debug_return_type] || 'Response'
335
+
336
+ # auth_names
337
+ auth_names = opts[:debug_auth_names] || ['apiKeyAuth']
338
+
339
+ new_options = opts.merge(
340
+ :operation => :"TagsApi.update_tag",
341
+ :header_params => header_params,
342
+ :query_params => query_params,
343
+ :form_params => form_params,
344
+ :body => post_body,
345
+ :auth_names => auth_names,
346
+ :return_type => return_type
347
+ )
348
+
349
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
350
+ if @api_client.config.debugging
351
+ @api_client.config.logger.debug "API called: TagsApi#update_tag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
352
+ end
353
+ return data, status_code, headers
354
+ end
355
+ end
356
+ end