Class: AdminApi::ClientApi

Inherits:
Object
  • Object
show all
Defined in:
lib/admin_api/api/client_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default, auth_config = AuthConfiguration.default) ⇒ ClientApi

Returns a new instance of ClientApi.



20
21
22
23
# File 'lib/admin_api/api/client_api.rb', line 20

def initialize(api_client = ApiClient.default, auth_config = AuthConfiguration.default)
  @api_client = api_client
  @auth_config = auth_config
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/admin_api/api/client_api.rb', line 17

def api_client
  @api_client
end

#auth_configObject

Returns the value of attribute auth_config.



18
19
20
# File 'lib/admin_api/api/client_api.rb', line 18

def auth_config
  @auth_config
end

Instance Method Details

#create_client_credential_return(appTokenConfig) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/admin_api/api/client_api.rb', line 26

def create_client_credential_return(appTokenConfig)
  client_credentials_token = @auth_config.create_client_credential_return(appTokenConfig['clientId'], appTokenConfig['clientSecret'])
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AppTokenApi#client_credentials_token\nData: #{client_credentials_token.inspect}"
  end
  return client_credentials_token
end

#create_client_token_credential_return(appTokenConfig) ⇒ Object



43
44
45
46
47
48
49
50
# File 'lib/admin_api/api/client_api.rb', line 43

def create_client_token_credential_return(appTokenConfig)

  client_token_credentials = @auth_config.create_client_token_credential(appTokenConfig['clientId'], appTokenConfig['clientSecret'],appTokenConfig['clientToken'])
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AppTokenApi#client_token_credentials\nData: #{client_token_credentials.inspect}"
  end
  return client_token_credentials
end

#create_client_using_post(client_request, appTokenConfig = {}, opts = {}) ⇒ Client

Create a client Create a new client, or register a new user, with your firm.

Parameters:

  • client_request

    clientRequest

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

    the optional parameters

Returns:



57
58
59
60
# File 'lib/admin_api/api/client_api.rb', line 57

def create_client_using_post(client_request, appTokenConfig = {}, opts = {})
  data, _status_code, _headers = create_client_using_post_with_http_info(client_request, appTokenConfig, opts)
  data
end

#create_client_using_post_with_http_info(client_request, appTokenConfig = {}, opts = {}) ⇒ Array<(Client, Fixnum, Hash)>

Create a client Create a new client, or register a new user, with your firm.

Parameters:

  • client_request

    clientRequest

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

    the optional parameters

Returns:

  • (Array<(Client, Fixnum, Hash)>)

    Client data, response status code and response headers



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
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
# File 'lib/admin_api/api/client_api.rb', line 67

