Class: WalmartApIs::NotificationsApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/walmart_ap_is/apis/notifications_api.rb

Overview

NotificationsApi

Constant Summary

Constants inherited from BaseApi

BaseApi::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseApi

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from WalmartApIs::BaseApi

Instance Method Details

#create_destination(body) ⇒ ApiResponse

TODO: type endpoint description here

Parameters:

  • body (Object)

    Required parameter: TODO: type description here

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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
# File 'lib/walmart_ap_is/apis/notifications_api.rb', line 43

def create_destination(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/notifications/v4/destinations',
                                 Server::DEFAULT1)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(APIHelper.method(:json_serialize))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(Channel.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             APIException)
                .local_error('403',
                             'Forbidden',
                             APIException)
                .local_error('404',
                             'Not Found',
                             APIException)
                .local_error('429',
                             'Too Many Requests',
                             APIException)
                .local_error('500',
                             'Internal Server Error',
                             APIException))
    .execute
end

#create_subscription(notification_type, body) ⇒ ApiResponse

TODO: type endpoint description here notification. Must be one of: EMAIL, WEBHOOKS, SMS, PULL, MOBILE_PUSH.

Parameters:

  • notification_type (String)

    Required parameter: The type of

  • body (Object)

    Required parameter: TODO: type description here

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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
# File 'lib/walmart_ap_is/apis/notifications_api.rb', line 192

def create_subscription(notification_type,
                        body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/notifications/v4/subscriptions/{notificationType}',
                                 Server::DEFAULT1)
               .template_param(new_parameter(notification_type, key: 'notificationType')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(APIHelper.method(:json_serialize))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:json_deserialize))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             APIException)
                .local_error('403',
                             'Forbidden',
                             APIException)
                .local_error('404',
                             'Not Found',
                             APIException)
                .local_error('429',
                             'Too Many Requests',
                             APIException)
                .local_error('500',
                             'Internal Server Error',
                             APIException))
    .execute
end

#delete_destination(destination_id) ⇒ ApiResponse

TODO: type endpoint description here destination that you want to delete.

Parameters:

  • destination_id (String)

    Required parameter: The identifier for the

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/walmart_ap_is/apis/notifications_api.rb', line 116

def delete_destination(destination_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/notifications/v4/destinations/{destinationId}',
                                 Server::DEFAULT1)
               .template_param(new_parameter(destination_id, key: 'destinationId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(Channel.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             APIException)
                .local_error('403',
                             'Forbidden',
                             APIException)
                .local_error('404',
                             'Not Found',
                             APIException)
                .local_error('429',
                             'Too Many Requests',
                             APIException)
                .local_error('500',
                             'Internal Server Error',
                             APIException))
    .execute
end

#delete_subscription_by_id(subscription_id, notification_type) ⇒ ApiResponse

TODO: type endpoint description here subscription that you want to delete. notification. Must be one of: EMAIL, WEBHOOKS, SMS, PULL, MOBILE_PUSH.

Parameters:

  • subscription_id (String)

    Required parameter: The identifier for the

  • notification_type (String)

    Required parameter: The type of

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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
# File 'lib/walmart_ap_is/apis/notifications_api.rb', line 316

def delete_subscription_by_id(subscription_id,
                              notification_type)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/notifications/v4/subscriptions/{notificationType}/{subscriptionId}',
                                 Server::DEFAULT1)
               .template_param(new_parameter(subscription_id, key: 'subscriptionId')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(notification_type, key: 'notificationType')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:json_deserialize))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             APIException)
                .local_error('403',
                             'Forbidden',
                             APIException)
                .local_error('404',
                             'Not Found',
                             APIException)
                .local_error('429',
                             'Too Many Requests',
                             APIException)
                .local_error('500',
                             'Internal Server Error',
                             APIException))
    .execute
end

#get_destination(destination_id) ⇒ ApiResponse

TODO: type endpoint description here generated when you created the destination.

Parameters:

  • destination_id (String)

    Required parameter: The identifier

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/walmart_ap_is/apis/notifications_api.rb', line 80

