Class: FusionAuth::FusionAuthClient

Inherits:
Object
  • Object
show all
Defined in:
lib/fusionauth/fusionauth_client.rb

Overview

This class is the the Ruby client library for the FusionAuth CIAM Platform https://fusionauth.io

Each method on this class calls one of the APIs for FusionAuth. In most cases, the methods will take either a Hash, an OpenStruct or any object that can be safely converted to JSON that conforms to the FusionAuth API interface. Likewise, most methods will return an OpenStruct that contains the response JSON from FusionAuth.

noinspection RubyInstanceMethodNamingConvention,RubyTooManyMethodsInspection,RubyParameterNamingConvention

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key, base_url) ⇒ FusionAuthClient

Returns a new instance of FusionAuthClient.



32
33
34
35
36
37
# File 'lib/fusionauth/fusionauth_client.rb', line 32

def initialize(api_key, base_url)
  @api_key = api_key
  @base_url = base_url
  @connect_timeout = 1000
  @read_timeout = 2000
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



30
31
32
# File 'lib/fusionauth/fusionauth_client.rb', line 30

def api_key
  @api_key
end

#base_urlObject

Returns the value of attribute base_url.



30
31
32
# File 'lib/fusionauth/fusionauth_client.rb', line 30

def base_url
  @base_url
end

#connect_timeoutObject

Returns the value of attribute connect_timeout.



30
31
32
# File 'lib/fusionauth/fusionauth_client.rb', line 30

def connect_timeout
  @connect_timeout
end

#read_timeoutObject

Returns the value of attribute read_timeout.



30
31
32
# File 'lib/fusionauth/fusionauth_client.rb', line 30

def read_timeout
  @read_timeout
end

Instance Method Details

#action_user(actionee_user_id, request) ⇒ FusionAuth::ClientResponse

Takes an action on a user. The user being actioned is called the “actionee” and the user taking the action is called the “actioner”. Both user ids are required. You pass the actionee’s user id into the method and the actioner’s is put into the request object.

Parameters:

  • actionee_user_id (string)

    The actionee’s user id.

  • request (OpenStruct, Hash)

    The action request that includes all of the information about the action being taken including the id of the action, any options and the duration (if applicable).

Returns:



49
50
51
52
53
54
55
# File 'lib/fusionauth/fusionauth_client.rb', line 49

def action_user(actionee_user_id, request)
  start.uri('/api/user/action')
       .url_segment(actionee_user_id)
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .post()
       .go()
end

#cancel_action(action_id, request) ⇒ FusionAuth::ClientResponse

Cancels the user action.

Parameters:

  • action_id (string)

    The action id of the action to cancel.

  • request (OpenStruct, Hash)

    The action request that contains the information about the cancellation.

Returns:



64
65
66
67
68
69
70
# File 'lib/fusionauth/fusionauth_client.rb', line 64

def cancel_action(action_id, request)
  start.uri('/api/user/action')
       .url_segment(action_id)
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .delete()
       .go()
end

#change_password(change_password_id, request) ⇒ FusionAuth::ClientResponse

Changes a user’s password using the change password Id. This usually occurs after an email has been sent to the user and they clicked on a link to reset their password.

Parameters:

  • change_password_id (string)

    The change password Id used to find the user. This value is generated by FusionAuth once the change password workflow has been initiated.

  • request (OpenStruct, Hash)

    The change password request that contains all of the information used to change the password.

Returns:



80
81
82
83
84
85
86
# File 'lib/fusionauth/fusionauth_client.rb', line 80

def change_password(change_password_id, request)
  start.uri('/api/user/change-password')
       .url_segment(change_password_id)
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .post()
       .go()
end

#change_password_by_identity(request) ⇒ FusionAuth::ClientResponse

Changes a user’s password using their identity (login id and password). Using a loginId instead of the changePasswordId bypasses the email verification and allows a password to be changed directly without first calling the #forgotPassword method.

Parameters:

  • request (OpenStruct, Hash)

    The change password request that contains all of the information used to change the password.

Returns:



96
97
98
99
100
101
# File 'lib/fusionauth/fusionauth_client.rb', line 96

def change_password_by_identity(request)
  start.uri('/api/user/change-password')
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .post()
       .go()
end

#comment_on_user(request) ⇒ FusionAuth::ClientResponse

Adds a comment to the user’s account.

Parameters:

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the user comment.

Returns:



109
110
111
112
113
114
# File 'lib/fusionauth/fusionauth_client.rb', line 109

def comment_on_user(request)
  start.uri('/api/user/comment')
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .post()
       .go()
end

#create_application(application_id, request) ⇒ FusionAuth::ClientResponse

Creates an application. You can optionally specify an Id for the application, if not provided one will be generated.

Parameters:

  • application_id (string)

    (Optional) The Id to use for the application. If not provided a secure random UUID will be generated.

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the application.

Returns:



123
124
125
126
127
128
129
# File 'lib/fusionauth/fusionauth_client.rb', line 123

def create_application(application_id, request)
  start.uri('/api/application')
       .url_segment(application_id)
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .post()
       .go()
end

#create_application_role(application_id, role_id, request) ⇒ FusionAuth::ClientResponse

Creates a new role for an application. You must specify the id of the application you are creating the role for. You can optionally specify an Id for the role inside the ApplicationRole object itself, if not provided one will be generated.

Parameters:

  • application_id (string)

    The Id of the application to create the role on.

  • role_id (string)

    (Optional) The Id of the role. If not provided a secure random UUID will be generated.

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the application role.

Returns:



140
141
142
143
144
145
146
147
148
# File 'lib/fusionauth/fusionauth_client.rb', line 140

def create_application_role(application_id, role_id, request)
  start.uri('/api/application')
       .url_segment(application_id)
       .url_segment("role")
       .url_segment(role_id)
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .post()
       .go()
end

#create_audit_log(request) ⇒ FusionAuth::ClientResponse

Creates an audit log with the message and user name (usually an email). Audit logs should be written anytime you make changes to the FusionAuth database. When using the FusionAuth App web interface, any changes are automatically written to the audit log. However, if you are accessing the API, you must write the audit logs yourself.

Parameters:

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the audit log entry.

Returns:



158
159
160
161
162
163
# File 'lib/fusionauth/fusionauth_client.rb', line 158

def create_audit_log(request)
  start.uri('/api/system/audit-log')
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .post()
       .go()
end

#create_email_template(email_template_id, request) ⇒ FusionAuth::ClientResponse

Creates an email template. You can optionally specify an Id for the template, if not provided one will be generated.

Parameters:

  • email_template_id (string)

    (Optional) The Id for the template. If not provided a secure random UUID will be generated.

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the email template.

Returns:



172
173
174
175
176
177
178
# File 'lib/fusionauth/fusionauth_client.rb', line 172

def create_email_template(email_template_id, request)
  start.uri('/api/email/template')
       .url_segment(email_template_id)
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .post()
       .go()
end

#create_group(group_id, request) ⇒ FusionAuth::ClientResponse

Creates a group. You can optionally specify an Id for the group, if not provided one will be generated.

Parameters:

  • group_id (string)

    (Optional) The Id for the group. If not provided a secure random UUID will be generated.

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the group.

Returns:



187
188
189
190
191
192
193
# File 'lib/fusionauth/fusionauth_client.rb', line 187

def create_group(group_id, request)
  start.uri('/api/group')
       .url_segment(group_id)
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .post()
       .go()
end

#create_group_members(request) ⇒ FusionAuth::ClientResponse

Creates a member in a group.

Parameters:

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the group member(s).

Returns:



201
202
203
204
205
206
# File 'lib/fusionauth/fusionauth_client.rb', line 201

def create_group_members(request)
  start.uri('/api/group/member')
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .post()
       .go()
end

#create_identity_provider(identity_provider_id, request) ⇒ FusionAuth::ClientResponse

Creates an identity provider. You can optionally specify an Id for the identity provider, if not provided one will be generated.

Parameters:

  • identity_provider_id (string)

    (Optional) The Id of the identity provider. If not provided a secure random UUID will be generated.

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the identity provider.

Returns:



215
216
217
218
219
220
221
# File 'lib/fusionauth/fusionauth_client.rb', line 215

def create_identity_provider(identity_provider_id, request)
  start.uri('/api/identity-provider')
       .url_segment(identity_provider_id)
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .post()
       .go()
end