def create_client_using_post_with_http_info(client_request, appTokenConfig = {}, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ClientApi.create_client_using_post ...'
  end
  # verify the required parameter 'client_request' is set
  if @api_client.config.client_side_validation && client_request.nil?
    fail ArgumentError, "Missing the required parameter 'client_request' when calling ClientApi.create_client_using_post"
  end
  # resource path
  local_var_path = '/nucleus/v1/client'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(client_request)
  auth_names = ['oauth2']

  if @api_client.config.client_side_validation && appTokenConfig['basePath'].nil?
    fail ArgumentError, "Missing the required parameter 'basePath'"
  end

  if @api_client.config.client_side_validation && appTokenConfig['authType'].nil?
    fail ArgumentError, "Missing the required parameter 'authType'"
  end

  @auth_config.config.host = appTokenConfig['basePath']
  @api_client.config.host = appTokenConfig['basePath']

  if appTokenConfig['authType'].downcase == 'client_credentials'
    client_credentials_token = create_client_credential_return(appTokenConfig)
    @api_client.config.access_token = client_credentials_token
  elsif appTokenConfig['authType'].downcase == 'password_credentials'
    password_credential_token = create_password_credential_return(appTokenConfig)
    @api_client.config.access_token = password_credential_token
  elsif  appTokenConfig['authType'].downcase == 'password_credentials'
    client_token_credential = create_client_token_credential_return(appTokenConfig)
    @api_client.config.access_token = client_token_credential
  end
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Client')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ClientApi#create_client_using_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_password_credential_return(appTokenConfig) ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/admin_api/api/client_api.rb', line 34

def create_password_credential_return(appTokenConfig)

  password_credentials_token = @auth_config.create_password_credential_return(appTokenConfig['clientId'], appTokenConfig['clientSecret'],appTokenConfig['username'], appTokenConfig['password'] )
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AppTokenApi#password_credentials_token\nData: #{password_credentials_token.inspect}"
  end
  return password_credentials_token
end

#get_client_all_using_get(appTokenConfig = {}, opts = {}) ⇒ PageClient

List all clients Get details for all clients registered with your firm.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :ascending (BOOLEAN)

    ascending (default to false)

  • :filter (String)

    filter

  • :order_by (String)

    order_by (default to update_date)

  • :page (Integer)

    page (default to 0)

  • :size (Integer)

    size (default to 25)

Returns:



137
138
139
140
# File 'lib/admin_api/api/client_api.rb', line 137

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

#get_client_all_using_get_with_http_info(appTokenConfig = {}, opts = {}) ⇒ Array<(PageClient, Fixnum, Hash)>

List all clients Get details for all clients registered with your firm.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :ascending (BOOLEAN)

    ascending

  • :filter (String)

    filter

  • :order_by (String)

    order_by

  • :page (Integer)

    page

  • :size (Integer)

    size

Returns:

  • (Array<(PageClient, Fixnum, Hash)>)

    PageClient data, response status code and response headers



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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# File 'lib/admin_api/api/client_api.rb', line 151

def get_client_all_using_get_with_http_info(appTokenConfig = {}, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ClientApi.get_client_all_using_get ...'
  end
  # resource path
  local_var_path = '/nucleus/v1/client'

  # query parameters
  query_params = {}
  query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?
  query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
  query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['oauth2']

  if @api_client.config.client_side_validation && appTokenConfig['basePath'].nil?
    fail ArgumentError, "Missing the required parameter 'basePath'"
  end

  if @api_client.config.client_side_validation && appTokenConfig['authType'].nil?
    fail ArgumentError, "Missing the required parameter 'authType'"
  end

  @auth_config.config.host = appTokenConfig['basePath']
  @api_client.config.host = appTokenConfig['basePath']

  if appTokenConfig['authType'].downcase == 'client_credentials'
    client_credentials_token = create_client_credential_return(appTokenConfig)
    @api_client.config.access_token = client_credentials_token
  elsif appTokenConfig['authType'].downcase == 'password_credentials'
    password_credential_token = create_password_credential_return(appTokenConfig)
    @api_client.config.access_token = password_credential_token
  elsif  appTokenConfig['authType'].downcase == 'password_credentials'
    client_token_credential = create_client_token_credential_return(appTokenConfig)
    @api_client.config.access_token = client_token_credential
  end
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'PageClient')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ClientApi#get_client_all_using_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_client_using_get(client_id, appTokenConfig = {}, opts = {}) ⇒ Client

Retrieve a client Retrieve the information for a client registered with your firm.

Parameters:

  • client_id

    UUID client_id

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

    the optional parameters

Returns:



216
217
218
219
# File 'lib/admin_api/api/client_api.rb', line 216

def get_client_using_get(client_id, appTokenConfig = {}, opts = {})
  data, _status_code, _headers = get_client_using_get_with_http_info(client_id, appTokenConfig, opts)
  data
end

#get_client_using_get_with_http_info(client_id, appTokenConfig = {}, opts = {}) ⇒ Array<(Client, Fixnum, Hash)>

Retrieve a client Retrieve the information for a client registered with your firm.

Parameters:

  • client_id

    UUID client_id

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

    the optional parameters

Returns:

  • (Array<(Client, Fixnum, Hash)>)

    Client data, response status code and response headers



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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
# File 'lib/admin_api/api/client_api.rb', line 226

def get_client_using_get_with_http_info(client_id, appTokenConfig = {}, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ClientApi.get_client_using_get ...'
  end
  # verify the required parameter 'client_id' is set
  if @api_client.config.client_side_validation && client_id.nil?
    fail ArgumentError, "Missing the required parameter 'client_id' when calling ClientApi.get_client_using_get"
  end
  # resource path
  local_var_path = '/nucleus/v1/client/{client_id}'.sub('{' + 'client_id' + '}', client_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['oauth2']

  if @api_client.config.client_side_validation && appTokenConfig['basePath'].nil?
    fail ArgumentError, "Missing the required parameter 'basePath'"
  end

  if @api_client.config.client_side_validation && appTokenConfig['authType'].nil?
    fail ArgumentError, "Missing the required parameter 'authType'"
  end

  @auth_config.config.host = appTokenConfig['basePath']
  @api_client.config.host = appTokenConfig['basePath']

  if appTokenConfig['authType'].downcase == 'client_credentials'
    client_credentials_token = create_client_credential_return(appTokenConfig)
    @api_client.config.access_token = client_credentials_token
  elsif appTokenConfig['authType'].downcase == 'password_credentials'
    password_credential_token = create_password_credential_return(appTokenConfig)
    @api_client.config.access_token = password_credential_token
  elsif  appTokenConfig['authType'].downcase == 'password_credentials'
    client_token_credential = create_client_token_credential_return(appTokenConfig)
    @api_client.config.access_token = client_token_credential
  end
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Client')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ClientApi#get_client_using_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_client_using_put(client, client_id, appTokenConfig = {}, opts = {}) ⇒ Client

Update a client Update the information for a client registered with your firm.

Parameters:

  • client

    client

  • client_id

    UUID client_id

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

    the optional parameters

Returns:



291
292
293
294
# File 'lib/admin_api/api/client_api.rb', line 291

def update_client_using_put(client, client_id, appTokenConfig = {}, opts = {})
  data, _status_code, _headers = update_client_using_put_with_http_info(client, client_id, appTokenConfig, opts)
  data
end

#update_client_using_put_with_http_info(client, client_id, appTokenConfig = {}, opts = {}) ⇒ Array<(Client, Fixnum, Hash)>

Update a client Update the information for a client registered with your firm.

Parameters:

  • client

    client

  • client_id

    UUID client_id

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

    the optional parameters

Returns:

  • (Array<(Client, Fixnum, Hash)>)

    Client data, response status code and response headers



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
353
354
355
356
357
358
359
360
361
362
363
364
365
366
# File 'lib/admin_api/api/client_api.rb', line 302

def update_client_using_put_with_http_info(client, client_id, appTokenConfig = {}, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ClientApi.update_client_using_put ...'
  end
  # verify the required parameter 'client' is set
  if @api_client.config.client_side_validation && client.nil?
    fail ArgumentError, "Missing the required parameter 'client' when calling ClientApi.update_client_using_put"
  end
  # verify the required parameter 'client_id' is set
  if @api_client.config.client_side_validation && client_id.nil?
    fail ArgumentError, "Missing the required parameter 'client_id' when calling ClientApi.update_client_using_put"
  end
  # resource path
  local_var_path = '/nucleus/v1/client/{client_id}'.sub('{' + 'client_id' + '}', client_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(client)
  auth_names = ['oauth2']

  if @api_client.config.client_side_validation && appTokenConfig['basePath'].nil?
    fail ArgumentError, "Missing the required parameter 'basePath'"
  end

  if @api_client.config.client_side_validation && appTokenConfig['authType'].nil?
    fail ArgumentError, "Missing the required parameter 'authType'"
  end

  @auth_config.config.host = appTokenConfig['basePath']
  @api_client.config.host = appTokenConfig['basePath']

  if appTokenConfig['authType'].downcase == 'client_credentials'
    client_credentials_token = create_client_credential_return(appTokenConfig)
    @api_client.config.access_token = client_credentials_token
  elsif appTokenConfig['authType'].downcase == 'password_credentials'
    password_credential_token = create_password_credential_return(appTokenConfig)
    @api_client.config.access_token = password_credential_token
  elsif  appTokenConfig['authType'].downcase == 'password_credentials'
    client_token_credential = create_client_token_credential_return(appTokenConfig)
    @api_client.config.access_token = client_token_credential
  end
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Client')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ClientApi#update_client_using_put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end