Class: Zyphr::PushApi

Inherits:
Object
  • Object
show all
Defined in:
lib/zyphr/api/push_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ PushApi

Returns a new instance of PushApi.



19
20
21
# File 'lib/zyphr/api/push_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/zyphr/api/push_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_push(id, opts = {}) ⇒ PushDetailResponse

Get push notification details Get a specific push notification message with delivery events.

Parameters:

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

    the optional parameters

Returns:



27
28
29
30
# File 'lib/zyphr/api/push_api.rb', line 27

def get_push(id, opts = {})
  data, _status_code, _headers = get_push_with_http_info(id, opts)
  data
end

#get_push_stats(opts = {}) ⇒ PushStatsResponse

Get push notification statistics Get aggregated push notification statistics for the account.

Parameters:

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

    the optional parameters

Returns:



89
90
91
92
# File 'lib/zyphr/api/push_api.rb', line 89

def get_push_stats(opts = {})
  data, _status_code, _headers = get_push_stats_with_http_info(opts)
  data
end

#get_push_stats_with_http_info(opts = {}) ⇒ Array<(PushStatsResponse, Integer, Hash)>

Get push notification statistics Get aggregated push notification statistics for the account.

Parameters:

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

    the optional parameters

Returns:

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

    PushStatsResponse data, response status code and response headers



98
99
100
101
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
# File 'lib/zyphr/api/push_api.rb', line 98

def get_push_stats_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PushApi.get_push_stats ...'
  end
  # resource path
  local_var_path = '/push/stats'

  # 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] || 'PushStatsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"PushApi.get_push_stats",
    :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: PushApi#get_push_stats\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_push_with_http_info(id, opts = {}) ⇒ Array<(PushDetailResponse, Integer, Hash)>

Get push notification details Get a specific push notification message with delivery events.

Parameters:

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

    the optional parameters

Returns:

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

    PushDetailResponse data, response status code and response headers



37
38
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
# File 'lib/zyphr/api/push_api.rb', line 37