#create_tenant(tenant_id, request) ⇒ FusionAuth::ClientResponse

Creates a tenant. You can optionally specify an Id for the tenant, if not provided one will be generated.

Parameters:

  • tenant_id (string)

    (Optional) The Id for the tenant. If not provided a secure random UUID will be generated.

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the tenant.

Returns:



230
231
232
233
234
235
236
# File 'lib/fusionauth/fusionauth_client.rb', line 230

def create_tenant(tenant_id, request)
  start.uri('/api/tenant')
       .url_segment(tenant_id)
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .post()
       .go()
end

#create_user(user_id, request) ⇒ FusionAuth::ClientResponse

Creates a user. You can optionally specify an Id for the user, if not provided one will be generated.

Parameters:

  • user_id (string)

    (Optional) The Id for the user. If not provided a secure random UUID will be generated.

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the user.

Returns:



245
246
247
248
249
250
251
# File 'lib/fusionauth/fusionauth_client.rb', line 245

def create_user(user_id, request)
  start.uri('/api/user')
       .url_segment(user_id)
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .post()
       .go()
end

#create_user_action(user_action_id, request) ⇒ FusionAuth::ClientResponse

Creates a user action. This action cannot be taken on a user until this call successfully returns. Anytime after that the user action can be applied to any user.

Parameters:

  • user_action_id (string)

    (Optional) The Id for the user action. If not provided a secure random UUID will be generated.

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the user action.

Returns:



261
262
263
264
265
266
267
# File 'lib/fusionauth/fusionauth_client.rb', line 261

def create_user_action(user_action_id, request)
  start.uri('/api/user-action')
       .url_segment(user_action_id)
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .post()
       .go()
end

#create_user_action_reason(user_action_reason_id, request) ⇒ FusionAuth::ClientResponse

Creates a user reason. This user action reason cannot be used when actioning a user until this call completes successfully. Anytime after that the user action reason can be used.

Parameters:

  • user_action_reason_id (string)

    (Optional) The Id for the user action reason. If not provided a secure random UUID will be generated.

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the user action reason.

Returns:



277
278
279
280
281
282
283
# File 'lib/fusionauth/fusionauth_client.rb', line 277

def create_user_action_reason(user_action_reason_id, request)
  start.uri('/api/user-action-reason')
       .url_segment(user_action_reason_id)
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .post()
       .go()
end

#create_webhook(webhook_id, request) ⇒ FusionAuth::ClientResponse

Creates a webhook. You can optionally specify an Id for the webhook, if not provided one will be generated.

Parameters:

  • webhook_id (string)

    (Optional) The Id for the webhook. If not provided a secure random UUID will be generated.

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the webhook.

Returns:



292
293
294
295
296
297
298
# File 'lib/fusionauth/fusionauth_client.rb', line 292

def create_webhook(webhook_id, request)
  start.uri('/api/webhook')
       .url_segment(webhook_id)
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .post()
       .go()
end

#deactivate_application(application_id) ⇒ FusionAuth::ClientResponse

Deactivates the application with the given Id.

Parameters:

  • application_id (string)

    The Id of the application to deactivate.

Returns:



306
307
308
309
310
311
# File 'lib/fusionauth/fusionauth_client.rb', line 306

def deactivate_application(application_id)
  start.uri('/api/application')
       .url_segment(application_id)
       .delete()
       .go()
end

#deactivate_user(user_id) ⇒ FusionAuth::ClientResponse

Deactivates the user with the given Id.

Parameters:

  • user_id (string)

    The Id of the user to deactivate.

Returns:



319
320
321
322
323
324
# File 'lib/fusionauth/fusionauth_client.rb', line 319

def deactivate_user(user_id)
  start.uri('/api/user')
       .url_segment(user_id)
       .delete()
       .go()
end

#deactivate_user_action(user_action_id) ⇒ FusionAuth::ClientResponse

Deactivates the user action with the given Id.

Parameters:

  • user_action_id (string)

    The Id of the user action to deactivate.

Returns:



332
333
334
335
336
337
# File 'lib/fusionauth/fusionauth_client.rb', line 332

def deactivate_user_action(user_action_id)
  start.uri('/api/user-action')
       .url_segment(user_action_id)
       .delete()
       .go()
end

#deactivate_users(user_ids) ⇒ FusionAuth::ClientResponse

Deactivates the users with the given ids.

Parameters:

  • user_ids (Array)

    The ids of the users to deactivate.

Returns:



345
346
347
348
349
350
# File 'lib/fusionauth/fusionauth_client.rb', line 345

def deactivate_users(user_ids)
  start.uri('/api/user/bulk')
       .url_parameter('userId', user_ids)
       .delete()
       .go()
end

#delete_application(application_id) ⇒ FusionAuth::ClientResponse

Hard deletes an application. This is a dangerous operation and should not be used in most circumstances. This will delete the application, any registrations for that application, metrics and reports for the application, all the roles for the application, and any other data associated with the application. This operation could take a very long time, depending on the amount of data in your database.

Parameters:

  • application_id (string)

    The Id of the application to delete.

Returns:



361
362
363
364
365
366
367
# File 'lib/fusionauth/fusionauth_client.rb', line 361

def delete_application(application_id)
  start.uri('/api/application')
       .url_segment(application_id)
       .url_parameter('hardDelete', true)
       .delete()
       .go()
end

#delete_application_role(application_id, role_id) ⇒ FusionAuth::ClientResponse

Hard deletes an application role. This is a dangerous operation and should not be used in most circumstances. This permanently removes the given role from all users that had it.

Parameters:

  • application_id (string)

    The Id of the application to deactivate.

  • role_id (string)

    The Id of the role to delete.

Returns:



377
378
379
380
381
382
383
384
# File 'lib/fusionauth/fusionauth_client.rb', line 377

def delete_application_role(application_id, role_id)
  start.uri('/api/application')
       .url_segment(application_id)
       .url_segment("role")
       .url_segment(role_id)
       .delete()
       .go()
end

#delete_email_template(email_template_id) ⇒ FusionAuth::ClientResponse

Deletes the email template for the given Id.

Parameters:

  • email_template_id (string)

    The Id of the email template to delete.

Returns:



392
393
394
395
396
397
# File 'lib/fusionauth/fusionauth_client.rb', line 392

def delete_email_template(email_template_id)
  start.uri('/api/email/template')
       .url_segment(email_template_id)
       .delete()
       .go()
end

#delete_group(group_id) ⇒ FusionAuth::ClientResponse

Deletes the group for the given Id.

Parameters:

  • group_id (string)

    The Id of the group to delete.

Returns:



405
406
407
408
409
410
# File 'lib/fusionauth/fusionauth_client.rb', line 405

def delete_group(group_id)
  start.uri('/api/group')
       .url_segment(group_id)
       .delete()
       .go()
end

#delete_group_members(request) ⇒ FusionAuth::ClientResponse

Removes users as members of a group.

Parameters:

  • request (OpenStruct, Hash)

    The member request that contains all of the information used to remove members to the group.

Returns:



418
419
420
421
422
423
# File 'lib/fusionauth/fusionauth_client.rb', line 418

def delete_group_members(request)
  start.uri('/api/group/member')
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .delete()
       .go()
end

#delete_identity_provider(identity_provider_id) ⇒ FusionAuth::ClientResponse

Deletes the identity provider for the given Id.

Parameters:

  • identity_provider_id (string)

    The Id of the identity provider to delete.

Returns:



431
432
433
434
435
436
# File 'lib/fusionauth/fusionauth_client.rb', line 431

def delete_identity_provider(identity_provider_id)
  start.uri('/api/identity-provider')
       .url_segment(identity_provider_id)
       .delete()
       .go()
end

#delete_registration(user_id, application_id) ⇒ FusionAuth::ClientResponse

Deletes the user registration for the given user and application.

Parameters:

  • user_id (string)

    The Id of the user whose registration is being deleted.

  • application_id (string)

    The Id of the application to remove the registration for.

Returns:



445
446
447
448
449
450
451
# File 'lib/fusionauth/fusionauth_client.rb', line 445

def delete_registration(user_id, application_id)
  start.uri('/api/user/registration')
       .url_segment(user_id)
       .url_segment(application_id)
       .delete()
       .go()
end

#delete_tenant(tenant_id) ⇒ FusionAuth::ClientResponse

Deletes the tenant for the given Id.

Parameters:

  • tenant_id (string)

    The Id of the tenant to delete.

