Class: Gopad::UserApi

Inherits:
Object
  • Object
show all
Defined in:
lib/gopad/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.



17
18
19
# File 'lib/gopad/api/user_api.rb', line 17

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



15
16
17
# File 'lib/gopad/api/user_api.rb', line 15

def api_client
  @api_client
end

Instance Method Details

#attach_user_to_group(user_id, permit_user_group_request, opts = {}) ⇒ Notification

Attach a group to user

Parameters:

  • user_id (String)

    A user identifier or slug

  • permit_user_group_request (PermitUserGroupRequest)

    The user group data to permit

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

    the optional parameters

Returns:



26
27
28
29
# File 'lib/gopad/api/user_api.rb', line 26

def attach_user_to_group(user_id, permit_user_group_request, opts = {})
  data, _status_code, _headers = attach_user_to_group_with_http_info(user_id, permit_user_group_request, opts)
  data
end

#attach_user_to_group_with_http_info(user_id, permit_user_group_request, opts = {}) ⇒ Array<(Notification, Integer, Hash)>

Attach a group to user

Parameters:

  • user_id (String)

    A user identifier or slug

  • permit_user_group_request (PermitUserGroupRequest)

    The user group data to permit

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

    the optional parameters

Returns:

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

    Notification data, response status code and response headers



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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/gopad/api/user_api.rb', line 36