def get_push_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PushApi.get_push ...'
  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 PushApi.get_push"
  end
  # resource path
  local_var_path = '/push/{id}'.sub('{' + 'id' + '}', CGI.escape(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] || 'PushDetailResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"PushApi.get_push",
    :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: PushApi#get_push\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_device_push_topics(id, opts = {}) ⇒ DevicePushTopicListResponse

List topics for a device Get all push notification topics a specific device is subscribed to.

Parameters:

  • id (String)

    Device ID

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

    the optional parameters

Returns:



147
148
149
150
# File 'lib/zyphr/api/push_api.rb', line 147

def list_device_push_topics(id, opts = {})
  data, _status_code, _headers = list_device_push_topics_with_http_info(id, opts)
  data
end

#list_device_push_topics_with_http_info(id, opts = {}) ⇒ Array<(DevicePushTopicListResponse, Integer, Hash)>

List topics for a device Get all push notification topics a specific device is subscribed to.

Parameters:

  • id (String)

    Device ID

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

    the optional parameters

Returns:

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

    DevicePushTopicListResponse data, response status code and response headers



157
158
159
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
200
201
202
203
# File 'lib/zyphr/api/push_api.rb', line 157

def list_device_push_topics_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PushApi.list_device_push_topics ...'
  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 PushApi.list_device_push_topics"
  end
  # resource path
  local_var_path = '/push/devices/{id}/topics'.sub('{' + 'id' + '}', CGI.escape(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] || 'DevicePushTopicListResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"PushApi.list_device_push_topics",
    :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: PushApi#list_device_push_topics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_push(opts = {}) ⇒ PushListResponse

List push notifications List push notification messages for the account with optional filtering.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :user_id (String)

    Filter by subscriber/user ID

  • :device_id (String)

    Filter by device ID

  • :status (String)

    Filter by message status

  • :limit (Integer)

    Maximum number of results (default to 50)

  • :offset (Integer)

    Number of results to skip (default to 0)

Returns:



214
215
216
217
# File 'lib/zyphr/api/push_api.rb', line 214

def list_push(opts = {})
  data, _status_code, _headers = list_push_with_http_info(opts)
  data
end

#list_push_topic_devices(key, opts = {}) ⇒ PushTopicDeviceListResponse

List devices subscribed to a topic Get all devices subscribed to a push notification topic with pagination.

Parameters:

  • key (String)

    Topic key

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Maximum number of results (default to 100)

  • :offset (Integer)

    Number of results to skip (default to 0)

Returns:



288
289
290
291
# File 'lib/zyphr/api/push_api.rb', line 288

def list_push_topic_devices(key, opts = {})
  data, _status_code, _headers = list_push_topic_devices_with_http_info(key, opts)
  data
end

#list_push_topic_devices_with_http_info(key, opts = {}) ⇒ Array<(PushTopicDeviceListResponse, Integer, Hash)>

List devices subscribed to a topic Get all devices subscribed to a push notification topic with pagination.

Parameters:

  • key (String)

    Topic key

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Maximum number of results (default to 100)

  • :offset (Integer)

    Number of results to skip (default to 0)

Returns:

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

    PushTopicDeviceListResponse data, response status code and response headers



300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
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
# File 'lib/zyphr/api/push_api.rb', line 300

def list_push_topic_devices_with_http_info(key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PushApi.list_push_topic_devices ...'
  end
  # verify the required parameter 'key' is set
  if @api_client.config.client_side_validation && key.nil?
    fail ArgumentError, "Missing the required parameter 'key' when calling PushApi.list_push_topic_devices"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling PushApi.list_push_topic_devices, must be smaller than or equal to 1000.'
  end

  # resource path
  local_var_path = '/push/topics/{key}/devices'.sub('{' + 'key' + '}', CGI.escape(key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?

  # 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] || 'PushTopicDeviceListResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"PushApi.list_push_topic_devices",
    :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: PushApi#list_push_topic_devices\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_push_with_http_info(opts = {}) ⇒ Array<(PushListResponse, Integer, Hash)>

List push notifications List push notification messages for the account with optional filtering.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :user_id (String)

    Filter by subscriber/user ID

  • :device_id (String)

    Filter by device ID

  • :status (String)

    Filter by message status

  • :limit (Integer)

    Maximum number of results (default to 50)

  • :offset (Integer)

    Number of results to skip (default to 0)

Returns:

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

    PushListResponse data, response status code and response headers



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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
# File 'lib/zyphr/api/push_api.rb', line 228

def list_push_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PushApi.list_push ...'
  end
  allowable_values = ["pending", "queued", "sent", "delivered", "failed"]
  if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
    fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/push'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'user_id'] = opts[:'user_id'] if !opts[:'user_id'].nil?
  query_params[:'device_id'] = opts[:'device_id'] if !opts[:'device_id'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?

  # 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] || 'PushListResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"PushApi.list_push",
    :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: PushApi#list_push\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_push(send_push_request, opts = {}) ⇒ SendPushResponse

Send a push notification Send a push notification to a specific device, multiple devices, all devices for a subscriber, or to a topic. Supports scheduling via ‘send_at` or `delay`.

Parameters:

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

    the optional parameters

Returns:



359
360
361
362
# File 'lib/zyphr/api/push_api.rb', line 359

def send_push(send_push_request, opts = {})
  data, _status_code, _headers = send_push_with_http_info(send_push_request, opts)
  data
end

#send_push_to_topic(key, send_push_to_topic_request, opts = {}) ⇒ SendPushToTopicResponse

Send push notification to a topic Send a push notification to all devices subscribed to a topic.

Parameters:

  • key (String)

    Topic key

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

    the optional parameters

Returns:



428
429
430
431
# File 'lib/zyphr/api/push_api.rb', line 428

def send_push_to_topic(key, send_push_to_topic_request, opts = {})
  data, _status_code, _headers = send_push_to_topic_with_http_info(key, send_push_to_topic_request, opts)
  data
end

#send_push_to_topic_with_http_info(key, send_push_to_topic_request, opts = {}) ⇒ Array<(SendPushToTopicResponse, Integer, Hash)>

Send push notification to a topic Send a push notification to all devices subscribed to a topic.

Parameters:

  • key (String)

    Topic key

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

    the optional parameters

Returns:

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

    SendPushToTopicResponse data, response status code and response headers



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
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
# File 'lib/zyphr/api/push_api.rb', line 439

def send_push_to_topic_with_http_info(key, send_push_to_topic_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PushApi.send_push_to_topic ...'
  end
  # verify the required parameter 'key' is set
  if @api_client.config.client_side_validation && key.nil?
    fail ArgumentError, "Missing the required parameter 'key' when calling PushApi.send_push_to_topic"
  end
  # verify the required parameter 'send_push_to_topic_request' is set
  if @api_client.config.client_side_validation && send_push_to_topic_request.nil?
    fail ArgumentError, "Missing the required parameter 'send_push_to_topic_request' when calling PushApi.send_push_to_topic"
  end
  # resource path
  local_var_path = '/push/topics/{key}/send'.sub('{' + 'key' + '}', CGI.escape(key.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(send_push_to_topic_request)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"PushApi.send_push_to_topic",
    :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: PushApi#send_push_to_topic\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_push_with_http_info(send_push_request, opts = {}) ⇒ Array<(SendPushResponse, Integer, Hash)>

Send a push notification Send a push notification to a specific device, multiple devices, all devices for a subscriber, or to a topic. Supports scheduling via &#x60;send_at&#x60; or &#x60;delay&#x60;.

Parameters:

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

    the optional parameters

Returns:

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

    SendPushResponse data, response status code and response headers



369
370
371
372
373
374
375
376
377
378
379
380
381
382
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/zyphr/api/push_api.rb', line 369

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

  # 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(send_push_request)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"PushApi.send_push",
    :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: PushApi#send_push\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#subscribe_push_topic(key, subscribe_push_topic_request, opts = {}) ⇒ PushTopicSubscribeResponse

Subscribe devices to a push topic Subscribe one or more devices to a push notification topic. Maximum 100 devices per request.

Parameters:

  • key (String)

    Topic key

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

    the optional parameters

Returns:



502
503
504
505
# File 'lib/zyphr/api/push_api.rb', line 502

def subscribe_push_topic(key, subscribe_push_topic_request, opts = {})
  data, _status_code, _headers = subscribe_push_topic_with_http_info(key, subscribe_push_topic_request, opts)
  data
end

#subscribe_push_topic_with_http_info(key, subscribe_push_topic_request, opts = {}) ⇒ Array<(PushTopicSubscribeResponse, Integer, Hash)>

Subscribe devices to a push topic Subscribe one or more devices to a push notification topic. Maximum 100 devices per request.

Parameters:

  • key (String)

    Topic key

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

    the optional parameters

Returns:

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

    PushTopicSubscribeResponse data, response status code and response headers



513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
# File 'lib/zyphr/api/push_api.rb', line 513

def subscribe_push_topic_with_http_info(key, subscribe_push_topic_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PushApi.subscribe_push_topic ...'
  end
  # verify the required parameter 'key' is set
  if @api_client.config.client_side_validation && key.nil?
    fail ArgumentError, "Missing the required parameter 'key' when calling PushApi.subscribe_push_topic"
  end
  # verify the required parameter 'subscribe_push_topic_request' is set
  if @api_client.config.client_side_validation && subscribe_push_topic_request.nil?
    fail ArgumentError, "Missing the required parameter 'subscribe_push_topic_request' when calling PushApi.subscribe_push_topic"
  end
  # resource path
  local_var_path = '/push/topics/{key}/subscribe'.sub('{' + 'key' + '}', CGI.escape(key.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(subscribe_push_topic_request)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"PushApi.subscribe_push_topic",
    :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: PushApi#subscribe_push_topic\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#unsubscribe_push_topic(key, subscribe_push_topic_request, opts = {}) ⇒ PushTopicUnsubscribeResponse

Unsubscribe devices from a push topic Unsubscribe one or more devices from a push notification topic. Maximum 100 devices per request.

Parameters:

  • key (String)

    Topic key

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

    the optional parameters

Returns:



576
577
578
579
# File 'lib/zyphr/api/push_api.rb', line 576

def unsubscribe_push_topic(key, subscribe_push_topic_request, opts = {})
  data, _status_code, _headers = unsubscribe_push_topic_with_http_info(key, subscribe_push_topic_request, opts)
  data
end

#unsubscribe_push_topic_with_http_info(key, subscribe_push_topic_request, opts = {}) ⇒ Array<(PushTopicUnsubscribeResponse, Integer, Hash)>

Unsubscribe devices from a push topic Unsubscribe one or more devices from a push notification topic. Maximum 100 devices per request.

Parameters:

  • key (String)

    Topic key

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

    the optional parameters

Returns:



587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
# File 'lib/zyphr/api/push_api.rb', line 587

def unsubscribe_push_topic_with_http_info(key, subscribe_push_topic_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PushApi.unsubscribe_push_topic ...'
  end
  # verify the required parameter 'key' is set
  if @api_client.config.client_side_validation && key.nil?
    fail ArgumentError, "Missing the required parameter 'key' when calling PushApi.unsubscribe_push_topic"
  end
  # verify the required parameter 'subscribe_push_topic_request' is set
  if @api_client.config.client_side_validation && subscribe_push_topic_request.nil?
    fail ArgumentError, "Missing the required parameter 'subscribe_push_topic_request' when calling PushApi.unsubscribe_push_topic"
  end
  # resource path
  local_var_path = '/push/topics/{key}/unsubscribe'.sub('{' + 'key' + '}', CGI.escape(key.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(subscribe_push_topic_request)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"PushApi.unsubscribe_push_topic",
    :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: PushApi#unsubscribe_push_topic\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end