Class: Pingram::UserApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ UserApi

Returns a new instance of UserApi.



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

def api_client
  @api_client
end

Instance Method Details

#user_get_account_metadata(opts = {}) ⇒ GetAccountMetadataResponse

Get account-level metadata including logo, VAPID key, and web push status

Parameters:

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

    the optional parameters

Returns:



25
26
27
28
# File 'lib/pingram/api/user_api.rb', line 25

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

#user_get_account_metadata_with_http_info(opts = {}) ⇒ Array<(GetAccountMetadataResponse, Integer, Hash)>

Get account-level metadata including logo, VAPID key, and web push status

Parameters:

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

    the optional parameters

Returns:

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

    GetAccountMetadataResponse data, response status code and response headers



33
34
35
36
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
# File 'lib/pingram/api/user_api.rb', line 33

def (opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserApi.user_get_account_metadata ...'
  end
  # resource path
  local_var_path = '/users/account-metadata'

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

  # 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 => :"UserApi.user_get_account_metadata",
    :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: UserApi#user_get_account_metadata\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#user_get_in_app_notifications(opts = {}) ⇒ GetInappNotificationsResponse

Get in-app notifications for a user

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :before (String)

    Timestamp or ISO date to fetch notifications before

  • :count (Float)

    Number of notifications to return (default 10)

Returns:



82
83
84
85
# File 'lib/pingram/api/user_api.rb', line 82

def user_get_in_app_notifications(opts = {})
  data, _status_code, _headers = user_get_in_app_notifications_with_http_info(opts)
  data
end

#user_get_in_app_notifications_with_http_info(opts = {}) ⇒ Array<(GetInappNotificationsResponse, Integer, Hash)>

Get in-app notifications for a user

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :before (String)

    Timestamp or ISO date to fetch notifications before

  • :count (Float)

    Number of notifications to return (default 10)

Returns:



92
93
94
95
96
97
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
# File 'lib/pingram/api/user_api.rb', line 92

def user_get_in_app_notifications_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserApi.user_get_in_app_notifications ...'
  end
  # resource path
  local_var_path = '/user/inapp'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?
  query_params[:'count'] = opts[:'count'] if !opts[:'count'].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] || 'GetInappNotificationsResponse'

  # 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 => :"UserApi.user_get_in_app_notifications",
    :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: UserApi#user_get_in_app_notifications\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#user_get_in_app_unread_count(opts = {}) ⇒ InappUnreadCountResponse

Get the count of unread in-app notifications for a user

Parameters:

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

    the optional parameters

Returns:



141
142
143
144
# File 'lib/pingram/api/user_api.rb', line 141

def user_get_in_app_unread_count(opts = {})
  data, _status_code, _headers = user_get_in_app_unread_count_with_http_info(opts)
  data
end

#user_get_in_app_unread_count_with_http_info(opts = {}) ⇒ Array<(InappUnreadCountResponse, Integer, Hash)>

Get the count of unread in-app notifications for a user

Parameters:

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

    the optional parameters

Returns:

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

    InappUnreadCountResponse data, response status code and response headers



149
150
151
152
153
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
186
187
188
189
190
191
# File 'lib/pingram/api/user_api.rb', line 149

def user_get_in_app_unread_count_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserApi.user_get_in_app_unread_count ...'
  end
  # resource path
  local_var_path = '/user/inapp/unread'

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

  # 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 => :"UserApi.user_get_in_app_unread_count",
    :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: UserApi#user_get_in_app_unread_count\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#user_get_user(user_id, opts = {}) ⇒ User

Get a user by ID. All users exist implicitly, returns basic user object if not found in DB.

Parameters:

  • user_id (String)

    User ID

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

    the optional parameters

Returns:



197
198
199
200
# File 'lib/pingram/api/user_api.rb', line 197

def user_get_user(user_id, opts = {})
  data, _status_code, _headers = user_get_user_with_http_info(user_id, opts)
  data
end

#user_get_user_with_http_info(user_id, opts = {}) ⇒ Array<(User, Integer, Hash)>

Get a user by ID. All users exist implicitly, returns basic user object if not found in DB.

Parameters:

  • user_id (String)

    User ID

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

    the optional parameters

Returns:

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

    User data, response status code and response headers



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
243
244
245
246
247
248
249
250
251
252
# File 'lib/pingram/api/user_api.rb', line 206