Returns:



459
460
461
462
463
464
# File 'lib/fusionauth/fusionauth_client.rb', line 459

def delete_tenant(tenant_id)
  start.uri('/api/tenant')
       .url_segment(tenant_id)
       .delete()
       .go()
end

#delete_user(user_id) ⇒ FusionAuth::ClientResponse

Deletes the user for the given Id. This permanently deletes all information, metrics, reports and data associated with the user.

Parameters:

  • user_id (string)

    The Id of the user to delete.

Returns:



473
474
475
476
477
478
479
# File 'lib/fusionauth/fusionauth_client.rb', line 473

def delete_user(user_id)
  start.uri('/api/user')
       .url_segment(user_id)
       .url_parameter('hardDelete', true)
       .delete()
       .go()
end

#delete_user_action(user_action_id) ⇒ FusionAuth::ClientResponse

Deletes the user action for the given Id. This permanently deletes the user action and also any history and logs of the action being applied to any users.

Parameters:

  • user_action_id (string)

    The Id of the user action to delete.

Returns:



488
489
490
491
492
493
494
# File 'lib/fusionauth/fusionauth_client.rb', line 488

def delete_user_action(user_action_id)
  start.uri('/api/user-action')
       .url_segment(user_action_id)
       .url_parameter('hardDelete', true)
       .delete()
       .go()
end

#delete_user_action_reason(user_action_reason_id) ⇒ FusionAuth::ClientResponse

Deletes the user action reason for the given Id.

Parameters:

  • user_action_reason_id (string)

    The Id of the user action reason to delete.

Returns:



502
503
504
505
506
507
# File 'lib/fusionauth/fusionauth_client.rb', line 502

def delete_user_action_reason(user_action_reason_id)
  start.uri('/api/user-action-reason')
       .url_segment(user_action_reason_id)
       .delete()
       .go()
end

#delete_users(request) ⇒ FusionAuth::ClientResponse

Deletes the users with the given ids.

Parameters:

  • request (OpenStruct, Hash)

    The ids of the users to delete.

Returns:



515
516
517
518
519
520
# File 'lib/fusionauth/fusionauth_client.rb', line 515

def delete_users(request)
  start.uri('/api/user/bulk')
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .delete()
       .go()
end

#delete_webhook(webhook_id) ⇒ FusionAuth::ClientResponse

Deletes the webhook for the given Id.

Parameters:

  • webhook_id (string)

    The Id of the webhook to delete.

Returns:



528
529
530
531
532
533
# File 'lib/fusionauth/fusionauth_client.rb', line 528

def delete_webhook(webhook_id)
  start.uri('/api/webhook')
       .url_segment(webhook_id)
       .delete()
       .go()
end

#disable_two_factor(user_id, code) ⇒ FusionAuth::ClientResponse

Disable Two Factor authentication for a user.

Parameters:

  • user_id (string)

    The Id of the User for which you’re disabling Two Factor authentication.

  • code (string)

    The Two Factor code used verify the the caller knows the Two Factor secret.

Returns:



542
543
544
545
546
547
548
# File 'lib/fusionauth/fusionauth_client.rb', line 542

def disable_two_factor(user_id, code)
  start.uri('/api/user/two-factor')
       .url_parameter('userId', user_id)
       .url_parameter('code', code)
       .delete()
       .go()
end

#enable_two_factor(user_id, request) ⇒ FusionAuth::ClientResponse

Enable Two Factor authentication for a user.

Parameters:

  • user_id (string)

    The Id of the user to enable Two Factor authentication.

  • request (OpenStruct, Hash)

    The two factor enable request information.

Returns:



557
558
559
560
561
562
563
# File 'lib/fusionauth/fusionauth_client.rb', line 557

def enable_two_factor(user_id, request)
  start.uri('/api/user/two-factor')
       .url_segment(user_id)
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .post()
       .go()
end

#exchange_refresh_token_for_jwt(request) ⇒ FusionAuth::ClientResponse

Exchange a refresh token for a new JWT.

Parameters:

  • request (OpenStruct, Hash)

    The refresh request.

Returns:



571
572
573
574
575
576
# File 'lib/fusionauth/fusionauth_client.rb', line 571

def exchange_refresh_token_for_jwt(request)
  start.uri('/api/jwt/refresh')
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .post()
       .go()
end

#forgot_password(request) ⇒ FusionAuth::ClientResponse

Begins the forgot password sequence, which kicks off an email to the user so that they can reset their password.

Parameters:

  • request (OpenStruct, Hash)

    The request that contains the information about the user so that they can be emailed.

Returns:



584
585
586
587
588
589
# File 'lib/fusionauth/fusionauth_client.rb', line 584

def forgot_password(request)
  start.uri('/api/user/forgot-password')
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .post()
       .go()
end

#generate_email_verification_id(email) ⇒ FusionAuth::ClientResponse

Generate a new Email Verification Id to be used with the Verify Email API. This API will not attempt to send an email to the User. This API may be used to collect the verificationId for use with a third party system.

Parameters:

  • email (string)

    The email address of the user that needs a new verification email.

Returns:



598
599
600
601
602
603
604
# File 'lib/fusionauth/fusionauth_client.rb', line 598

def generate_email_verification_id(email)
  start.uri('/api/user/verify-email')
       .url_parameter('email', email)
       .url_parameter('sendVerifyPasswordEmail', false)
       .put()
       .go()
end

#generate_registration_verification_id(email, application_id) ⇒ FusionAuth::ClientResponse

Generate a new Application Registration Verification Id to be used with the Verify Registration API. This API will not attempt to send an email to the User. This API may be used to collect the verificationId for use with a third party system.

Parameters:

  • email (string)

    The email address of the user that needs a new verification email.

  • application_id (string)

    The Id of the application to be verified.

Returns:



614
615
616
617
618
619
620
621
# File 'lib/fusionauth/fusionauth_client.rb', line 614

def generate_registration_verification_id(email, application_id)
  start.uri('/api/user/verify-registration')
       .url_parameter('email', email)
       .url_parameter('sendVerifyPasswordEmail', false)
       .url_parameter('applicationId', application_id)
       .put()
       .go()
end

#generate_two_factor_secretFusionAuth::ClientResponse

Generate a Two Factor secret that can be used to enable Two Factor authentication for a User. The response will contain both the secret and a Base32 encoded form of the secret which can be shown to a User when using a 2 Step Authentication application such as Google Authenticator.

Returns:



630
631
632
633
634
# File 'lib/fusionauth/fusionauth_client.rb', line 630

def generate_two_factor_secret()
  start.uri('/api/two-factor/secret')
       .get()
       .go()
end

#generate_two_factor_secret_using_jwt(encoded_jwt) ⇒ FusionAuth::ClientResponse

Generate a Two Factor secret that can be used to enable Two Factor authentication for a User. The response will contain both the secret and a Base32 encoded form of the secret which can be shown to a User when using a 2 Step Authentication application such as Google Authenticator.

Parameters:

  • encoded_jwt (string)

    The encoded JWT (access token).

Returns:



644
645
646
647
648
649
# File 'lib/fusionauth/fusionauth_client.rb', line 644

def generate_two_factor_secret_using_jwt(encoded_jwt)
  start.uri('/api/two-factor/secret')
       .authorization('JWT ' + encoded_jwt)
       .get()
       .go()
end

#identity_provider_login(request) ⇒ FusionAuth::ClientResponse

Handles login via third-parties including Social login, external OAuth and OpenID Connect, and other login systems.

Parameters:

  • request (OpenStruct, Hash)

    The third-party login request that contains information from the third-party login providers that FusionAuth uses to reconcile the user’s account.

Returns:



659
660
661
662
663
664
# File 'lib/fusionauth/fusionauth_client.rb', line 659

def (request)
  start.uri('/api/identity-provider/login')
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .post()
       .go()
end

#import_users(request) ⇒ FusionAuth::ClientResponse

Bulk imports multiple users. This does some validation, but then tries to run batch inserts of users. This reduces latency when inserting lots of users. Therefore, the error response might contain some information about failures, but it will likely be pretty generic.

Parameters:

  • request (OpenStruct, Hash)

    The request that contains all of the information about all of the users to import.

Returns:



674
675
676
677
678
679
# File 'lib/fusionauth/fusionauth_client.rb', line 674

def import_users(request)
  start.uri('/api/user/import')
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .post()
       .go()
end