def get_destination(destination_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/notifications/v4/destinations/{destinationId}',
                                 Server::DEFAULT1)
               .template_param(new_parameter(destination_id, key: 'destinationId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(Channel.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             APIException)
                .local_error('403',
                             'Forbidden',
                             APIException)
                .local_error('404',
                             'Not Found',
                             APIException)
                .local_error('429',
                             'Too Many Requests',
                             APIException)
                .local_error('500',
                             'Internal Server Error',
                             APIException))
    .execute
end

#get_destinationsApiResponse

TODO: type endpoint description here

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/walmart_ap_is/apis/notifications_api.rb', line 11

def get_destinations
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/notifications/v4/destinations',
                                 Server::DEFAULT1)
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ChannelList.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             APIException)
                .local_error('403',
                             'Forbidden',
                             APIException)
                .local_error('404',
                             'Not Found',
                             APIException)
                .local_error('429',
                             'Too Many Requests',
                             APIException)
                .local_error('500',
                             'Internal Server Error',
                             APIException))
    .execute
end

#get_subscription(notification_type, payload_version: nil) ⇒ ApiResponse

TODO: type endpoint description here notification. Must be one of: EMAIL, WEBHOOKS, SMS, PULL, MOBILE_PUSH. payload object to be used in the notification.

Parameters:

  • notification_type (String)

    Required parameter: The type of

  • payload_version (String) (defaults to: nil)

    Optional parameter: The version of the

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



154
155
156
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
# File 'lib/walmart_ap_is/apis/notifications_api.rb', line 154

def get_subscription(notification_type,
                     payload_version: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/notifications/v4/subscriptions/{notificationType}',
                                 Server::DEFAULT1)
               .template_param(new_parameter(notification_type, key: 'notificationType')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(payload_version, key: 'payloadVersion'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:json_deserialize))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             APIException)
                .local_error('403',
                             'Forbidden',
                             APIException)
                .local_error('404',
                             'Not Found',
                             APIException)
                .local_error('429',
                             'Too Many Requests',
                             APIException)
                .local_error('500',
                             'Internal Server Error',
                             APIException))
    .execute
end

#get_subscription_by_id(subscription_id, notification_type) ⇒ ApiResponse

TODO: type endpoint description here subscription that you want to get. notification. Must be one of: EMAIL, WEBHOOKS, SMS, PULL, MOBILE_PUSH.

Parameters:

  • subscription_id (String)

    Required parameter: The identifier for the

  • notification_type (String)

    Required parameter: The type of

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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
# File 'lib/walmart_ap_is/apis/notifications_api.rb', line 275

def get_subscription_by_id(subscription_id,
                           notification_type)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/notifications/v4/subscriptions/{notificationType}/{subscriptionId}',
                                 Server::DEFAULT1)
               .template_param(new_parameter(subscription_id, key: 'subscriptionId')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(notification_type, key: 'notificationType')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:json_deserialize))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             APIException)
                .local_error('403',
                             'Forbidden',
                             APIException)
                .local_error('404',
                             'Not Found',
                             APIException)
                .local_error('429',
                             'Too Many Requests',
                             APIException)
                .local_error('500',
                             'Internal Server Error',
                             APIException))
    .execute
end

#send_test_notification(notification_type, body) ⇒ ApiResponse

TODO: type endpoint description here notification. Must be one of: EMAIL, WEBHOOKS, SMS, PULL, MOBILE_PUSH.

Parameters:

  • notification_type (String)

    Required parameter: The type of

  • body (Object)

    Required parameter: TODO: type description here

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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
# File 'lib/walmart_ap_is/apis/notifications_api.rb', line 233

def send_test_notification(notification_type,
                           body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/notifications/v4/subscriptions/{notificationType}/testNotification',
                                 Server::DEFAULT1)
               .template_param(new_parameter(notification_type, key: 'notificationType')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(APIHelper.method(:json_serialize))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:json_deserialize))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             APIException)
                .local_error('403',
                             'Forbidden',
                             APIException)
                .local_error('404',
                             'Not Found',
                             APIException)
                .local_error('429',
                             'Too Many Requests',
                             APIException)
                .local_error('500',
                             'Internal Server Error',
                             APIException))
    .execute
end