def attach_user_to_group_with_http_info(user_id, permit_user_group_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserApi.attach_user_to_group ...'
  end
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    raise ArgumentError, "Missing the required parameter 'user_id' when calling UserApi.attach_user_to_group"
  end
  # verify the required parameter 'permit_user_group_request' is set
  if @api_client.config.client_side_validation && permit_user_group_request.nil?
    raise ArgumentError, "Missing the required parameter 'permit_user_group_request' when calling UserApi.attach_user_to_group"
  end

  # resource path
  local_var_path = '/users/{user_id}/groups'.sub('{' + 'user_id' + '}', 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'])
  unless 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(permit_user_group_request)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || %w[Basic Header Bearer]

  new_options = opts.merge(
    operation: :'UserApi.attach_user_to_group',
    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#attach_user_to_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  [data, status_code, headers]
end

#create_user(create_user_request, opts = {}) ⇒ User

Create a new user

Parameters:

  • create_user_request (CreateUserRequest)

    The user data to create

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

    the optional parameters

Returns:



98
99
100
101
# File 'lib/gopad/api/user_api.rb', line 98

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

#create_user_with_http_info(create_user_request, opts = {}) ⇒ Array<(User, Integer, Hash)>

Create a new user

Parameters:

  • create_user_request (CreateUserRequest)

    The user data to create

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

    the optional parameters

Returns:

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

    User data, response status code and response headers



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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/gopad/api/user_api.rb', line 107

def create_user_with_http_info(create_user_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserApi.create_user ...'
  end
  # verify the required parameter 'create_user_request' is set
  if @api_client.config.client_side_validation && create_user_request.nil?
    raise ArgumentError, "Missing the required parameter 'create_user_request' when calling UserApi.create_user"
  end

  # resource path
  local_var_path = '/users'

  # 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'])
  unless 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(create_user_request)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || %w[Basic Header Bearer]

  new_options = opts.merge(
    operation: :'UserApi.create_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(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UserApi#create_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  [data, status_code, headers]
end

#delete_user(user_id, opts = {}) ⇒ Notification

Delete a specific user

Parameters:

  • user_id (String)

    A user identifier or slug

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

    the optional parameters

Returns:



165
166
167
168
# File 'lib/gopad/api/user_api.rb', line 165

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

#delete_user_from_group(user_id, delete_user_from_group_request, opts = {}) ⇒ Notification

Unlink a group from user

Parameters:

  • user_id (String)

    A user identifier or slug

  • delete_user_from_group_request (DeleteUserFromGroupRequest)

    The user group data to unlink

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

    the optional parameters

Returns:



228
229
230
231
# File 'lib/gopad/api/user_api.rb', line 228

def delete_user_from_group(user_id, delete_user_from_group_request, opts = {})
  data, _status_code, _headers = delete_user_from_group_with_http_info(user_id, delete_user_from_group_request, opts)
  data
end

#delete_user_from_group_with_http_info(user_id, delete_user_from_group_request, opts = {}) ⇒ Array<(Notification, Integer, Hash)>

Unlink a group from user

Parameters:

  • user_id (String)

    A user identifier or slug

  • delete_user_from_group_request (DeleteUserFromGroupRequest)

    The user group data to unlink

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

    the optional parameters

Returns:

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

    Notification data, response status code and response headers



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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
# File 'lib/gopad/api/user_api.rb', line 238

def delete_user_from_group_with_http_info(user_id, delete_user_from_group_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserApi.delete_user_from_group ...'
  end
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    raise ArgumentError, "Missing the required parameter 'user_id' when calling UserApi.delete_user_from_group"
  end
  # verify the required parameter 'delete_user_from_group_request' is set
  if @api_client.config.client_side_validation && delete_user_from_group_request.nil?
    raise ArgumentError, "Missing the required parameter 'delete_user_from_group_request' when calling UserApi.delete_user_from_group"
  end

  # resource path
  local_var_path = '/users/{user_id}/groups'.sub('{' + 'user_id' + '}', 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'])
  unless 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(delete_user_from_group_request)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || %w[Basic Header Bearer]

  new_options = opts.merge(
    operation: :'UserApi.delete_user_from_group',
    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: UserApi#delete_user_from_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  [data, status_code, headers]
end

#delete_user_with_http_info(user_id, opts = {}) ⇒ Array<(Notification, Integer, Hash)>

Delete a specific user

Parameters:

  • user_id (String)

    A user identifier or slug

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

    the optional parameters

Returns:

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

    Notification data, response status code and response headers



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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/gopad/api/user_api.rb', line 174

def delete_user_with_http_info(user_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserApi.delete_user ...'
  end
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    raise ArgumentError, "Missing the required parameter 'user_id' when calling UserApi.delete_user"
  end

  # resource path
  local_var_path = '/users/{user_id}'.sub('{' + 'user_id' + '}', 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] || 'Notification'

  # auth_names
  auth_names = opts[:debug_auth_names] || %w[Basic Header Bearer]

  new_options = opts.merge(
    operation: :'UserApi.delete_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(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UserApi#delete_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  [data, status_code, headers]
end

#list_user_groups(user_id, opts = {}) ⇒ ListUserGroups200Response

Fetch all groups attached to user

Parameters:

  • user_id (String)

    A user identifier or slug

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

    the optional parameters

Options Hash (opts):

  • :search (String)

    Search query

  • :sort (String)

    Sorting column

  • :order (String)

    Sorting order (default to ‘asc’)

  • :limit (Integer)

    Paging limit (default to 100)

  • :offset (Integer)

    Paging offset (default to 0)

Returns:



305
306
307
308
# File 'lib/gopad/api/user_api.rb', line 305

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

#list_user_groups_with_http_info(user_id, opts = {}) ⇒ Array<(ListUserGroups200Response, Integer, Hash)>

Fetch all groups attached to user

Parameters:

  • user_id (String)

    A user identifier or slug

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

    the optional parameters

Options Hash (opts):

  • :search (String)

    Search query

  • :sort (String)

    Sorting column

  • :order (String)

    Sorting order (default to ‘asc’)

  • :limit (Integer)

    Paging limit (default to 100)

  • :offset (Integer)

    Paging offset (default to 0)

Returns:

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

    ListUserGroups200Response data, response status code and response headers



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
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
# File 'lib/gopad/api/user_api.rb', line 319

def list_user_groups_with_http_info(user_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserApi.list_user_groups ...'
  end
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    raise ArgumentError, "Missing the required parameter 'user_id' when calling UserApi.list_user_groups"
  end

  allowable_values = %w[asc desc]
  if @api_client.config.client_side_validation && opts[:order] && !allowable_values.include?(opts[:order])
    raise ArgumentError, "invalid value for \"order\", must be one of #{allowable_values}"
  end

  # resource path
  local_var_path = '/users/{user_id}/groups'.sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:search] = opts[:search] unless opts[:search].nil?
  query_params[:sort] = opts[:sort] unless opts[:sort].nil?
  query_params[:order] = opts[:order] unless opts[:order].nil?
  query_params[:limit] = opts[:limit] unless opts[:limit].nil?
  query_params[:offset] = opts[:offset] unless 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] || 'ListUserGroups200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || %w[Basic Header Bearer]

  new_options = opts.merge(
    operation: :'UserApi.list_user_groups',
    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#list_user_groups\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  [data, status_code, headers]
end

#list_users(opts = {}) ⇒ ListUsers200Response

Fetch all available users

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :search (String)

    Search query

  • :sort (String)

    Sorting column

  • :order (String)

    Sorting order (default to ‘asc’)

  • :limit (Integer)

    Paging limit (default to 100)

  • :offset (Integer)

    Paging offset (default to 0)

Returns:



386
387
388
389
# File 'lib/gopad/api/user_api.rb', line 386

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

#list_users_with_http_info(opts = {}) ⇒ Array<(ListUsers200Response, Integer, Hash)>

Fetch all available users

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :search (String)

    Search query

  • :sort (String)

    Sorting column

  • :order (String)

    Sorting order (default to ‘asc’)

  • :limit (Integer)

    Paging limit (default to 100)

  • :offset (Integer)

    Paging offset (default to 0)

Returns:

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

    ListUsers200Response data, response status code and response headers



399
400
401
402
403
404
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
# File 'lib/gopad/api/user_api.rb', line 399

def list_users_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserApi.list_users ...'
  end
  allowable_values = %w[asc desc]
  if @api_client.config.client_side_validation && opts[:order] && !allowable_values.include?(opts[:order])
    raise ArgumentError, "invalid value for \"order\", must be one of #{allowable_values}"
  end

  # resource path
  local_var_path = '/users'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:search] = opts[:search] unless opts[:search].nil?
  query_params[:sort] = opts[:sort] unless opts[:sort].nil?
  query_params[:order] = opts[:order] unless opts[:order].nil?
  query_params[:limit] = opts[:limit] unless opts[:limit].nil?
  query_params[:offset] = opts[:offset] unless 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] || 'ListUsers200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || %w[Basic Header Bearer]

  new_options = opts.merge(
    operation: :'UserApi.list_users',
    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#list_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  [data, status_code, headers]
end

#permit_user_group(user_id, permit_user_group_request, opts = {}) ⇒ Notification

Update group perms for user

Parameters:

  • user_id (String)

    A user identifier or slug

  • permit_user_group_request (PermitUserGroupRequest)

    The user group data to permit

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

    the optional parameters

Returns:



458
459
460
461
# File 'lib/gopad/api/user_api.rb', line 458

def permit_user_group(user_id, permit_user_group_request, opts = {})
  data, _status_code, _headers = permit_user_group_with_http_info(user_id, permit_user_group_request, opts)
  data
end

#permit_user_group_with_http_info(user_id, permit_user_group_request, opts = {}) ⇒ Array<(Notification, Integer, Hash)>

Update group perms for user

Parameters:

  • user_id (String)

    A user identifier or slug

  • permit_user_group_request (PermitUserGroupRequest)

    The user group data to permit

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

    the optional parameters

Returns:

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

    Notification data, response status code and response headers



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
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
# File 'lib/gopad/api/user_api.rb', line 468

def permit_user_group_with_http_info(user_id, permit_user_group_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserApi.permit_user_group ...'
  end
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    raise ArgumentError, "Missing the required parameter 'user_id' when calling UserApi.permit_user_group"
  end
  # verify the required parameter 'permit_user_group_request' is set
  if @api_client.config.client_side_validation && permit_user_group_request.nil?
    raise ArgumentError, "Missing the required parameter 'permit_user_group_request' when calling UserApi.permit_user_group"
  end

  # resource path
  local_var_path = '/users/{user_id}/groups'.sub('{' + 'user_id' + '}', 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'])
  unless 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(permit_user_group_request)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || %w[Basic Header Bearer]

  new_options = opts.merge(
    operation: :'UserApi.permit_user_group',
    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(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UserApi#permit_user_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  [data, status_code, headers]
end

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

Fetch a specific user

Parameters:

  • user_id (String)

    A user identifier or slug

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

    the optional parameters

Returns:



530
531
532
533
# File 'lib/gopad/api/user_api.rb', line 530

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

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

Fetch a specific user

Parameters:

  • user_id (String)

    A user identifier or slug

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

    the optional parameters

Returns:

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

    User data, response status code and response headers



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
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
# File 'lib/gopad/api/user_api.rb', line 539

def show_user_with_http_info(user_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserApi.show_user ...'
  end
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    raise ArgumentError, "Missing the required parameter 'user_id' when calling UserApi.show_user"
  end

  # resource path
  local_var_path = '/users/{user_id}'.sub('{' + 'user_id' + '}', 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
  auth_names = opts[:debug_auth_names] || %w[Basic Header Bearer]

  new_options = opts.merge(
    operation: :'UserApi.show_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#show_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  [data, status_code, headers]
end

#update_user(user_id, update_user_request, opts = {}) ⇒ User

Update a specific user

Parameters:

  • user_id (String)

    A user identifier or slug

  • update_user_request (UpdateUserRequest)

    The user data to update

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

    the optional parameters

Returns:



593
594
595
596
# File 'lib/gopad/api/user_api.rb', line 593

def update_user(user_id, update_user_request, opts = {})
  data, _status_code, _headers = update_user_with_http_info(user_id, update_user_request, opts)
  data
end

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

Update a specific user

Parameters:

  • user_id (String)

    A user identifier or slug

  • update_user_request (UpdateUserRequest)

    The user data to update

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

    the optional parameters

Returns:

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

    User data, response status code and response headers



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
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
# File 'lib/gopad/api/user_api.rb', line 603

def update_user_with_http_info(user_id, update_user_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserApi.update_user ...'
  end
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    raise ArgumentError, "Missing the required parameter 'user_id' when calling UserApi.update_user"
  end
  # verify the required parameter 'update_user_request' is set
  if @api_client.config.client_side_validation && update_user_request.nil?
    raise ArgumentError, "Missing the required parameter 'update_user_request' when calling UserApi.update_user"
  end

  # resource path
  local_var_path = '/users/{user_id}'.sub('{' + 'user_id' + '}', 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'])
  unless 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(update_user_request)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || %w[Basic Header Bearer]

  new_options = opts.merge(
    operation: :'UserApi.update_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(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UserApi#update_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  [data, status_code, headers]
end