#issue_jwt(application_id, encoded_jwt) ⇒ FusionAuth::ClientResponse

Issue a new access token (JWT) for the requested Application after ensuring the provided JWT is valid. A valid access token is properly signed and not expired. <p> This API may be used in an SSO configuration to issue new tokens for another application after the user has obtained a valid token from authentication.

Parameters:

  • application_id (string)

    The Application Id for which you are requesting a new access token be issued.

  • encoded_jwt (string)

    The encoded JWT (access token).

Returns:



692
693
694
695
696
697
698
# File 'lib/fusionauth/fusionauth_client.rb', line 692

def issue_jwt(application_id, encoded_jwt)
  start.uri('/api/jwt/issue')
       .authorization('JWT ' + encoded_jwt)
       .url_parameter('applicationId', application_id)
       .get()
       .go()
end

#login(request) ⇒ FusionAuth::ClientResponse

Logs a user in.

Parameters:

  • request (OpenStruct, Hash)

    The login request that contains the user credentials used to log them in.

Returns:



706
707
708
709
710
711
# File 'lib/fusionauth/fusionauth_client.rb', line 706

def (request)
  start.uri('/api/login')
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .post()
       .go()
end

#login_ping(user_id, application_id, caller_ip_address) ⇒ FusionAuth::ClientResponse

Sends a ping to FusionAuth indicating that the user was automatically logged into an application. When using FusionAuth’s SSO or your own, you should call this if the user is already logged in centrally, but accesses an application where they no longer have a session. This helps correctly track login counts, times and helps with reporting.

Parameters:

  • user_id (string)

    The Id of the user that was logged in.

  • application_id (string)

    The Id of the application that they logged into.

  • caller_ip_address (string)

    (Optional) The IP address of the end-user that is logging in. If a null value is provided the IP address will be that of the client or last proxy that sent the request.

Returns:



725
726
727
728
729
730
731
732
# File 'lib/fusionauth/fusionauth_client.rb', line 725

def (user_id, application_id, caller_ip_address)
  start.uri('/api/login')
       .url_segment(user_id)
       .url_segment(application_id)
       .url_parameter('ipAddress', caller_ip_address)
       .put()
       .go()
end

#logout(global, refresh_token) ⇒ FusionAuth::ClientResponse

The Logout API is intended to be used to remove the refresh token and access token cookies if they exist on the client and revoke the refresh token stored. This API does nothing if the request does not contain an access token or refresh token cookies.

Parameters:

  • global (Boolean)

    When this value is set to true all of the refresh tokens issued to the owner of the provided token will be revoked.

  • refresh_token (string)

    (Optional) The refresh_token as a request parameter instead of coming in via a cookie. If provided this takes precedence over the cookie.

Returns:



745
746
747
748
749
750
751
# File 'lib/fusionauth/fusionauth_client.rb', line 745

def logout(global, refresh_token)
  start.uri('/api/logout')
       .url_parameter('global', global)
       .url_parameter('refreshToken', refresh_token)
       .post()
       .go()
end

#lookup_identity_provider(domain) ⇒ FusionAuth::ClientResponse

Retrieves the identity provider for the given domain. A 200 response code indicates the domain is managed by a registered identity provider. A 404 indicates the domain is not managed.

Parameters:

  • domain (string)

    The domain or email address to lookup.

Returns:



760
761
762
763
764
765
# File 'lib/fusionauth/fusionauth_client.rb', line 760

def lookup_identity_provider(domain)
  start.uri('/api/identity-provider/lookup')
       .url_parameter('domain', domain)
       .get()
       .go()
end

#modify_action(action_id, request) ⇒ FusionAuth::ClientResponse

Modifies a temporal user action by changing the expiration of the action and optionally adding a comment to the action.

Parameters:

  • action_id (string)

    The Id of the action to modify. This is technically the user action log id.

  • request (OpenStruct, Hash)

    The request that contains all of the information about the modification.

Returns:



775
776
777
778
779
780
781
# File 'lib/fusionauth/fusionauth_client.rb', line 775

def modify_action(action_id, request)
  start.uri('/api/user/action')
       .url_segment(action_id)
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .put()
       .go()
end

#reactivate_application(application_id) ⇒ FusionAuth::ClientResponse

Reactivates the application with the given Id.

Parameters:

  • application_id (string)

    The Id of the application to reactivate.

Returns:



789
790
791
792
793
794
795
# File 'lib/fusionauth/fusionauth_client.rb', line 789

def reactivate_application(application_id)
  start.uri('/api/application')
       .url_segment(application_id)
       .url_parameter('reactivate', true)
       .put()
       .go()
end

#reactivate_user(user_id) ⇒ FusionAuth::ClientResponse

Reactivates the user with the given Id.

Parameters:

  • user_id (string)

    The Id of the user to reactivate.

Returns:



803
804
805
806
807
808
809
# File 'lib/fusionauth/fusionauth_client.rb', line 803

def reactivate_user(user_id)
  start.uri('/api/user')
       .url_segment(user_id)
       .url_parameter('reactivate', true)
       .put()
       .go()
end

#reactivate_user_action(user_action_id) ⇒ FusionAuth::ClientResponse

Reactivates the user action with the given Id.

Parameters:

  • user_action_id (string)

    The Id of the user action to reactivate.

Returns:



817
818
819
820
821
822
823
# File 'lib/fusionauth/fusionauth_client.rb', line 817

def reactivate_user_action(user_action_id)
  start.uri('/api/user-action')
       .url_segment(user_action_id)
       .url_parameter('reactivate', true)
       .put()
       .go()
end

#reconcile_jwt(request) ⇒ FusionAuth::ClientResponse

Reconcile a User to FusionAuth using JWT issued from another Identity Provider.

Parameters:

  • request (OpenStruct, Hash)

    The reconcile request that contains the data to reconcile the User.

Returns:



831
832
833
834
835
836
# File 'lib/fusionauth/fusionauth_client.rb', line 831

def reconcile_jwt(request)
  start.uri('/api/jwt/reconcile')
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .post()
       .go()
end

#register(user_id, request) ⇒ FusionAuth::ClientResponse

Registers a user for an application. If you provide the User and the UserRegistration object on this request, it will create the user as well as register them for the application. This is called a Full Registration. However, if you only provide the UserRegistration object, then the user must already exist and they will be registered for the application. The user id can also be provided and it will either be used to look up an existing user or it will be used for the newly created User.

Parameters:

  • user_id (string)

    (Optional) The Id of the user being registered for the application and optionally created.

  • request (OpenStruct, Hash)

    The request that optionally contains the User and must contain the UserRegistration.

Returns:



849
850
851
852
853
854
855
# File 'lib/fusionauth/fusionauth_client.rb', line 849

def register(user_id, request)
  start.uri('/api/user/registration')
       .url_segment(user_id)
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .post()
       .go()
end

#resend_email_verification(email) ⇒ FusionAuth::ClientResponse

Re-sends the verification email to the user.

Parameters:

  • email (string)

    The email address of the user that needs a new verification email.

Returns:



863
864
865
866
867
868
# File 'lib/fusionauth/fusionauth_client.rb', line 863

def resend_email_verification(email)
  start.uri('/api/user/verify-email')
       .url_parameter('email', email)
       .put()
       .go()
end

#resend_registration_verification(email, application_id) ⇒ FusionAuth::ClientResponse

Re-sends the application registration verification email to the user.

Parameters:

  • email (string)

    The email address of the user that needs a new verification email.

  • application_id (string)

    The Id of the application to be verified.

Returns:



877
878
879
880
881
882
883
# File 'lib/fusionauth/fusionauth_client.rb', line 877

def resend_registration_verification(email, application_id)
  start.uri('/api/user/verify-registration')
       .url_parameter('email', email)
       .url_parameter('applicationId', application_id)
       .put()
       .go()
end

#retrieve_action(action_id) ⇒ FusionAuth::ClientResponse

Retrieves a single action log (the log of a user action that was taken on a user previously) for the given Id.

Parameters:

  • action_id (string)

    The Id of the action to retrieve.

Returns:



891
892
893
894
895
896
# File 'lib/fusionauth/fusionauth_client.rb', line 891

def retrieve_action(action_id)
  start.uri('/api/user/action')
       .url_segment(action_id)
       .get()
       .go()
end

#retrieve_actions(user_id) ⇒ FusionAuth::ClientResponse

Retrieves all of the actions for the user with the given Id.