def user_get_user_with_http_info(user_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserApi.user_get_user ...'
  end
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling UserApi.user_get_user"
  end
  # resource path
  local_var_path = '/users/{userId}'.sub('{' + 'userId' + '}', CGI.escape(user_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] || 'User'

  # 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 => :"UserApi.user_get_user",
    :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: UserApi#user_get_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#user_identify(user_id, post_user_request, opts = {}) ⇒ User

Create or update a user with the given ID. Updates lastSeenTime automatically.

Parameters:

  • user_id (String)

    User ID

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

    the optional parameters

Returns:



259
260
261
262
# File 'lib/pingram/api/user_api.rb', line 259

def user_identify(user_id, post_user_request, opts = {})
  data, _status_code, _headers = user_identify_with_http_info(user_id, post_user_request, opts)
  data
end

#user_identify_with_http_info(user_id, post_user_request, opts = {}) ⇒ Array<(User, Integer, Hash)>

Create or update a user with the given ID. Updates lastSeenTime automatically.

Parameters:

  • user_id (String)

    User ID

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

    the optional parameters

Returns:

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

    User data, response status code and response headers



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
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
# File 'lib/pingram/api/user_api.rb', line 269

def user_identify_with_http_info(user_id, post_user_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserApi.user_identify ...'
  end
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling UserApi.user_identify"
  end
  # verify the required parameter 'post_user_request' is set
  if @api_client.config.client_side_validation && post_user_request.nil?
    fail ArgumentError, "Missing the required parameter 'post_user_request' when calling UserApi.user_identify"
  end
  # resource path
  local_var_path = '/users/{userId}'.sub('{' + 'userId' + '}', CGI.escape(user_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(post_user_request)

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

  # 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 => :"UserApi.user_identify",
    :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: UserApi#user_identify\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#user_mark_in_app_notifications_as_seen(in_app_notification_unread_clear_request, opts = {}) ⇒ SuccessResponse

Mark in-app web notifications as seen/read for a user

Parameters:

Returns:



330
331
332
333
# File 'lib/pingram/api/user_api.rb', line 330

def user_mark_in_app_notifications_as_seen(in_app_notification_unread_clear_request, opts = {})
  data, _status_code, _headers = user_mark_in_app_notifications_as_seen_with_http_info(in_app_notification_unread_clear_request, opts)
  data
end

#user_mark_in_app_notifications_as_seen_with_http_info(in_app_notification_unread_clear_request, opts = {}) ⇒ Array<(SuccessResponse, Integer, Hash)>

Mark in-app web notifications as seen/read for a user

Parameters:

Returns:

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

    SuccessResponse data, response status code and response headers



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
388
389
390
# File 'lib/pingram/api/user_api.rb', line 339

def user_mark_in_app_notifications_as_seen_with_http_info(in_app_notification_unread_clear_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserApi.user_mark_in_app_notifications_as_seen ...'
  end
  # verify the required parameter 'in_app_notification_unread_clear_request' is set
  if @api_client.config.client_side_validation && in_app_notification_unread_clear_request.nil?
    fail ArgumentError, "Missing the required parameter 'in_app_notification_unread_clear_request' when calling UserApi.user_mark_in_app_notifications_as_seen"
  end
  # resource path
  local_var_path = '/user/inapp/unread'

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

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

  # 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 => :"UserApi.user_mark_in_app_notifications_as_seen",
    :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: UserApi#user_mark_in_app_notifications_as_seen\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#user_update_in_app_notification_status(in_app_notification_patch_request, opts = {}) ⇒ SuccessResponse

Update in-app web notification status (opened, archived, clicked, etc.)

Parameters:

Returns:



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

def user_update_in_app_notification_status(in_app_notification_patch_request, opts = {})
  data, _status_code, _headers = user_update_in_app_notification_status_with_http_info(in_app_notification_patch_request, opts)
  data
end

#user_update_in_app_notification_status_with_http_info(in_app_notification_patch_request, opts = {}) ⇒ Array<(SuccessResponse, Integer, Hash)>

Update in-app web notification status (opened, archived, clicked, etc.)

Parameters:

Returns:

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

    SuccessResponse data, response status code and response headers



405
406
407
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
# File 'lib/pingram/api/user_api.rb', line 405

def user_update_in_app_notification_status_with_http_info(in_app_notification_patch_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserApi.user_update_in_app_notification_status ...'
  end
  # verify the required parameter 'in_app_notification_patch_request' is set
  if @api_client.config.client_side_validation && in_app_notification_patch_request.nil?
    fail ArgumentError, "Missing the required parameter 'in_app_notification_patch_request' when calling UserApi.user_update_in_app_notification_status"
  end
  # resource path
  local_var_path = '/user/inapp'

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

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

  # 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 => :"UserApi.user_update_in_app_notification_status",
    :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: UserApi#user_update_in_app_notification_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end