Class: Nodeum::UsersApi

Inherits:
Object
  • Object
show all
Defined in:
lib/nodeum_sdk/api/users_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ UsersApi

Returns a new instance of UsersApi.



19
20
21
# File 'lib/nodeum_sdk/api/users_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/nodeum_sdk/api/users_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_api_key(api_key_body, opts = {}) ⇒ ApiKeyFull

Creates a new API Key for current user. **API Key Scope**: api_keys / create

Parameters:

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

    the optional parameters

Returns:



27
28
29
30
# File 'lib/nodeum_sdk/api/users_api.rb', line 27

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

#create_api_key_with_http_info(api_key_body, opts = {}) ⇒ Array<(ApiKeyFull, Integer, Hash)>

Creates a new API Key for current user. **API Key Scope**: api_keys / create

Parameters:

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

    the optional parameters

Returns:

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

    ApiKeyFull 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
84
# File 'lib/nodeum_sdk/api/users_api.rb', line 37

def create_api_key_with_http_info(api_key_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsersApi.create_api_key ...'
  end
  # verify the required parameter 'api_key_body' is set
  if @api_client.config.client_side_validation && api_key_body.nil?
    fail ArgumentError, "Missing the required parameter 'api_key_body' when calling UsersApi.create_api_key"
  end
  # resource path
  local_var_path = '/users/me/api_keys'

  # 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'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

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

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

  # return_type
  return_type = opts[:return_type] || 'ApiKeyFull' 

  # auth_names
  auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']

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

#destroy_api_key(api_key_id, opts = {}) ⇒ nil

Destroys a specific API Key. **API Key Scope**: api_keys / destroy

Parameters:

  • api_key_id (Integer)

    Numeric ID of API Key.

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

    the optional parameters

Returns:

  • (nil)


91
92
93
94
# File 'lib/nodeum_sdk/api/users_api.rb', line 91

def destroy_api_key(api_key_id, opts = {})
  destroy_api_key_with_http_info(api_key_id, opts)
  nil
end

#destroy_api_key_with_http_info(api_key_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Destroys a specific API Key. **API Key Scope**: api_keys / destroy

Parameters:

  • api_key_id (Integer)

    Numeric ID of API Key.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
141
142
143
144
# File 'lib/nodeum_sdk/api/users_api.rb', line 101

def destroy_api_key_with_http_info(api_key_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsersApi.destroy_api_key ...'
  end
  # verify the required parameter 'api_key_id' is set
  if @api_client.config.client_side_validation && api_key_id.nil?
    fail ArgumentError, "Missing the required parameter 'api_key_id' when calling UsersApi.destroy_api_key"
  end
  # resource path
  local_var_path = '/users/me/api_keys/{api_key_id}'.sub('{' + 'api_key_id' + '}', CGI.escape(api_key_id.to_s))

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

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

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

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

  # return_type
  return_type = opts[:return_type] 

  # auth_names
  auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']

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

#index_api_keys(opts = {}) ⇒ ApiKeyCollection

Lists all API keys of current user. **API Key Scope**: api_keys / index

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    The number of items to display for pagination.

  • :offset (Integer)

    The number of items to skip for pagination.

Returns:



152
153
154
155
# File 'lib/nodeum_sdk/api/users_api.rb', line 152

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

#index_api_keys_with_http_info(opts = {}) ⇒ Array<(ApiKeyCollection, Integer, Hash)>

Lists all API keys of current user. **API Key Scope**: api_keys / index

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    The number of items to display for pagination.

  • :offset (Integer)

    The number of items to skip for pagination.

Returns:

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

    ApiKeyCollection data, response status code and response headers



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
204
205
206
# File 'lib/nodeum_sdk/api/users_api.rb', line 163

def index_api_keys_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsersApi.index_api_keys ...'
  end
  # resource path
  local_var_path = '/users/me/api_keys'

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

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

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

  # return_type
  return_type = opts[:return_type] || 'ApiKeyCollection' 

  # auth_names
  auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']

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

#index_system_groups(opts = {}) ⇒ SystemGroupCollection

List all system groups. **API Key Scope**: groups / systems

Parameters:

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

    the optional parameters

Returns:



212
213
214
215
# File 'lib/nodeum_sdk/api/users_api.rb', line 212

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

#index_system_groups_with_http_info(opts = {}) ⇒ Array<(SystemGroupCollection, Integer, Hash)>

List all system groups. **API Key Scope**: groups / systems

Parameters:

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

    the optional parameters

Returns:

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

    SystemGroupCollection data, response status code and response headers



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
253
254
255
256
257
258
259
260
261
262
# File 'lib/nodeum_sdk/api/users_api.rb', line 221

def index_system_groups_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsersApi.index_system_groups ...'
  end
  # resource path
  local_var_path = '/groups/-/systems'

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

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

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

  # return_type
  return_type = opts[:return_type] || 'SystemGroupCollection' 

  # auth_names
  auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']

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

#index_system_users(opts = {}) ⇒ SystemUserCollection

List all system users. **API Key Scope**: users / systems

Parameters:

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

    the optional parameters

Returns:



268
269
270
271
# File 'lib/nodeum_sdk/api/users_api.rb', line 268

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

#index_system_users_with_http_info(opts = {}) ⇒ Array<(SystemUserCollection, Integer, Hash)>

List all system users. **API Key Scope**: users / systems

Parameters:

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

    the optional parameters

Returns:

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

    SystemUserCollection data, response status code and response headers



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
# File 'lib/nodeum_sdk/api/users_api.rb', line 277

def index_system_users_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsersApi.index_system_users ...'
  end
  # resource path
  local_var_path = '/users/-/systems'

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

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

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

  # return_type
  return_type = opts[:return_type] || 'SystemUserCollection' 

  # auth_names
  auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']

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

#show_api_key(api_key_id, opts = {}) ⇒ ApiKeyFull

Displays a specific API Key with its scopes. **API Key Scope**: api_keys / show

Parameters:

  • api_key_id (Integer)

    Numeric ID of API Key.

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

    the optional parameters

Returns:



325
326
327
328
# File 'lib/nodeum_sdk/api/users_api.rb', line 325

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

#show_api_key_with_http_info(api_key_id, opts = {}) ⇒ Array<(ApiKeyFull, Integer, Hash)>

Displays a specific API Key with its scopes. **API Key Scope**: api_keys / show

Parameters:

  • api_key_id (Integer)

    Numeric ID of API Key.

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

    the optional parameters

Returns:

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

    ApiKeyFull data, response status code and response headers



335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
# File 'lib/nodeum_sdk/api/users_api.rb', line 335

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

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

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

  # return_type
  return_type = opts[:return_type] || 'ApiKeyFull' 

  # auth_names
  auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']

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

#update_api_key(api_key_id, api_key_body, opts = {}) ⇒ ApiKeyFull

Updates a specific API Key. **API Key Scope**: api_keys / update

Parameters:

  • api_key_id (Integer)

    Numeric ID of API Key.

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

    the optional parameters

Returns:



388
389
390
391
# File 'lib/nodeum_sdk/api/users_api.rb', line 388

def update_api_key(api_key_id, api_key_body, opts = {})
  data, _status_code, _headers = update_api_key_with_http_info(api_key_id, api_key_body, opts)
  data
end

#update_api_key_with_http_info(api_key_id, api_key_body, opts = {}) ⇒ Array<(ApiKeyFull, Integer, Hash)>

Updates a specific API Key. **API Key Scope**: api_keys / update

Parameters:

  • api_key_id (Integer)

    Numeric ID of API Key.

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

    the optional parameters

Returns:

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

    ApiKeyFull 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
# File 'lib/nodeum_sdk/api/users_api.rb', line 399

def update_api_key_with_http_info(api_key_id, api_key_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsersApi.update_api_key ...'
  end
  # verify the required parameter 'api_key_id' is set
  if @api_client.config.client_side_validation && api_key_id.nil?
    fail ArgumentError, "Missing the required parameter 'api_key_id' when calling UsersApi.update_api_key"
  end
  # verify the required parameter 'api_key_body' is set
  if @api_client.config.client_side_validation && api_key_body.nil?
    fail ArgumentError, "Missing the required parameter 'api_key_body' when calling UsersApi.update_api_key"
  end
  # resource path
  local_var_path = '/users/me/api_keys/{api_key_id}'.sub('{' + 'api_key_id' + '}', CGI.escape(api_key_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'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

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

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

  # return_type
  return_type = opts[:return_type] || 'ApiKeyFull' 

  # auth_names
  auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']

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