Parameters:

  • user_id (string)

    The Id of the user to fetch the actions for.

Returns:



904
905
906
907
908
909
# File 'lib/fusionauth/fusionauth_client.rb', line 904

def retrieve_actions(user_id)
  start.uri('/api/user/action')
       .url_parameter('userId', user_id)
       .get()
       .go()
end

#retrieve_application(application_id) ⇒ FusionAuth::ClientResponse

Retrieves the application for the given id or all of the applications if the id is null.

Parameters:

  • application_id (string)

    (Optional) The application id.

Returns:



917
918
919
920
921
922
# File 'lib/fusionauth/fusionauth_client.rb', line 917

def retrieve_application(application_id)
  start.uri('/api/application')
       .url_segment(application_id)
       .get()
       .go()
end

#retrieve_applicationsFusionAuth::ClientResponse

Retrieves all of the applications.

Returns:



929
930
931
932
933
# File 'lib/fusionauth/fusionauth_client.rb', line 929

def retrieve_applications()
  start.uri('/api/application')
       .get()
       .go()
end

#retrieve_audit_log(audit_log_id) ⇒ FusionAuth::ClientResponse

Retrieves a single audit log for the given Id.

Parameters:

  • audit_log_id (Numeric)

    The Id of the audit log to retrieve.

Returns:



941
942
943
944
945
946
# File 'lib/fusionauth/fusionauth_client.rb', line 941

def retrieve_audit_log(audit_log_id)
  start.uri('/api/system/audit-log')
       .url_segment(audit_log_id)
       .get()
       .go()
end

#retrieve_daily_active_report(application_id, start, _end) ⇒ FusionAuth::ClientResponse

Retrieves the daily active user report between the two instants. If you specify an application id, it will only return the daily active counts for that application.

Parameters:

  • application_id (string)

    (Optional) The application id.

  • start (OpenStruct, Hash)

    The start instant as UTC milliseconds since Epoch.

  • _end (OpenStruct, Hash)

    The end instant as UTC milliseconds since Epoch.

Returns:



957
958
959
960
961
962
963
964
# File 'lib/fusionauth/fusionauth_client.rb', line 957

def retrieve_daily_active_report(application_id, start, _end)
  start.uri('/api/report/daily-active-user')
       .url_parameter('applicationId', application_id)
       .url_parameter('start', start)
       .url_parameter('end', _end)
       .get()
       .go()
end

#retrieve_email_template(email_template_id) ⇒ FusionAuth::ClientResponse

Retrieves the email template for the given Id. If you don’t specify the id, this will return all of the email templates.

Parameters:

  • email_template_id (string)

    (Optional) The Id of the email template.

Returns:



972
973
974
975
976
977
# File 'lib/fusionauth/fusionauth_client.rb', line 972

def retrieve_email_template(email_template_id)
  start.uri('/api/email/template')
       .url_segment(email_template_id)
       .get()
       .go()
end

#retrieve_email_template_preview(request) ⇒ FusionAuth::ClientResponse

Creates a preview of the email template provided in the request. This allows you to preview an email template that hasn’t been saved to the database yet. The entire email template does not need to be provided on the request. This will create the preview based on whatever is given.

Parameters:

  • request (OpenStruct, Hash)

    The request that contains the email template and optionally a locale to render it in.

Returns:



987
988
989
990
991
992
# File 'lib/fusionauth/fusionauth_client.rb', line 987

def retrieve_email_template_preview(request)
  start.uri('/api/email/template/preview')
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .post()
       .go()
end

#retrieve_email_templatesFusionAuth::ClientResponse

Retrieves all of the email templates.

Returns:



999
1000
1001
1002
1003
# File 'lib/fusionauth/fusionauth_client.rb', line 999

def retrieve_email_templates()
  start.uri('/api/email/template')
       .get()
       .go()
end

#retrieve_group(group_id) ⇒ FusionAuth::ClientResponse

Retrieves the group for the given Id.

Parameters:

  • group_id (string)

    The Id of the group.

Returns:



1011
1012
1013
1014
1015
1016
# File 'lib/fusionauth/fusionauth_client.rb', line 1011

def retrieve_group(group_id)
  start.uri('/api/group')
       .url_segment(group_id)
       .get()
       .go()
end

#retrieve_groupsFusionAuth::ClientResponse

Retrieves all of the groups.

Returns:



1023
1024
1025
1026
1027
# File 'lib/fusionauth/fusionauth_client.rb', line 1023

def retrieve_groups()
  start.uri('/api/group')
       .get()
       .go()
end

#retrieve_identity_provider(identity_provider_id) ⇒ FusionAuth::ClientResponse

Retrieves the identity provider for the given id or all of the identity providers if the id is null.

Parameters:

  • identity_provider_id (string)

    (Optional) The identity provider id.

Returns:



1035
1036
1037
1038
1039
1040
# File 'lib/fusionauth/fusionauth_client.rb', line 1035

def retrieve_identity_provider(identity_provider_id)
  start.uri('/api/identity-provider')
       .url_segment(identity_provider_id)
       .get()
       .go()
end

#retrieve_identity_providersFusionAuth::ClientResponse

Retrieves all of the identity providers.

Returns:



1047
1048
1049
1050
1051
# File 'lib/fusionauth/fusionauth_client.rb', line 1047

def retrieve_identity_providers()
  start.uri('/api/identity-provider')
       .get()
       .go()
end

#retrieve_inactive_applicationsFusionAuth::ClientResponse

Retrieves all of the applications that are currently inactive.

Returns:



1058
1059
1060
1061
1062
1063
# File 'lib/fusionauth/fusionauth_client.rb', line 1058

def retrieve_inactive_applications()
  start.uri('/api/application')
       .url_parameter('inactive', true)
       .get()
       .go()
end

#retrieve_inactive_user_actionsFusionAuth::ClientResponse

Retrieves all of the user actions that are currently inactive.

Returns:



1070
1071
1072
1073
1074
1075
# File 'lib/fusionauth/fusionauth_client.rb', line 1070

def ()
  start.uri('/api/user-action')
       .url_parameter('inactive', true)
       .get()
       .go()
end

#retrieve_integrationFusionAuth::ClientResponse

Retrieves the available integrations.

Returns:



1082
1083
1084
1085
1086
# File 'lib/fusionauth/fusionauth_client.rb', line 1082

def retrieve_integration()
  start.uri('/api/integration')
       .get()
       .go()
end

#retrieve_jwt_public_key(key_id) ⇒ FusionAuth::ClientResponse

Retrieves the Public Key configured for verifying JSON Web Tokens (JWT) by the key Id. If the key Id is provided a single public key will be returned if one is found by that id. If the optional parameter key Id is not provided all public keys will be returned.

Parameters:

  • key_id (string)

    (Optional) The Id of the public key.

Returns:



1096
1097
1098
1099
1100
1101
# File 'lib/fusionauth/fusionauth_client.rb', line 1096

def retrieve_jwt_public_key(key_id)
  start.uri('/api/jwt/public-key')
       .url_segment(key_id)
       .get()
       .go()
end

#retrieve_jwt_public_keysFusionAuth::ClientResponse

Retrieves all Public Keys configured for verifying JSON Web Tokens (JWT).

Returns:



1108
1109
1110
1111
1112
# File 'lib/fusionauth/fusionauth_client.rb', line 1108

def retrieve_jwt_public_keys()
  start.uri('/api/jwt/public-key')
       .get()
       .go()
end

#retrieve_login_report(application_id, start, _end) ⇒ FusionAuth::ClientResponse

Retrieves the login report between the two instants. If you specify an application id, it will only return the login counts for that application.

Parameters:

  • application_id (string)

    (Optional) The application id.

  • start (OpenStruct, Hash)

    The start instant as UTC milliseconds since Epoch.

  • _end (OpenStruct, Hash)

    The end instant as UTC milliseconds since Epoch.

Returns:



1123
1124
1125
1126
1127
1128
1129
1130
# File 'lib/fusionauth/fusionauth_client.rb', line 1123

def (application_id, start, _end)
  start.uri('/api/report/login')
       .url_parameter('applicationId', application_id)
       .url_parameter('start', start)
       .url_parameter('end', _end)
       .get()
       .go()
end

#retrieve_monthly_active_report(application_id, start, _end) ⇒ FusionAuth::ClientResponse

Retrieves the monthly active user report between the two instants. If you specify an application id, it will only return the monthly active counts for that application.

