Class: Pingram::TemplatesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/pingram/api/templates_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ TemplatesApi

Returns a new instance of TemplatesApi.



19
20
21
# File 'lib/pingram/api/templates_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/pingram/api/templates_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#templates_create_template(notification_id, channel, template_post_request, opts = {}) ⇒ Template

Create a new template for a notification

Parameters:

  • notification_id (String)

    Notification ID

  • channel (String)

    Channel type

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

    the optional parameters

Returns:



28
29
30
31
# File 'lib/pingram/api/templates_api.rb', line 28

def templates_create_template(notification_id, channel, template_post_request, opts = {})
  data, _status_code, _headers = templates_create_template_with_http_info(notification_id, channel, template_post_request, opts)
  data
end

#templates_create_template_with_http_info(notification_id, channel, template_post_request, opts = {}) ⇒ Array<(Template, Integer, Hash)>

Create a new template for a notification

Parameters:

  • notification_id (String)

    Notification ID

  • channel (String)

    Channel type

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

    the optional parameters

Returns:

  • (Array<(Template, Integer, Hash)>)

    Template data, response status code and response headers



39
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/pingram/api/templates_api.rb', line 39

def templates_create_template_with_http_info(notification_id, channel, template_post_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TemplatesApi.templates_create_template ...'
  end
  # verify the required parameter 'notification_id' is set
  if @api_client.config.client_side_validation && notification_id.nil?
    fail ArgumentError, "Missing the required parameter 'notification_id' when calling TemplatesApi.templates_create_template"
  end
  # verify the required parameter 'channel' is set
  if @api_client.config.client_side_validation && channel.nil?
    fail ArgumentError, "Missing the required parameter 'channel' when calling TemplatesApi.templates_create_template"
  end
  # verify the required parameter 'template_post_request' is set
  if @api_client.config.client_side_validation && template_post_request.nil?
    fail ArgumentError, "Missing the required parameter 'template_post_request' when calling TemplatesApi.templates_create_template"
  end
  # resource path
  local_var_path = '/notifications/{notificationId}/{channel}/templates'.sub('{' + 'notificationId' + '}', CGI.escape(notification_id.to_s)).sub('{' + 'channel' + '}', CGI.escape(channel.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(template_post_request)

  # return_type
  return_type = opts[:debug_return_type] || 'Template'

  # auth_names (apiKey last so Bearer wins when multiple schemes set Authorization)
  auth_names = opts[:debug_auth_names] || ['endUserHashed', 'endUser', 'clientCredentials', 'apiKey']

  new_options = opts.merge(
    :operation => :"TemplatesApi.templates_create_template",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TemplatesApi#templates_create_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#templates_delete_template(notification_id, channel, template_id, opts = {}) ⇒ nil

Delete a template

Parameters:

  • notification_id (String)

    Notification ID

  • channel (String)

    Channel type

  • template_id (String)

    Template ID

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

    the optional parameters

Returns:

  • (nil)


106
107
108
109
# File 'lib/pingram/api/templates_api.rb', line 106

def templates_delete_template(notification_id, channel, template_id, opts = {})
  templates_delete_template_with_http_info(notification_id, channel, template_id, opts)
  nil
end

#templates_delete_template_with_http_info(notification_id, channel, template_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete a template

Parameters:

  • notification_id (String)

    Notification ID

  • channel (String)

    Channel type

  • template_id (String)

    Template ID

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/pingram/api/templates_api.rb', line 117

def templates_delete_template_with_http_info(notification_id, channel, template_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TemplatesApi.templates_delete_template ...'
  end
  # verify the required parameter 'notification_id' is set
  if @api_client.config.client_side_validation && notification_id.nil?
    fail ArgumentError, "Missing the required parameter 'notification_id' when calling TemplatesApi.templates_delete_template"
  end
  # verify the required parameter 'channel' is set
  if @api_client.config.client_side_validation && channel.nil?
    fail ArgumentError, "Missing the required parameter 'channel' when calling TemplatesApi.templates_delete_template"
  end
  # verify the required parameter 'template_id' is set
  if @api_client.config.client_side_validation && template_id.nil?
    fail ArgumentError, "Missing the required parameter 'template_id' when calling TemplatesApi.templates_delete_template"
  end
  # resource path
  local_var_path = '/notifications/{notificationId}/{channel}/templates/{templateId}'.sub('{' + 'notificationId' + '}', CGI.escape(notification_id.to_s)).sub('{' + 'channel' + '}', CGI.escape(channel.to_s)).sub('{' + 'templateId' + '}', CGI.escape(template_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names (apiKey last so Bearer wins when multiple schemes set Authorization)
  auth_names = opts[:debug_auth_names] || ['endUserHashed', 'endUser', 'clientCredentials', 'apiKey']

  new_options = opts.merge(
    :operation => :"TemplatesApi.templates_delete_template",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TemplatesApi#templates_delete_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#templates_get_template(notification_id, channel, template_id, opts = {}) ⇒ GetTemplatesResponse

Get a single template by ID

Parameters:

  • notification_id (String)

    Notification ID

  • channel (String)

    Channel type

  • template_id (String)

    Template ID

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

    the optional parameters

Returns:



177
178
179
180
# File 'lib/pingram/api/templates_api.rb', line 177

def templates_get_template(notification_id, channel, template_id, opts = {})
  data, _status_code, _headers = templates_get_template_with_http_info(notification_id, channel, template_id, opts)
  data
end

#templates_get_template_with_http_info(notification_id, channel, template_id, opts = {}) ⇒ Array<(GetTemplatesResponse, Integer, Hash)>

Get a single template by ID

Parameters:

  • notification_id (String)

    Notification ID

  • channel (String)

    Channel type

  • template_id (String)

    Template ID

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

    the optional parameters

Returns:

  • (Array<(GetTemplatesResponse, Integer, Hash)>)

    GetTemplatesResponse data, response status code and response headers



188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
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
# File 'lib/pingram/api/templates_api.rb', line 188

def templates_get_template_with_http_info(notification_id, channel, template_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TemplatesApi.templates_get_template ...'
  end
  # verify the required parameter 'notification_id' is set
  if @api_client.config.client_side_validation && notification_id.nil?
    fail ArgumentError, "Missing the required parameter 'notification_id' when calling TemplatesApi.templates_get_template"
  end
  # verify the required parameter 'channel' is set
  if @api_client.config.client_side_validation && channel.nil?
    fail ArgumentError, "Missing the required parameter 'channel' when calling TemplatesApi.templates_get_template"
  end
  # verify the required parameter 'template_id' is set
  if @api_client.config.client_side_validation && template_id.nil?
    fail ArgumentError, "Missing the required parameter 'template_id' when calling TemplatesApi.templates_get_template"
  end
  # resource path
  local_var_path = '/notifications/{notificationId}/{channel}/templates/{templateId}'.sub('{' + 'notificationId' + '}', CGI.escape(notification_id.to_s)).sub('{' + 'channel' + '}', CGI.escape(channel.to_s)).sub('{' + 'templateId' + '}', CGI.escape(template_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetTemplatesResponse'

  # auth_names (apiKey last so Bearer wins when multiple schemes set Authorization)
  auth_names = opts[:debug_auth_names] || ['endUserHashed', 'endUser', 'clientCredentials', 'apiKey']

  new_options = opts.merge(
    :operation => :"TemplatesApi.templates_get_template",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TemplatesApi#templates_get_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#templates_list_templates(notification_id, channel, opts = {}) ⇒ Array<GetTemplatesListResponseInner>

List all templates for a notification and channel

Parameters:

  • notification_id (String)

    Notification ID

  • channel (String)

    Channel type

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

    the optional parameters

Returns:



249
250
251
252
# File 'lib/pingram/api/templates_api.rb', line 249

def templates_list_templates(notification_id, channel, opts = {})
  data, _status_code, _headers = templates_list_templates_with_http_info(notification_id, channel, opts)
  data
end

#templates_list_templates_with_http_info(notification_id, channel, opts = {}) ⇒ Array<(Array<GetTemplatesListResponseInner>, Integer, Hash)>

List all templates for a notification and channel

Parameters:

  • notification_id (String)

    Notification ID

  • channel (String)

    Channel type

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

    the optional parameters

Returns:

  • (Array<(Array<GetTemplatesListResponseInner>, Integer, Hash)>)

    Array<GetTemplatesListResponseInner> data, response status code and response headers



259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
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
# File 'lib/pingram/api/templates_api.rb', line 259

def templates_list_templates_with_http_info(notification_id, channel, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TemplatesApi.templates_list_templates ...'
  end
  # verify the required parameter 'notification_id' is set
  if @api_client.config.client_side_validation && notification_id.nil?
    fail ArgumentError, "Missing the required parameter 'notification_id' when calling TemplatesApi.templates_list_templates"
  end
  # verify the required parameter 'channel' is set
  if @api_client.config.client_side_validation && channel.nil?
    fail ArgumentError, "Missing the required parameter 'channel' when calling TemplatesApi.templates_list_templates"
  end
  # resource path
  local_var_path = '/notifications/{notificationId}/{channel}/templates'.sub('{' + 'notificationId' + '}', CGI.escape(notification_id.to_s)).sub('{' + 'channel' + '}', CGI.escape(channel.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Array<GetTemplatesListResponseInner>'

  # auth_names (apiKey last so Bearer wins when multiple schemes set Authorization)
  auth_names = opts[:debug_auth_names] || ['endUserHashed', 'endUser', 'clientCredentials', 'apiKey']

  new_options = opts.merge(
    :operation => :"TemplatesApi.templates_list_templates",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TemplatesApi#templates_list_templates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#templates_set_default_template(notification_id, channel, set_default_template_request, opts = {}) ⇒ Template

Set a template as default for specific delivery modes

Parameters:

  • notification_id (String)

    Notification ID

  • channel (String)

    Channel type

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

    the optional parameters

Returns:



317
318
319
320
# File 'lib/pingram/api/templates_api.rb', line 317

def templates_set_default_template(notification_id, channel, set_default_template_request, opts = {})
  data, _status_code, _headers = templates_set_default_template_with_http_info(notification_id, channel, set_default_template_request, opts)
  data
end

#templates_set_default_template_with_http_info(notification_id, channel, set_default_template_request, opts = {}) ⇒ Array<(Template, Integer, Hash)>

Set a template as default for specific delivery modes

Parameters:

  • notification_id (String)

    Notification ID

  • channel (String)

    Channel type

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

    the optional parameters

Returns:

  • (Array<(Template, Integer, Hash)>)

    Template data, response status code and response headers



328
329
330
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
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
# File 'lib/pingram/api/templates_api.rb', line 328

def templates_set_default_template_with_http_info(notification_id, channel, set_default_template_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TemplatesApi.templates_set_default_template ...'
  end
  # verify the required parameter 'notification_id' is set
  if @api_client.config.client_side_validation && notification_id.nil?
    fail ArgumentError, "Missing the required parameter 'notification_id' when calling TemplatesApi.templates_set_default_template"
  end
  # verify the required parameter 'channel' is set
  if @api_client.config.client_side_validation && channel.nil?
    fail ArgumentError, "Missing the required parameter 'channel' when calling TemplatesApi.templates_set_default_template"
  end
  # verify the required parameter 'set_default_template_request' is set
  if @api_client.config.client_side_validation && set_default_template_request.nil?
    fail ArgumentError, "Missing the required parameter 'set_default_template_request' when calling TemplatesApi.templates_set_default_template"
  end
  # resource path
  local_var_path = '/notifications/{notificationId}/{channel}/templates/default-selection'.sub('{' + 'notificationId' + '}', CGI.escape(notification_id.to_s)).sub('{' + 'channel' + '}', CGI.escape(channel.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(set_default_template_request)

  # return_type
  return_type = opts[:debug_return_type] || 'Template'

  # auth_names (apiKey last so Bearer wins when multiple schemes set Authorization)
  auth_names = opts[:debug_auth_names] || ['endUserHashed', 'endUser', 'clientCredentials', 'apiKey']

  new_options = opts.merge(
    :operation => :"TemplatesApi.templates_set_default_template",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TemplatesApi#templates_set_default_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#templates_update_template(notification_id, channel, template_id, template_patch_request, opts = {}) ⇒ Template

Update a template’s properties

Parameters:

  • notification_id (String)

    Notification ID

  • channel (String)

    Channel type

  • template_id (String)

    Template ID

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

    the optional parameters

Returns:



396
397
398
399
# File 'lib/pingram/api/templates_api.rb', line 396

def templates_update_template(notification_id, channel, template_id, template_patch_request, opts = {})
  data, _status_code, _headers = templates_update_template_with_http_info(notification_id, channel, template_id, template_patch_request, opts)
  data
end

#templates_update_template_with_http_info(notification_id, channel, template_id, template_patch_request, opts = {}) ⇒ Array<(Template, Integer, Hash)>

Update a template&#39;s properties

Parameters:

  • notification_id (String)

    Notification ID

  • channel (String)

    Channel type

  • template_id (String)

    Template ID

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

    the optional parameters

Returns:

  • (Array<(Template, Integer, Hash)>)

    Template data, response status code and response headers



408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
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
469
470
471
# File 'lib/pingram/api/templates_api.rb', line 408

def templates_update_template_with_http_info(notification_id, channel, template_id, template_patch_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TemplatesApi.templates_update_template ...'
  end
  # verify the required parameter 'notification_id' is set
  if @api_client.config.client_side_validation && notification_id.nil?
    fail ArgumentError, "Missing the required parameter 'notification_id' when calling TemplatesApi.templates_update_template"
  end
  # verify the required parameter 'channel' is set
  if @api_client.config.client_side_validation && channel.nil?
    fail ArgumentError, "Missing the required parameter 'channel' when calling TemplatesApi.templates_update_template"
  end
  # verify the required parameter 'template_id' is set
  if @api_client.config.client_side_validation && template_id.nil?
    fail ArgumentError, "Missing the required parameter 'template_id' when calling TemplatesApi.templates_update_template"
  end
  # verify the required parameter 'template_patch_request' is set
  if @api_client.config.client_side_validation && template_patch_request.nil?
    fail ArgumentError, "Missing the required parameter 'template_patch_request' when calling TemplatesApi.templates_update_template"
  end
  # resource path
  local_var_path = '/notifications/{notificationId}/{channel}/templates/{templateId}'.sub('{' + 'notificationId' + '}', CGI.escape(notification_id.to_s)).sub('{' + 'channel' + '}', CGI.escape(channel.to_s)).sub('{' + 'templateId' + '}', CGI.escape(template_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(template_patch_request)

  # return_type
  return_type = opts[:debug_return_type] || 'Template'

  # auth_names (apiKey last so Bearer wins when multiple schemes set Authorization)
  auth_names = opts[:debug_auth_names] || ['endUserHashed', 'endUser', 'clientCredentials', 'apiKey']

  new_options = opts.merge(
    :operation => :"TemplatesApi.templates_update_template",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TemplatesApi#templates_update_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end