Parameters:

  • application_id (string)

    (Optional) The application id.

  • start (OpenStruct, Hash)

    The start instant as UTC milliseconds since Epoch.

  • _end (OpenStruct, Hash)

    The end instant as UTC milliseconds since Epoch.

Returns:



1141
1142
1143
1144
1145
1146
1147
1148
# File 'lib/fusionauth/fusionauth_client.rb', line 1141

def retrieve_monthly_active_report(application_id, start, _end)
  start.uri('/api/report/monthly-active-user')
       .url_parameter('applicationId', application_id)
       .url_parameter('start', start)
       .url_parameter('end', _end)
       .get()
       .go()
end

#retrieve_oauth_configuration(application_id) ⇒ FusionAuth::ClientResponse

Retrieves the Oauth2 configuration for the application for the given Application Id.

Parameters:

  • application_id (string)

    The Id of the Application to retrieve OAuth configuration.

Returns:



1156
1157
1158
1159
1160
1161
1162
# File 'lib/fusionauth/fusionauth_client.rb', line 1156

def retrieve_oauth_configuration(application_id)
  start.uri('/api/application')
       .url_segment(application_id)
       .url_segment("oauth-configuration")
       .get()
       .go()
end

#retrieve_password_validation_rulesFusionAuth::ClientResponse

Retrieves the password validation rules.

Returns:



1169
1170
1171
1172
1173
# File 'lib/fusionauth/fusionauth_client.rb', line 1169

def retrieve_password_validation_rules()
  start.uri('/api/system-configuration/password-validation-rules')
       .get()
       .go()
end

#retrieve_refresh_tokens(user_id) ⇒ FusionAuth::ClientResponse

Retrieves the refresh tokens that belong to the user with the given Id.

Parameters:

  • user_id (string)

    The Id of the user.

Returns:



1181
1182
1183
1184
1185
1186
# File 'lib/fusionauth/fusionauth_client.rb', line 1181

def retrieve_refresh_tokens(user_id)
  start.uri('/api/jwt/refresh')
       .url_parameter('userId', user_id)
       .get()
       .go()
end

#retrieve_registration(user_id, application_id) ⇒ FusionAuth::ClientResponse

Retrieves the user registration for the user with the given id and the given application id.

Parameters:

  • user_id (string)

    The Id of the user.

  • application_id (string)

    The Id of the application.

Returns:



1195
1196
1197
1198
1199
1200
1201
# File 'lib/fusionauth/fusionauth_client.rb', line 1195

def retrieve_registration(user_id, application_id)
  start.uri('/api/user/registration')
       .url_segment(user_id)
       .url_segment(application_id)
       .get()
       .go()
end

#retrieve_registration_report(application_id, start, _end) ⇒ FusionAuth::ClientResponse

Retrieves the registration report between the two instants. If you specify an application id, it will only return the registration counts for that application.

Parameters:

  • application_id (string)

    (Optional) The application id.

  • start (OpenStruct, Hash)

    The start instant as UTC milliseconds since Epoch.

  • _end (OpenStruct, Hash)

    The end instant as UTC milliseconds since Epoch.

Returns:



1212
1213
1214
1215
1216
1217
1218
1219
# File 'lib/fusionauth/fusionauth_client.rb', line 1212

def retrieve_registration_report(application_id, start, _end)
  start.uri('/api/report/registration')
       .url_parameter('applicationId', application_id)
       .url_parameter('start', start)
       .url_parameter('end', _end)
       .get()
       .go()
end

#retrieve_system_configurationFusionAuth::ClientResponse

Retrieves the system configuration.

Returns:



1226
1227
1228
1229
1230
# File 'lib/fusionauth/fusionauth_client.rb', line 1226

def retrieve_system_configuration()
  start.uri('/api/system-configuration')
       .get()
       .go()
end

#retrieve_tenant(tenant_id) ⇒ FusionAuth::ClientResponse

Retrieves the tenant for the given Id.

Parameters:

  • tenant_id (string)

    The Id of the tenant.

Returns:



1238
1239
1240
1241
1242
1243
# File 'lib/fusionauth/fusionauth_client.rb', line 1238

def retrieve_tenant(tenant_id)
  start.uri('/api/tenant')
       .url_segment(tenant_id)
       .get()
       .go()
end

#retrieve_tenantsFusionAuth::ClientResponse

Retrieves all of the tenants.

Returns:



1250
1251
1252
1253
1254
# File 'lib/fusionauth/fusionauth_client.rb', line 1250

def retrieve_tenants()
  start.uri('/api/tenant')
       .get()
       .go()
end

#retrieve_total_reportFusionAuth::ClientResponse

Retrieves the totals report. This contains all of the total counts for each application and the global registration count.

Returns:



1262
1263
1264
1265
1266
# File 'lib/fusionauth/fusionauth_client.rb', line 1262

def retrieve_total_report()
  start.uri('/api/report/totals')
       .get()
       .go()
end

#retrieve_user(user_id) ⇒ FusionAuth::ClientResponse

Retrieves the user for the given Id.

Parameters:

  • user_id (string)

    The Id of the user.

Returns:



1274
1275
1276
1277
1278
1279
# File 'lib/fusionauth/fusionauth_client.rb', line 1274

def retrieve_user(user_id)
  start.uri('/api/user')
       .url_segment(user_id)
       .get()
       .go()
end

#retrieve_user_action(user_action_id) ⇒ FusionAuth::ClientResponse

Retrieves the user action for the given Id. If you pass in null for the id, this will return all of the user actions.

Parameters:

  • user_action_id (string)

    (Optional) The Id of the user action.

Returns:



1288
1289
1290
1291
1292
1293
# File 'lib/fusionauth/fusionauth_client.rb', line 1288

def retrieve_user_action(user_action_id)
  start.uri('/api/user-action')
       .url_segment(user_action_id)
       .get()
       .go()
end

#retrieve_user_action_reason(user_action_reason_id) ⇒ FusionAuth::ClientResponse

Retrieves the user action reason for the given Id. If you pass in null for the id, this will return all of the user action reasons.

Parameters:

  • user_action_reason_id (string)

    (Optional) The Id of the user action reason.

Returns:



1302
1303
1304
1305
1306
1307
# File 'lib/fusionauth/fusionauth_client.rb', line 1302

def retrieve_user_action_reason(user_action_reason_id)
  start.uri('/api/user-action-reason')
       .url_segment(user_action_reason_id)
       .get()
       .go()
end

#retrieve_user_action_reasonsFusionAuth::ClientResponse

Retrieves all the user action reasons.

Returns:



1314
1315
1316
1317
1318
# File 'lib/fusionauth/fusionauth_client.rb', line 1314

def retrieve_user_action_reasons()
  start.uri('/api/user-action-reason')
       .get()
       .go()
end

#retrieve_user_actionsFusionAuth::ClientResponse

Retrieves all of the user actions.

Returns:



1325
1326
1327
1328
1329
# File 'lib/fusionauth/fusionauth_client.rb', line 1325

def ()
  start.uri('/api/user-action')
       .get()
       .go()
end

#retrieve_user_by_change_password_id(change_password_id) ⇒ FusionAuth::ClientResponse

Retrieves the user by a change password Id. The intended use of this API is to retrieve a user after the forgot password workflow has been initiated and you may not know the user’s email or username.

Parameters:

  • change_password_id (string)

    The unique change password Id that was sent via email or returned by the Forgot Password API.

Returns:



1338
1339
1340
1341
1342
1343
# File 'lib/fusionauth/fusionauth_client.rb', line 1338

def retrieve_user_by_change_password_id(change_password_id)
  start.uri('/api/user')
       .url_parameter('changePasswordId', change_password_id)
       .get()
       .go()
end

#retrieve_user_by_email(email) ⇒ FusionAuth::ClientResponse

Retrieves the user for the given email.

Parameters:

  • email (string)

    The email of the user.

Returns:



1351
1352
1353
1354
1355
1356
# File 'lib/fusionauth/fusionauth_client.rb', line 1351

def retrieve_user_by_email(email)
  start.uri('/api/user')
       .url_parameter('email', email)
       .get()
       .go()
end

#retrieve_user_by_login_id(login_id) ⇒ FusionAuth::ClientResponse

Retrieves the user for the loginId. The loginId can be either the username or the email.

Parameters:

  • login_id (string)

    The email or username of the user.

Returns:



1364
1365
1366
1367
1368
1369
# File 'lib/fusionauth/fusionauth_client.rb', line 1364

def ()
  start.uri('/api/user')
       .url_parameter('loginId', )
       .get()
       .go()
end

#retrieve_user_by_username(username) ⇒ FusionAuth::ClientResponse

Retrieves the user for the given username.

Parameters:

  • username (string)

    The username of the user.

Returns:



1377
1378
1379
1380
1381
1382
# File 'lib/fusionauth/fusionauth_client.rb', line 1377

def retrieve_user_by_username(username)
  start.uri('/api/user')
       .url_parameter('username', username)
       .get()
       .go()
end

#retrieve_user_by_verification_id(verification_id) ⇒ FusionAuth::ClientResponse

Retrieves the user by a verificationId. The intended use of this API is to retrieve a user after the forgot password workflow has been initiated and you may not know the user’s email or username.

Parameters:

  • verification_id (string)

    The unique verification Id that has been set on the user object.

Returns:



1391
1392
1393
1394
1395
1396
# File 'lib/fusionauth/fusionauth_client.rb', line 1391

def retrieve_user_by_verification_id(verification_id)
  start.uri('/api/user')
       .url_parameter('verificationId', verification_id)
       .get()
       .go()
end

#retrieve_user_comments(user_id) ⇒ FusionAuth::ClientResponse

Retrieves all of the comments for the user with the given Id.

Parameters:

  • user_id (string)

    The Id of the user.

Returns:



1404
1405
1406
1407
1408
1409
# File 'lib/fusionauth/fusionauth_client.rb', line 1404

def retrieve_user_comments(user_id)
  start.uri('/api/user/comment')
       .url_segment(user_id)
       .get()
       .go()
end

#retrieve_user_login_report(user_id, offset, limit) ⇒ FusionAuth::ClientResponse

Retrieves the last number of login records for a user.

Parameters:

  • user_id (string)

    The Id of the user.

  • offset (Numeric)

    The initial record. e.g. 0 is the last login, 100 will be the 100th most recent login.

  • limit (Numeric)

    (Optional, defaults to 10) The number of records to retrieve.

Returns:



1419
1420
1421
1422
1423
1424
1425
1426
# File 'lib/fusionauth/fusionauth_client.rb', line 1419

def (user_id, offset, limit)
  start.uri('/api/report/user-login')
       .url_parameter('userId', user_id)
       .url_parameter('offset', offset)
       .url_parameter('limit', limit)
       .get()
       .go()
end

#retrieve_user_using_jwt(encoded_jwt) ⇒ FusionAuth::ClientResponse

Retrieves the user for the given Id. This method does not use an API key, instead it uses a JSON Web Token (JWT) for authentication.

Parameters:

  • encoded_jwt (string)

    The encoded JWT (access token).

Returns:



1434
1435
1436
1437
1438
1439
# File 'lib/fusionauth/fusionauth_client.rb', line 1434

def retrieve_user_using_jwt(encoded_jwt)
  start.uri('/api/user')
       .authorization('JWT ' + encoded_jwt)
       .get()
       .go()
end

#retrieve_webhook(webhook_id) ⇒ FusionAuth::ClientResponse

Retrieves the webhook for the given Id. If you pass in null for the id, this will return all the webhooks.

Parameters:

  • webhook_id (string)

    (Optional) The Id of the webhook.

Returns:



1447
1448
1449
1450
1451
1452
# File 'lib/fusionauth/fusionauth_client.rb', line 1447

def retrieve_webhook(webhook_id)
  start.uri('/api/webhook')
       .url_segment(webhook_id)
       .get()
       .go()
end

#retrieve_webhooksFusionAuth::ClientResponse

Retrieves all the webhooks.

Returns:



1459
1460
1461
1462
1463
# File 'lib/fusionauth/fusionauth_client.rb', line 1459

def retrieve_webhooks()
  start.uri('/api/webhook')
       .get()
       .go()
end

#revoke_refresh_token(token, user_id, application_id) ⇒ FusionAuth::ClientResponse

Revokes a single refresh token, all tokens for a user or all tokens for an application. If you provide a user id and an application id, this will delete all the refresh tokens for that user for that application.

Parameters:

  • token (string)

    (Optional) The refresh token to delete.

  • user_id (string)

    (Optional) The user id whose tokens to delete.

  • application_id (string)

    (Optional) The application id of the tokens to delete.

Returns:



1474
1475
1476
1477
1478
1479
1480
1481
# File 'lib/fusionauth/fusionauth_client.rb', line 1474

def revoke_refresh_token(token, user_id, application_id)
  start.uri('/api/jwt/refresh')
       .url_parameter('token', token)
       .url_parameter('userId', user_id)
       .url_parameter('applicationId', application_id)
       .delete()
       .go()
end

#search_audit_logs(request) ⇒ FusionAuth::ClientResponse

Searches the audit logs with the specified criteria and pagination.

Parameters:

  • request (OpenStruct, Hash)

    The search criteria and pagination information.

Returns:



1489
1490
1491
1492
1493
1494
# File 'lib/fusionauth/fusionauth_client.rb', line 1489

def search_audit_logs(request)
  start.uri('/api/system/audit-log/search')
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .post()
       .go()
end

#search_users(ids) ⇒ FusionAuth::ClientResponse

Retrieves the users for the given ids. If any id is invalid, it is ignored.

Parameters:

  • ids (Array)

    The user ids to search for.

Returns:



1502
1503
1504
1505
1506
1507
# File 'lib/fusionauth/fusionauth_client.rb', line 1502

def search_users(ids)
  start.uri('/api/user/search')
       .url_parameter('ids', ids)
       .get()
       .go()
end

#search_users_by_query_string(request) ⇒ FusionAuth::ClientResponse

Retrieves the users for the given search criteria and pagination.

Parameters:

  • request (OpenStruct, Hash)

    The search criteria and pagination constraints. Fields used: queryString, numberOfResults, startRow, and sort fields.

Returns:



1516
1517
1518
1519
1520
1521
# File 'lib/fusionauth/fusionauth_client.rb', line 1516

def search_users_by_query_string(request)
  start.uri('/api/user/search')
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .post()
       .go()
end

#send_email(email_template_id, request) ⇒ FusionAuth::ClientResponse

Send an email using an email template id. You can optionally provide requestData to access key value pairs in the email template.

Parameters:

  • email_template_id (string)

    The id for the template.

  • request (OpenStruct, Hash)

    The send email request that contains all of the information used to send the email.

Returns:



1531
1532
1533
1534
1535
1536
1537
# File 'lib/fusionauth/fusionauth_client.rb', line 1531

def send_email(email_template_id, request)
  start.uri('/api/email/send')
       .url_segment(email_template_id)
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .post()
       .go()
end

#send_two_factor_code(request) ⇒ FusionAuth::ClientResponse

Send a Two Factor authentication code to assist in setting up Two Factor authentication or disabling.

Parameters:

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to send the code.

Returns:



1545
1546
1547
1548
1549
1550
# File 'lib/fusionauth/fusionauth_client.rb', line 1545

def send_two_factor_code(request)
  start.uri('/api/two-factor/send')
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .post()
       .go()
end

#send_two_factor_code_for_login(two_factor_id) ⇒ FusionAuth::ClientResponse

Send a Two Factor authentication code to allow the completion of Two Factor authentication.

Parameters:

  • two_factor_id (string)

    The Id returned by the Login API necessary to complete Two Factor authentication.

Returns:



1558
1559
1560
1561
1562
1563
# File 'lib/fusionauth/fusionauth_client.rb', line 1558

def (two_factor_id)
  start.uri('/api/two-factor/send')
       .url_segment(two_factor_id)
       .post()
       .go()
end

#two_factor_login(request) ⇒ FusionAuth::ClientResponse

Complete login using a 2FA challenge

Parameters:

  • request (OpenStruct, Hash)

    The login request that contains the user credentials used to log them in.

Returns:



1571
1572
1573
1574
1575
1576
# File 'lib/fusionauth/fusionauth_client.rb', line 1571

def (request)
  start.uri('/api/two-factor/login')
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .post()
       .go()
end

#update_application(application_id, request) ⇒ FusionAuth::ClientResponse

Updates the application with the given Id.

Parameters:

  • application_id (string)

    The Id of the application to update.

  • request (OpenStruct, Hash)

    The request that contains all of the new application information.

Returns:



1585
1586
1587
1588
1589
1590
1591
# File 'lib/fusionauth/fusionauth_client.rb', line 1585

def update_application(application_id, request)
  start.uri('/api/application')
       .url_segment(application_id)
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .put()
       .go()
end

#update_application_role(application_id, role_id, request) ⇒ FusionAuth::ClientResponse

Updates the application role with the given id for the application.

Parameters:

  • application_id (string)

    The Id of the application that the role belongs to.

  • role_id (string)

    The Id of the role to update.

  • request (OpenStruct, Hash)

    The request that contains all of the new role information.

Returns:



1601
1602
1603
1604
1605
1606
1607
1608
1609
# File 'lib/fusionauth/fusionauth_client.rb', line 1601

def update_application_role(application_id, role_id, request)
  start.uri('/api/application')
       .url_segment(application_id)
       .url_segment("role")
       .url_segment(role_id)
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .put()
       .go()
end

#update_email_template(email_template_id, request) ⇒ FusionAuth::ClientResponse

Updates the email template with the given Id.

Parameters:

  • email_template_id (string)

    The Id of the email template to update.

  • request (OpenStruct, Hash)

    The request that contains all of the new email template information.

Returns:



1618
1619
1620
1621
1622
1623
1624
# File 'lib/fusionauth/fusionauth_client.rb', line 1618

def update_email_template(email_template_id, request)
  start.uri('/api/email/template')
       .url_segment(email_template_id)
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .put()
       .go()
end

#update_group(group_id, request) ⇒ FusionAuth::ClientResponse

Updates the group with the given Id.

Parameters:

  • group_id (string)

    The Id of the group to update.

  • request (OpenStruct, Hash)

    The request that contains all of the new group information.

Returns:



1633
1634
1635
1636
1637
1638
1639
# File 'lib/fusionauth/fusionauth_client.rb', line 1633

def update_group(group_id, request)
  start.uri('/api/group')
       .url_segment(group_id)
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .put()
       .go()
end

#update_identity_provider(identity_provider_id, request) ⇒ FusionAuth::ClientResponse

Updates the identity provider with the given Id.

Parameters:

  • identity_provider_id (string)

    The Id of the identity provider to update.

  • request (OpenStruct, Hash)

    The request object that contains the updated identity provider.

Returns:



1648
1649
1650
1651
1652
1653
1654
# File 'lib/fusionauth/fusionauth_client.rb', line 1648

def update_identity_provider(identity_provider_id, request)
  start.uri('/api/identity-provider')
       .url_segment(identity_provider_id)
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .put()
       .go()
end

#update_integrations(request) ⇒ FusionAuth::ClientResponse

Updates the available integrations.

Parameters:

  • request (OpenStruct, Hash)

    The request that contains all of the new integration information.

Returns:



1662
1663
1664
1665
1666
1667
# File 'lib/fusionauth/fusionauth_client.rb', line 1662

def update_integrations(request)
  start.uri('/api/integration')
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .put()
       .go()
end

#update_registration(user_id, request) ⇒ FusionAuth::ClientResponse

Updates the registration for the user with the given id and the application defined in the request.

Parameters:

  • user_id (string)

    The Id of the user whose registration is going to be updated.

  • request (OpenStruct, Hash)

    The request that contains all of the new registration information.

Returns:



1676
1677
1678
1679
1680
1681
1682
# File 'lib/fusionauth/fusionauth_client.rb', line 1676

def update_registration(user_id, request)
  start.uri('/api/user/registration')
       .url_segment(user_id)
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .put()
       .go()
end

#update_system_configuration(request) ⇒ FusionAuth::ClientResponse

Updates the system configuration.

Parameters:

  • request (OpenStruct, Hash)

    The request that contains all of the new system configuration information.

Returns:



1690
1691
1692
1693
1694
1695
# File 'lib/fusionauth/fusionauth_client.rb', line 1690

def update_system_configuration(request)
  start.uri('/api/system-configuration')
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .put()
       .go()
end

#update_tenant(tenant_id, request) ⇒ FusionAuth::ClientResponse

Updates the tenant with the given Id.

Parameters:

  • tenant_id (string)

    The Id of the tenant to update.

  • request (OpenStruct, Hash)

    The request that contains all of the new tenant information.

Returns:



1704
1705
1706
1707
1708
1709
1710
# File 'lib/fusionauth/fusionauth_client.rb', line 1704

def update_tenant(tenant_id, request)
  start.uri('/api/tenant')
       .url_segment(tenant_id)
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .put()
       .go()
end

#update_user(user_id, request) ⇒ FusionAuth::ClientResponse

Updates the user with the given Id.

Parameters:

  • user_id (string)

    The Id of the user to update.

  • request (OpenStruct, Hash)

    The request that contains all of the new user information.

Returns:



1719
1720
1721
1722
1723
1724
1725
# File 'lib/fusionauth/fusionauth_client.rb', line 1719

def update_user(user_id, request)
  start.uri('/api/user')
       .url_segment(user_id)
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .put()
       .go()
end

#update_user_action(user_action_id, request) ⇒ FusionAuth::ClientResponse

Updates the user action with the given Id.

Parameters:

  • user_action_id (string)

    The Id of the user action to update.

  • request (OpenStruct, Hash)

    The request that contains all of the new user action information.

Returns:



1734
1735
1736
1737
1738
1739
1740
# File 'lib/fusionauth/fusionauth_client.rb', line 1734

def update_user_action(user_action_id, request)
  start.uri('/api/user-action')
       .url_segment(user_action_id)
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .put()
       .go()
end

#update_user_action_reason(user_action_reason_id, request) ⇒ FusionAuth::ClientResponse

Updates the user action reason with the given Id.

Parameters:

  • user_action_reason_id (string)

    The Id of the user action reason to update.

  • request (OpenStruct, Hash)

    The request that contains all of the new user action reason information.

Returns:



1749
1750
1751
1752
1753
1754
1755
# File 'lib/fusionauth/fusionauth_client.rb', line 1749

def update_user_action_reason(user_action_reason_id, request)
  start.uri('/api/user-action-reason')
       .url_segment(user_action_reason_id)
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .put()
       .go()
end

#update_webhook(webhook_id, request) ⇒ FusionAuth::ClientResponse

Updates the webhook with the given Id.

Parameters:

  • webhook_id (string)

    The Id of the webhook to update.

  • request (OpenStruct, Hash)

    The request that contains all of the new webhook information.

Returns:



1764
1765
1766
1767
1768
1769
1770
# File 'lib/fusionauth/fusionauth_client.rb', line 1764

def update_webhook(webhook_id, request)
  start.uri('/api/webhook')
       .url_segment(webhook_id)
       .body_handler(FusionAuth::JSONBodyHandler.new(request))
       .put()
       .go()
end

#validate_jwt(encoded_jwt) ⇒ FusionAuth::ClientResponse

Validates the provided JWT (encoded JWT string) to ensure the token is valid. A valid access token is properly signed and not expired. <p> This API may be used to verify the JWT as well as decode the encoded JWT into human readable identity claims.

Parameters:

  • encoded_jwt (string)

    The encoded JWT (access token).

Returns:



1781
1782
1783
1784
1785
1786
# File 'lib/fusionauth/fusionauth_client.rb', line 1781

def validate_jwt(encoded_jwt)
  start.uri('/api/jwt/validate')
       .authorization('JWT ' + encoded_jwt)
       .get()
       .go()
end

#verify_email(verification_id) ⇒ FusionAuth::ClientResponse

Confirms a email verification. The Id given is usually from an email sent to the user.

Parameters:

  • verification_id (string)

    The email verification id sent to the user.

Returns:



1794
1795
1796
1797
1798
1799
# File 'lib/fusionauth/fusionauth_client.rb', line 1794

def verify_email(verification_id)
  start.uri('/api/user/verify-email')
       .url_segment(verification_id)
       .post()
       .go()
end

#verify_registration(verification_id) ⇒ FusionAuth::ClientResponse

Confirms an application registration. The Id given is usually from an email sent to the user.

Parameters:

  • verification_id (string)

    The registration verification Id sent to the user.

Returns:



1807
1808
1809
1810
1811
1812
# File 'lib/fusionauth/fusionauth_client.rb', line 1807

def verify_registration(verification_id)
  start.uri('/api/user/verify-registration')
       .url_segment(verification_id)
       .post()
       .go()
end