auth0 5.4.0 → 5.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (233) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +2 -1
  3. data/.gitignore +0 -1
  4. data/.shiprc +7 -0
  5. data/CHANGELOG.md +106 -30
  6. data/Gemfile +1 -0
  7. data/Gemfile.lock +233 -0
  8. data/README.md +10 -8
  9. data/auth0.gemspec +2 -1
  10. data/lib/auth0/api/authentication_endpoints.rb +40 -16
  11. data/lib/auth0/api/v2/actions.rb +210 -0
  12. data/lib/auth0/api/v2/attack_protection.rb +79 -0
  13. data/lib/auth0/api/v2/grants.rb +49 -0
  14. data/lib/auth0/api/v2/organizations.rb +1 -1
  15. data/lib/auth0/api/v2.rb +6 -0
  16. data/lib/auth0/exception.rb +12 -0
  17. data/lib/auth0/mixins/api_token_struct.rb +0 -1
  18. data/lib/auth0/mixins/httpproxy.rb +76 -40
  19. data/lib/auth0/mixins/initializer.rb +2 -3
  20. data/lib/auth0/mixins/token_management.rb +32 -0
  21. data/lib/auth0/mixins/validation.rb +1 -1
  22. data/lib/auth0/mixins.rb +2 -0
  23. data/lib/auth0/version.rb +1 -1
  24. data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_change_password/should_trigger_a_password_reset.yml +53 -23
  25. data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_login_with_resource_owner/should_fail_with_an_incorrect_email.yml +49 -18
  26. data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_login_with_resource_owner/should_fail_with_an_incorrect_password.yml +49 -18
  27. data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_login_with_resource_owner/should_fail_with_an_invalid_audience.yml +46 -15
  28. data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_login_with_resource_owner/should_login_successfully_with_a_custom_audience.yml +49 -79
  29. data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_login_with_resource_owner/should_login_successfully_with_a_default_scope.yml +49 -80
  30. data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_saml_metadata/should_retrieve_SAML_metadata.yml +74 -21
  31. data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_userinfo/should_fail_as_not_authorized.yml +53 -14
  32. data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_userinfo/should_return_the_userinfo.yml +106 -48
  33. data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_wsfed_metadata/should_retrieve_WSFED_metadata.yml +62 -19
  34. data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/create_test_user.yml +57 -22
  35. data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/delete_test_user.yml +38 -20
  36. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Blacklists/_add_token_to_blacklist/should_add_a_token_to_the_blacklist.yml +37 -19
  37. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Blacklists/_blacklisted_tokens/should_get_the_added_token_from_the_blacklist.yml +38 -23
  38. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/_client_grants/should_return_at_least_1_result.yml +42 -26
  39. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/_client_grants/should_return_the_test_client_grant.yml +42 -26
  40. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/_delete_client_grant/should_delete_the_test_client_grant.yml +38 -20
  41. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/_patch_client_grant/should_update_the_test_client_grant.yml +39 -27
  42. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/create_test_client.yml +44 -82
  43. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/create_test_client_grant.yml +39 -27
  44. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/delete_test_client.yml +38 -20
  45. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/delete_test_client_grant.yml +38 -20
  46. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_client/_filters/should_exclude_and_include_fields_properly.yml +43 -56
  47. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_client/_filters/should_include_the_specified_fields.yml +39 -28
  48. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_client/should_get_the_test_client.yml +43 -57
  49. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_clients/_filters/should_exclude_fields_not_specified.yml +43 -24
  50. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_clients/_filters/should_exclude_the_specified_fields.yml +236 -96
  51. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_clients/_filters/should_include_the_specified_fields.yml +52 -27
  52. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_clients/_filters/should_paginate_results.yml +39 -25
  53. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_clients/should_get_at_least_one_client.yml +235 -96
  54. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_delete_client/should_delete_the_test_client_without_an_error.yml +38 -20
  55. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_patch_client/should_update_the_client_with_the_correct_attributes.yml +43 -57
  56. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/create_test_client.yml +45 -82
  57. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connection/_filters/should_exclude_the_fields_indicated.yml +15 -16
  58. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connection/_filters/should_include_the_fields_indicated.yml +15 -16
  59. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connection/should_find_the_correct_connection.yml +15 -16
  60. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/_filters/should_include_previously-created_connection_when_filtered.yml +14 -15
  61. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/_filters/should_should_exclude_the_fields_indicated_from_filtered_results.yml +14 -15
  62. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/_filters/should_should_include_the_fields_indicated_from_filtered_results.yml +14 -15
  63. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/should_include_the_previously_created_connection.yml +15 -15
  64. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/should_not_be_empty.yml +15 -15
  65. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_delete_connection/should_delete_the_connection.yml +15 -16
  66. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_delete_connection_user/should_delete_the_user_created.yml +29 -27
  67. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_update_connection/should_update_the_connection.yml +15 -16
  68. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/create_test_connection.yml +16 -17
  69. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/create_test_user.yml +40 -32
  70. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/create_test_credential.yml +40 -30
  71. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/create_test_user.yml +40 -32
  72. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/delete_test_user.yml +38 -20
  73. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_configure_provider/should_configure_a_new_email_provider.yml +37 -28
  74. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_delete_provider/should_delete_the_existing_email_provider_without_an_error.yml +37 -19
  75. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_delete_provider/should_throw_an_error_trying_to_get_the_email_provider.yml +34 -16
  76. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_get_provider/_filters/should_get_the_existing_email_provider_with_specific_fields.yml +36 -27
  77. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_get_provider/_filters/should_get_the_existing_email_provider_without_specific_fields.yml +36 -28
  78. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_get_provider/should_get_the_existing_email_provider.yml +36 -28
  79. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_update_provider/should_update_the_existing_email_provider.yml +36 -28
  80. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/delete_existing_provider.yml +37 -19
  81. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/_export_users_and_get_job/should_create_an_export_users_job_successfully.yml +38 -23
  82. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/_export_users_and_get_job/should_get_the_export_users_job.yml +76 -46
  83. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/_import_users_and_get_job/should_create_an_import_users_job_successfully.yml +46 -25
  84. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/_import_users_and_get_job/should_get_the_import_users_job.yml +84 -48
  85. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/_send_verification_email_and_get_job/should_create_a_new_verification_email_job.yml +77 -47
  86. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/_send_verification_email_and_get_job/should_get_the_completed_verification_email.yml +116 -71
  87. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/_send_verification_email_and_get_job/should_reject_an_invalid_client_id.yml +76 -39
  88. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/delete_imported_user.yml +76 -43
  89. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/search_for_connection_id.yml +43 -23
  90. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/_log/should_match_the_created_log_entry.yml +224 -196
  91. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/_log/should_not_be_empty.yml +224 -196
  92. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/_logs/_filters/should_exclude_fields_not_specified.yml +38 -25
  93. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/_logs/_filters/should_exclude_the_specified_fields.yml +39 -39
  94. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/_logs/_filters/should_have_one_log_entry.yml +41 -40
  95. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/_logs/_filters/should_include_the_specified_fields.yml +38 -26
  96. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/_logs/_from/should_take_one_log_entry.yml +229 -189
  97. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/create_test_user.yml +40 -32
  98. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/delete_test_disabled_rule.yml +38 -20
  99. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/delete_test_enabled_rule.yml +38 -20
  100. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/delete_test_user.yml +38 -20
  101. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/_delete_resource_server/should_delete_the_test_server_without_an_error.yml +38 -20
  102. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/_patch_resource_server/should_update_the_resource_server_with_the_correct_attributes.yml +39 -24
  103. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/_resource_server/should_get_the_test_server.yml +39 -24
  104. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/_resource_servers/should_get_the_test_server.yml +146 -23
  105. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/_resource_servers/should_return_at_least_1_result.yml +146 -23
  106. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/_resource_servers/should_return_the_first_page_of_one_result.yml +131 -24
  107. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/create_test_server.yml +40 -25
  108. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/delete_test_server.yml +38 -20
  109. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_add_role_permissions/should_add_a_Permission_to_the_Role_successfully.yml +39 -32
  110. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_add_role_users/should_add_a_User_to_the_Role_successfully.yml +38 -31
  111. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_delete_role/should_delete_the_Role_successfully.yml +42 -30
  112. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_get_role/should_get_the_Role_successfully.yml +38 -30
  113. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_get_role_permissions/should_get_exactly_1_Permission.yml +37 -30
  114. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_get_role_permissions/should_get_the_added_Permission_from_the_Role_successfully.yml +37 -30
  115. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_get_role_users/should_get_exactly_1_User.yml +37 -30
  116. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_get_role_users/should_get_the_added_User_from_the_Role_successfully.yml +37 -30
  117. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_get_roles/should_get_the_Role_successfully.yml +37 -29
  118. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_remove_role_permissions/should_remove_a_Permission_from_the_Role_successfully.yml +39 -29
  119. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_update_role/should_update_the_Role_successfully.yml +37 -30
  120. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/create_test_api.yml +38 -31
  121. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/create_test_role.yml +39 -31
  122. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/create_test_user.yml +38 -31
  123. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/delete_test_api.yml +36 -26
  124. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/delete_test_user.yml +36 -26
  125. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_delete_rule/should_delete_the_test_disabled_rule_without_an_error.yml +38 -20
  126. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_delete_rule/should_delete_the_test_enabled_rule_without_an_error.yml +38 -20
  127. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rule/_filters/should_exclude_the_fields_not_specified.yml +40 -27
  128. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rule/_filters/should_exclude_the_specified_fields.yml +40 -27
  129. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rule/_filters/should_include_the_specified_fields.yml +39 -26
  130. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rule/should_get_a_specific_rule.yml +40 -27
  131. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rules/_filters/should_exclude_fields_not_specified.yml +80 -24
  132. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rules/_filters/should_include_the_specified_fields.yml +82 -25
  133. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rules/_filters/should_return_at_least_1_disabled_rule.yml +59 -27
  134. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rules/_filters/should_return_at_least_1_enabled_rule.yml +68 -26
  135. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rules/_filters/should_return_paginated_results.yml +78 -49
  136. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rules/should_return_at_least_1_rule.yml +84 -28
  137. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_update_rule/should_update_the_disabled_rule_to_be_enabled.yml +40 -27
  138. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/create_test_disabled_rule.yml +42 -29
  139. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/create_test_enabled_rule.yml +42 -29
  140. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Stats/_active_users/should_have_at_least_one_active_user.yml +38 -23
  141. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Stats/_daily_stats/should_have_at_least_one_stats_entry_for_the_timeframe.yml +38 -27
  142. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tenants/_get_tenant_settings/should_get_the_tenant_settings.yml +72 -59
  143. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tenants/_get_tenant_settings_with_specific_fields/should_exclude_a_field_not_requested.yml +38 -25
  144. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tenants/_get_tenant_settings_with_specific_fields/should_include_the_field_requested.yml +38 -25
  145. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tenants/_update_tenant_settings/should_revert_the_tenant_name.yml +72 -58
  146. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tenants/_update_tenant_settings/should_update_the_tenant_settings_with_a_new_tenant_name.yml +72 -58
  147. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tickets/_post_email_verification/should_create_an_email_verification_ticket.yml +39 -26
  148. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tickets/_post_password_change/should_create_a_password_change_ticket.yml +39 -26
  149. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tickets/create_test_user.yml +40 -32
  150. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tickets/delete_test_user.yml +38 -20
  151. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_add_user_permissions/should_add_a_Permissions_for_a_User_successfully.yml +39 -35
  152. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_add_user_roles/should_add_a_Role_to_a_User_successfully.yml +37 -25
  153. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_delete_user/should_delete_the_User_successfully.yml +36 -24
  154. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_delete_user/should_delete_the_secondary_User_successfully.yml +36 -24
  155. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_delete_user_provider/should_attempt_to_delete_the_MFA_provider_for_the_User.yml +36 -24
  156. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_get_enrollments/should_get_Enrollments_for_a_User_successfully.yml +37 -28
  157. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_get_user_permissions/should_get_exactly_1_Permission_for_a_User_successfully.yml +37 -28
  158. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_get_user_permissions/should_get_the_correct_Permission_for_a_User_successfully.yml +37 -28
  159. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_get_user_roles/should_get_Roles_for_a_User_successfully.yml +38 -28
  160. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_invalidate_browsers/should_invalidate_MFA_browsers_for_the_User_successfully.yml +36 -24
  161. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_link_user_account/should_link_two_Users_successfully.yml +38 -29
  162. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_patch_user/should_patch_the_User_successfully.yml +38 -28
  163. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_remove_user_permissions/should_remove_a_Permission_from_a_User_successfully.yml +39 -27
  164. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_remove_user_roles/should_remove_a_Role_from_a_User_successfully.yml +39 -27
  165. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_unlink_user_account/should_unlink_two_Users_successfully.yml +37 -28
  166. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_user/_filters/should_exclude_fields_not_indicated.yml +37 -28
  167. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_user/_filters/should_exclude_the_fields_indicated.yml +37 -28
  168. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_user/_filters/should_include_the_fields_indicated.yml +37 -28
  169. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_user/should_retrieve_the_created_user.yml +37 -28
  170. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_user_logs/should_get_Logs_for_a_User_successfully.yml +42 -30
  171. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_users/_filters/is_expected_to_find_a_user_with_a_v2_search_engine_query.yml +36 -27
  172. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_users/_filters/is_expected_to_find_a_user_with_a_v3_search_engine_query.yml +36 -27
  173. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_users/_filters/should_exclude_the_indicated_fields_when_paginated.yml +36 -27
  174. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_users/_filters/should_include_the_indicated_fields_when_paginated.yml +36 -27
  175. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_users/_filters/should_not_include_other_fields_when_paginated.yml +36 -27
  176. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_users/_filters/should_return_the_correct_number_of_results_when_paginated.yml +36 -27
  177. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_users/should_have_at_least_one_user.yml +37 -27
  178. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/create_secondary_test_user.yml +38 -29
  179. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/create_test_api.yml +38 -29
  180. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/create_test_role.yml +39 -29
  181. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/create_test_user.yml +38 -29
  182. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/delete_test_api.yml +36 -24
  183. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/delete_test_role.yml +42 -28
  184. data/spec/integration/lib/auth0/api/v2/api_client_grants_spec.rb +0 -9
  185. data/spec/integration/lib/auth0/api/v2/api_connections_spec.rb +3 -3
  186. data/spec/integration/lib/auth0/api/v2/api_email_spec.rb +0 -31
  187. data/spec/integration/lib/auth0/api/v2/api_jobs_spec.rb +4 -4
  188. data/spec/integration/lib/auth0/api/v2/api_logs_spec.rb +5 -5
  189. data/spec/integration/lib/auth0/api/v2/api_roles_spec.rb +3 -3
  190. data/spec/integration/lib/auth0/api/v2/api_tickets_spec.rb +4 -4
  191. data/spec/integration/lib/auth0/api/v2/api_user_blocks_spec.rb +8 -5
  192. data/spec/integration/lib/auth0/api/v2/api_users_spec.rb +6 -33
  193. data/spec/lib/auth0/api/v2/actions_spec.rb +312 -0
  194. data/spec/lib/auth0/api/v2/attack_protection_spec.rb +132 -0
  195. data/spec/lib/auth0/api/v2/blacklists_spec.rb +2 -2
  196. data/spec/lib/auth0/api/v2/branding_spec.rb +4 -3
  197. data/spec/lib/auth0/api/v2/client_grants_spec.rb +8 -8
  198. data/spec/lib/auth0/api/v2/clients_spec.rb +12 -12
  199. data/spec/lib/auth0/api/v2/connections_spec.rb +10 -10
  200. data/spec/lib/auth0/api/v2/device_credentials_spec.rb +4 -4
  201. data/spec/lib/auth0/api/v2/emails_spec.rb +2 -2
  202. data/spec/lib/auth0/api/v2/grants_spec.rb +91 -0
  203. data/spec/lib/auth0/api/v2/jobs_spec.rb +18 -17
  204. data/spec/lib/auth0/api/v2/log_streams_spec.rb +3 -3
  205. data/spec/lib/auth0/api/v2/logs_spec.rb +2 -2
  206. data/spec/lib/auth0/api/v2/organizations_spec.rb +13 -13
  207. data/spec/lib/auth0/api/v2/resource_servers_spec.rb +5 -5
  208. data/spec/lib/auth0/api/v2/roles_spec.rb +22 -22
  209. data/spec/lib/auth0/api/v2/rules_spec.rb +7 -7
  210. data/spec/lib/auth0/api/v2/stats_spec.rb +1 -1
  211. data/spec/lib/auth0/api/v2/tenants_spec.rb +1 -1
  212. data/spec/lib/auth0/api/v2/tickets_spec.rb +14 -14
  213. data/spec/lib/auth0/api/v2/user_blocks_spec.rb +2 -2
  214. data/spec/lib/auth0/api/v2/users_by_email_spec.rb +2 -2
  215. data/spec/lib/auth0/api/v2/users_spec.rb +23 -23
  216. data/spec/lib/auth0/client_spec.rb +3 -3
  217. data/spec/lib/auth0/mixins/httpproxy_spec.rb +293 -0
  218. data/spec/lib/auth0/mixins/initializer_spec.rb +87 -0
  219. data/spec/lib/auth0/mixins/token_management_spec.rb +125 -0
  220. data/spec/spec_helper.rb +1 -1
  221. data/spec/support/dummy_class_for_proxy.rb +1 -0
  222. data/spec/support/dummy_class_for_tokens.rb +17 -0
  223. metadata +35 -25
  224. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Anomaly/_check_if_ip_is_blocked/should_return_200_response_code.yml +0 -65
  225. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Anomaly/_remove_ip_block/should_remove_an_IP_successfully.yml +0 -60
  226. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/_client_grants/should_return_the_first_page_of_one_result.yml +0 -66
  227. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/_delete_device_credential/should_delete_the_test_credential_without_an_error.yml +0 -54
  228. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/_device_credentials/_filter_by_type/should_exclude_the_test_credential.yml +0 -59
  229. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/_device_credentials/should_have_at_least_1_entry.yml +0 -62
  230. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/_device_credentials/should_include_the_test_credential.yml +0 -62
  231. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/delete_test_credential.yml +0 -54
  232. data/spec/integration/lib/auth0/api/v2/api_anomaly_spec.rb +0 -17
  233. data/spec/integration/lib/auth0/api/v2/api_device_credentials_spec.rb +0 -128
@@ -17,23 +17,23 @@ describe Auth0::Api::V2::Roles do
17
17
 
18
18
  it 'is expected to get Roles with default parameters' do
19
19
  expect(@instance).to receive(:get).with(
20
- '/api/v2/roles',
20
+ '/api/v2/roles', {
21
21
  per_page: nil,
22
22
  page: nil,
23
23
  include_totals: nil,
24
24
  name_filter: nil
25
- )
25
+ })
26
26
  expect { @instance.get_roles }.not_to raise_error
27
27
  end
28
28
 
29
29
  it 'is expected to get Roles with custom parameters' do
30
30
  expect(@instance).to receive(:get).with(
31
- '/api/v2/roles',
31
+ '/api/v2/roles', {
32
32
  per_page: 10,
33
33
  page: 3,
34
34
  include_totals: true,
35
35
  name_filter: 'test'
36
- )
36
+ })
37
37
  expect do
38
38
  @instance.get_roles(per_page: 10, page: 3, include_totals: true, name_filter: 'test')
39
39
  end.not_to raise_error
@@ -76,10 +76,10 @@ describe Auth0::Api::V2::Roles do
76
76
 
77
77
  it 'is expected to post a new Role' do
78
78
  expect(@instance).to receive(:post).with(
79
- '/api/v2/roles',
79
+ '/api/v2/roles', {
80
80
  name: 'ROLE_NAME',
81
81
  description: 'ROLE_DESCRIPTION'
82
- )
82
+ })
83
83
  expect do
84
84
  @instance.create_role(
85
85
  'ROLE_NAME',
@@ -103,10 +103,10 @@ describe Auth0::Api::V2::Roles do
103
103
 
104
104
  it 'is expected to post an updated Role' do
105
105
  expect(@instance).to receive(:patch).with(
106
- '/api/v2/roles/ROLE_ID',
106
+ '/api/v2/roles/ROLE_ID', {
107
107
  name: 'ROLE_NAME',
108
108
  description: 'ROLE_DESCRIPTION'
109
- )
109
+ })
110
110
  expect do
111
111
  @instance.update_role(
112
112
  'ROLE_ID',
@@ -149,25 +149,25 @@ describe Auth0::Api::V2::Roles do
149
149
 
150
150
  it 'is expected to get Users for a Role with default parameters' do
151
151
  expect(@instance).to receive(:get).with(
152
- '/api/v2/roles/ROLE_ID/users',
152
+ '/api/v2/roles/ROLE_ID/users', {
153
153
  per_page: nil,
154
154
  page: nil,
155
155
  from: nil,
156
156
  take: nil,
157
157
  include_totals: nil
158
- )
158
+ })
159
159
  expect { @instance.get_role_users('ROLE_ID') }.not_to raise_error
160
160
  end
161
161
 
162
162
  it 'is expected to get Users for a Role with custom parameters' do
163
163
  expect(@instance).to receive(:get).with(
164
- '/api/v2/roles/ROLE_ID/users',
164
+ '/api/v2/roles/ROLE_ID/users', {
165
165
  per_page: 30,
166
166
  page: 4,
167
167
  from: 'org_id',
168
168
  take: 50,
169
169
  include_totals: true
170
- )
170
+ })
171
171
  expect do
172
172
  @instance.get_role_users('ROLE_ID', per_page: 30, page: 4, from: 'org_id', take: 50, include_totals: true)
173
173
  end.not_to raise_error
@@ -202,9 +202,9 @@ describe Auth0::Api::V2::Roles do
202
202
 
203
203
  it 'is expected to add Users to a Role' do
204
204
  expect(@instance).to receive(:post).with(
205
- '/api/v2/roles/ROLE_ID/users',
205
+ '/api/v2/roles/ROLE_ID/users', {
206
206
  users: %w[test|user-01 test|user-02]
207
- )
207
+ })
208
208
  expect do
209
209
  @instance.add_role_users('ROLE_ID', %w[test|user-01 test|user-02])
210
210
  end.not_to raise_error
@@ -225,21 +225,21 @@ describe Auth0::Api::V2::Roles do
225
225
 
226
226
  it 'is expected to get Roles with default parameters' do
227
227
  expect(@instance).to receive(:get).with(
228
- '/api/v2/roles/ROLE_ID/permissions',
228
+ '/api/v2/roles/ROLE_ID/permissions', {
229
229
  per_page: nil,
230
230
  page: nil,
231
231
  include_totals: nil
232
- )
232
+ })
233
233
  expect { @instance.get_role_permissions('ROLE_ID') }.not_to raise_error
234
234
  end
235
235
 
236
236
  it 'is expected to get Roles with custom parameters' do
237
237
  expect(@instance).to receive(:get).with(
238
- '/api/v2/roles/ROLE_ID/permissions',
238
+ '/api/v2/roles/ROLE_ID/permissions', {
239
239
  per_page: 15,
240
240
  page: 5,
241
241
  include_totals: true
242
- )
242
+ })
243
243
  expect do
244
244
  @instance.get_role_permissions('ROLE_ID', per_page: 15, page: 5, include_totals: true)
245
245
  end.not_to raise_error
@@ -281,7 +281,7 @@ describe Auth0::Api::V2::Roles do
281
281
 
282
282
  it 'is expected to add permissions to a Role' do
283
283
  expect(@instance).to receive(:post).with(
284
- '/api/v2/roles/ROLE_ID/permissions',
284
+ '/api/v2/roles/ROLE_ID/permissions', {
285
285
  permissions: [
286
286
  {
287
287
  permission_name: 'permission-name-1',
@@ -292,7 +292,7 @@ describe Auth0::Api::V2::Roles do
292
292
  resource_server_identifier: 'server-id-2'
293
293
  }
294
294
  ]
295
- )
295
+ })
296
296
  expect do
297
297
  @instance.add_role_permissions(
298
298
  'ROLE_ID',
@@ -340,7 +340,7 @@ describe Auth0::Api::V2::Roles do
340
340
 
341
341
  it 'is expected to remove permissions from a Role' do
342
342
  expect(@instance).to receive(:delete_with_body).with(
343
- '/api/v2/roles/ROLE_ID/permissions',
343
+ '/api/v2/roles/ROLE_ID/permissions', {
344
344
  permissions: [
345
345
  {
346
346
  permission_name: 'permission-name-3',
@@ -351,7 +351,7 @@ describe Auth0::Api::V2::Roles do
351
351
  resource_server_identifier: 'server-id-4'
352
352
  }
353
353
  ]
354
- )
354
+ })
355
355
  expect do
356
356
  @instance.remove_role_permissions(
357
357
  'ROLE_ID',
@@ -12,27 +12,27 @@ describe Auth0::Api::V2::Rules do
12
12
 
13
13
  it 'is expected to call get /api/v2/rules' do
14
14
  expect(@instance).to receive(:get).with(
15
- '/api/v2/rules',
15
+ '/api/v2/rules', {
16
16
  enabled: nil,
17
17
  fields: nil,
18
18
  include_fields: nil,
19
19
  stage: nil,
20
20
  page: nil,
21
21
  per_page: nil
22
- )
22
+ })
23
23
  expect { @instance.rules }.not_to raise_error
24
24
  end
25
25
 
26
26
  it 'is expected to call get /api/v2/rules with pagination' do
27
27
  expect(@instance).to receive(:get).with(
28
- '/api/v2/rules',
28
+ '/api/v2/rules', {
29
29
  enabled: nil,
30
30
  fields: nil,
31
31
  include_fields: nil,
32
32
  stage: nil,
33
33
  page: 1,
34
34
  per_page: 2
35
- )
35
+ })
36
36
  expect {
37
37
  @instance.rules(page: 1, per_page: 2)
38
38
  }.not_to raise_error
@@ -43,7 +43,7 @@ describe Auth0::Api::V2::Rules do
43
43
  it { expect(@instance).to respond_to(:rule) }
44
44
  it 'is expected to call get /api/v2/rules/test' do
45
45
  expect(@instance).to receive(:get).with(
46
- '/api/v2/rules/test', fields: nil, include_fields: nil
46
+ '/api/v2/rules/test', { fields: nil, include_fields: nil }
47
47
  )
48
48
  expect { @instance.rule('test') }.not_to raise_error
49
49
  end
@@ -57,7 +57,7 @@ describe Auth0::Api::V2::Rules do
57
57
  it 'is expected to call post /api/v2/rules' do
58
58
  expect(@instance).to receive(:post).with(
59
59
  '/api/v2/rules',
60
- name: 'test', script: 'script', order: 'order', enabled: false, stage: 'login_success'
60
+ { name: 'test', script: 'script', order: 'order', enabled: false, stage: 'login_success' }
61
61
  )
62
62
  expect { @instance.create_rule('test', 'script', 'order', false) }.not_to raise_error
63
63
  end
@@ -72,7 +72,7 @@ describe Auth0::Api::V2::Rules do
72
72
  it { expect(@instance).to respond_to(:update_rule) }
73
73
  it 'is expected to call put /api/v2/rules/test' do
74
74
  expect(@instance).to receive(:patch).with(
75
- '/api/v2/rules/test', script: 'script', order: 'order', enabled: true, stage: 'some_stage'
75
+ '/api/v2/rules/test', { script: 'script', order: 'order', enabled: true, stage: 'some_stage' }
76
76
  )
77
77
  expect do
78
78
  @instance.update_rule('test', script: 'script', order: 'order', enabled: true, stage: 'some_stage')
@@ -15,7 +15,7 @@ describe Auth0::Api::V2::Stats do
15
15
  context '.daily_stats' do
16
16
  it { expect(@instance).to respond_to(:daily_stats) }
17
17
  it 'expect client to send get to /api/v2/stats/daily' do
18
- expect(@instance).to receive(:get).with('/api/v2/stats/daily', from: '20120222', to: '20151222')
18
+ expect(@instance).to receive(:get).with('/api/v2/stats/daily', { from: '20120222', to: '20151222' })
19
19
  expect { @instance.daily_stats('20120222', '20151222') }.not_to raise_error
20
20
  end
21
21
  end
@@ -7,7 +7,7 @@ describe Auth0::Api::V2::Tenants do
7
7
  context '.get_tenant_settings' do
8
8
  it { expect(@instance).to respond_to(:get_tenant_settings) }
9
9
  it 'expect client to send post to /api/v2/tenants/settings with fields' do
10
- expect(@instance).to receive(:get).with('/api/v2/tenants/settings', fields: 'field', include_fields: true)
10
+ expect(@instance).to receive(:get).with('/api/v2/tenants/settings', { fields: 'field', include_fields: true })
11
11
  expect { @instance.get_tenant_settings(fields: 'field') }.not_to raise_error
12
12
  end
13
13
  end
@@ -7,28 +7,28 @@ describe Auth0::Api::V2::Tickets do
7
7
  context '.post_email_verification' do
8
8
  it { expect(@instance).to respond_to(:post_email_verification) }
9
9
  it 'expect client to send post to /api/v2/tickets/email-verification with body' do
10
- expect(@instance).to receive(:post).with('/api/v2/tickets/email-verification', user_id: 'user_id',
11
- result_url: nil, ttl_sec: nil)
10
+ expect(@instance).to receive(:post).with('/api/v2/tickets/email-verification', { user_id: 'user_id',
11
+ result_url: nil, ttl_sec: nil })
12
12
  expect { @instance.post_email_verification('user_id') }.not_to raise_error
13
13
  end
14
14
  it 'expect client to accept integer ttl_sec' do
15
- expect(@instance).to receive(:post).with('/api/v2/tickets/email-verification', user_id: 'user_id',
16
- result_url: nil, ttl_sec: 300)
15
+ expect(@instance).to receive(:post).with('/api/v2/tickets/email-verification', { user_id: 'user_id',
16
+ result_url: nil, ttl_sec: 300 })
17
17
  expect { @instance.post_email_verification('user_id', ttl_sec: 300) }.not_to raise_error
18
18
  end
19
19
  it 'expect client to return nil when calling with a non-integer ttl_sec' do
20
- expect(@instance).to receive(:post).with('/api/v2/tickets/email-verification', user_id: 'user_id',
21
- result_url: nil, ttl_sec: nil)
20
+ expect(@instance).to receive(:post).with('/api/v2/tickets/email-verification', { user_id: 'user_id',
21
+ result_url: nil, ttl_sec: nil })
22
22
  expect { @instance.post_email_verification('user_id', ttl_sec: "noninteger") }.not_to raise_error
23
23
  end
24
24
  it 'expect client to accept hash identity' do
25
- expect(@instance).to receive(:post).with('/api/v2/tickets/email-verification', user_id: 'user_id',
25
+ expect(@instance).to receive(:post).with('/api/v2/tickets/email-verification', { user_id: 'user_id',
26
26
  result_url: nil,
27
27
  ttl_sec: nil,
28
28
  identity: {
29
29
  provider: "auth0",
30
30
  user_id: "user_id"
31
- })
31
+ }})
32
32
  expect {
33
33
  @instance.post_email_verification('user_id', identity: { provider: "auth0", user_id: "user_id"})
34
34
  }.not_to raise_error
@@ -48,7 +48,7 @@ describe Auth0::Api::V2::Tickets do
48
48
  context '.post_password_change' do
49
49
  it { expect(@instance).to respond_to(:post_password_change) }
50
50
  it 'expect client to send post to /api/v2/tickets/password-change with body' do
51
- expect(@instance).to receive(:post).with('/api/v2/tickets/password-change',
51
+ expect(@instance).to receive(:post).with('/api/v2/tickets/password-change', {
52
52
  result_url: nil,
53
53
  user_id: nil,
54
54
  connection_id: nil,
@@ -56,12 +56,12 @@ describe Auth0::Api::V2::Tickets do
56
56
  ttl_sec: nil,
57
57
  mark_email_as_verified: nil,
58
58
  includeEmailInRedirect: nil,
59
- new_password: nil)
59
+ new_password: nil })
60
60
  expect {@instance.post_password_change}.not_to raise_error
61
61
  end
62
62
 
63
63
  it 'expect client to accept organization_id' do
64
- expect(@instance).to receive(:post).with('/api/v2/tickets/password-change',
64
+ expect(@instance).to receive(:post).with('/api/v2/tickets/password-change', {
65
65
  result_url: nil,
66
66
  user_id: nil,
67
67
  connection_id: nil,
@@ -72,7 +72,7 @@ describe Auth0::Api::V2::Tickets do
72
72
  new_password: nil,
73
73
  client_id: '123',
74
74
  organization_id: '999'
75
- )
75
+ })
76
76
  expect {
77
77
  @instance.post_password_change(
78
78
  result_url: nil,
@@ -89,7 +89,7 @@ describe Auth0::Api::V2::Tickets do
89
89
  end
90
90
 
91
91
  it 'expect client to accept client_id' do
92
- expect(@instance).to receive(:post).with('/api/v2/tickets/password-change',
92
+ expect(@instance).to receive(:post).with('/api/v2/tickets/password-change', {
93
93
  result_url: nil,
94
94
  user_id: nil,
95
95
  connection_id: nil,
@@ -99,7 +99,7 @@ describe Auth0::Api::V2::Tickets do
99
99
  includeEmailInRedirect: nil,
100
100
  new_password: nil,
101
101
  client_id: '123'
102
- )
102
+ })
103
103
  expect {
104
104
  @instance.post_password_change(
105
105
  result_url: nil,
@@ -9,7 +9,7 @@ describe Auth0::Api::V2::UserBlocks do
9
9
  context '.user_blocks' do
10
10
  it { expect(@instance).to respond_to(:user_blocks) }
11
11
  it 'is expected to call /api/v2/user-blocks?identifier=Test' do
12
- expect(@instance).to receive(:get).with('/api/v2/user-blocks', identifier: 'Test')
12
+ expect(@instance).to receive(:get).with('/api/v2/user-blocks', { identifier: 'Test' })
13
13
  expect { @instance.user_blocks('Test') }.not_to raise_error
14
14
  end
15
15
  it 'expect client to raise an error when calling with empty identifier' do
@@ -20,7 +20,7 @@ describe Auth0::Api::V2::UserBlocks do
20
20
  context '.delete_user_blocks' do
21
21
  it { expect(@instance).to respond_to(:delete_user_blocks) }
22
22
  it 'is expected to call /api/v2/user-blocks?identifier=Test' do
23
- expect(@instance).to receive(:delete).with('/api/v2/user-blocks', identifier: 'Test')
23
+ expect(@instance).to receive(:delete).with('/api/v2/user-blocks', { identifier: 'Test' })
24
24
  expect { @instance.delete_user_blocks('Test') }.not_to raise_error
25
25
  end
26
26
  it 'expect client to raise an error when calling with empty identifier' do
@@ -10,11 +10,11 @@ describe Auth0::Api::V2::UsersByEmail do
10
10
  it { expect(@instance).to respond_to(:users_by_email) }
11
11
  it 'is expected to call /api/v2/users-by-email' do
12
12
  expect(@instance).to receive(:get).with(
13
- '/api/v2/users-by-email',
13
+ '/api/v2/users-by-email', {
14
14
  fields: nil,
15
15
  include_fields: nil,
16
16
  email: 'email'
17
- )
17
+ })
18
18
  expect { @instance.users_by_email('email') }.not_to raise_error
19
19
  end
20
20
  end
@@ -17,7 +17,7 @@ describe Auth0::Api::V2::Users do
17
17
 
18
18
  it 'is expected to get /api/v2/users' do
19
19
  expect(@instance).to receive(:get).with(
20
- '/api/v2/users',
20
+ '/api/v2/users', {
21
21
  per_page: nil,
22
22
  page: nil,
23
23
  include_totals: nil,
@@ -27,13 +27,13 @@ describe Auth0::Api::V2::Users do
27
27
  include_fields: nil,
28
28
  q: nil,
29
29
  search_engine: nil
30
- )
30
+ })
31
31
  expect { @instance.users }.not_to raise_error
32
32
  end
33
33
 
34
34
  it 'is expected to get /api/v2/users with custom parameters' do
35
35
  expect(@instance).to receive(:get).with(
36
- '/api/v2/users',
36
+ '/api/v2/users', {
37
37
  per_page: 10,
38
38
  page: 1,
39
39
  include_totals: true,
@@ -43,7 +43,7 @@ describe Auth0::Api::V2::Users do
43
43
  include_fields: nil,
44
44
  q: nil,
45
45
  search_engine: 'v3'
46
- )
46
+ })
47
47
  expect do
48
48
  @instance.users(
49
49
  search_engine: 'v3',
@@ -64,10 +64,10 @@ describe Auth0::Api::V2::Users do
64
64
 
65
65
  it 'is expected to call get request to /api/v2/users/USER_ID' do
66
66
  expect(@instance).to receive(:get).with(
67
- '/api/v2/users/USER_ID',
67
+ '/api/v2/users/USER_ID', {
68
68
  fields: nil,
69
69
  include_fields: true
70
- )
70
+ })
71
71
  expect { @instance.user('USER_ID') }.not_to raise_error
72
72
  end
73
73
 
@@ -83,11 +83,11 @@ describe Auth0::Api::V2::Users do
83
83
 
84
84
  it 'is expected to post to /api/v2/users' do
85
85
  expect(@instance).to receive(:post).with(
86
- '/api/v2/users',
86
+ '/api/v2/users', {
87
87
  email: 'test@test.com',
88
88
  password: 'password',
89
89
  connection: 'conn'
90
- )
90
+ })
91
91
  expect do
92
92
  @instance.create_user(
93
93
  'conn',
@@ -169,12 +169,12 @@ describe Auth0::Api::V2::Users do
169
169
 
170
170
  it 'is expected to patch /api/v2/users/USER_ID' do
171
171
  expect(@instance).to receive(:patch).with(
172
- '/api/v2/users/USER_ID',
172
+ '/api/v2/users/USER_ID', {
173
173
  email: 'test@test.com',
174
174
  password: 'password',
175
175
  connection: 'conn',
176
176
  name: 'name'
177
- )
177
+ })
178
178
  @instance.patch_user(
179
179
  'USER_ID',
180
180
  email: 'test@test.com',
@@ -199,7 +199,7 @@ describe Auth0::Api::V2::Users do
199
199
  end
200
200
 
201
201
  it 'is expected to post to /api/v2/users/UserId/identities' do
202
- expect(@instance).to receive(:post).with('/api/v2/users/USER_ID/identities', body: 'json body')
202
+ expect(@instance).to receive(:post).with('/api/v2/users/USER_ID/identities', { body: 'json body' })
203
203
  @instance.link_user_account('USER_ID', body: 'json body')
204
204
  end
205
205
 
@@ -255,12 +255,12 @@ describe Auth0::Api::V2::Users do
255
255
 
256
256
  it 'is expected to get /api/v2/USER_ID/logs' do
257
257
  expect(@instance).to receive(:get).with(
258
- '/api/v2/users/USER_ID/logs',
258
+ '/api/v2/users/USER_ID/logs', {
259
259
  per_page: nil,
260
260
  page: nil,
261
261
  include_totals: nil,
262
262
  sort: nil
263
- )
263
+ })
264
264
  expect { @instance.user_logs('USER_ID') }.not_to raise_error
265
265
  end
266
266
 
@@ -292,21 +292,21 @@ describe Auth0::Api::V2::Users do
292
292
 
293
293
  it 'is expected to get roles with default parameters' do
294
294
  expect(@instance).to receive(:get).with(
295
- '/api/v2/users/USER_ID/roles',
295
+ '/api/v2/users/USER_ID/roles', {
296
296
  per_page: nil,
297
297
  page: nil,
298
298
  include_totals: nil
299
- )
299
+ })
300
300
  expect { @instance.get_user_roles('USER_ID') }.not_to raise_error
301
301
  end
302
302
 
303
303
  it 'is expected to get roles with custom parameters' do
304
304
  expect(@instance).to receive(:get).with(
305
- '/api/v2/users/USER_ID/roles',
305
+ '/api/v2/users/USER_ID/roles', {
306
306
  per_page: 20,
307
307
  page: 2,
308
308
  include_totals: true
309
- )
309
+ })
310
310
  expect do
311
311
  @instance.get_user_roles('USER_ID', per_page: 20, page: 2, include_totals: true)
312
312
  end.not_to raise_error
@@ -401,11 +401,11 @@ describe Auth0::Api::V2::Users do
401
401
 
402
402
  it 'is expected to get permissions' do
403
403
  expect(@instance).to receive(:get).with(
404
- '/api/v2/users/USER_ID/permissions',
404
+ '/api/v2/users/USER_ID/permissions', {
405
405
  per_page: nil,
406
406
  page: nil,
407
407
  include_totals: nil,
408
- )
408
+ })
409
409
  expect do
410
410
  @instance.get_user_permissions('USER_ID')
411
411
  end.not_to raise_error
@@ -413,11 +413,11 @@ describe Auth0::Api::V2::Users do
413
413
 
414
414
  it 'is expected to get permissions with custom parameters' do
415
415
  expect(@instance).to receive(:get).with(
416
- '/api/v2/users/USER_ID/permissions',
416
+ '/api/v2/users/USER_ID/permissions', {
417
417
  per_page: 10,
418
418
  page: 3,
419
419
  include_totals: true
420
- )
420
+ })
421
421
  expect do
422
422
  @instance.get_user_permissions('USER_ID', per_page: 10, page: 3, include_totals: true)
423
423
  end.not_to raise_error
@@ -445,7 +445,7 @@ describe Auth0::Api::V2::Users do
445
445
 
446
446
  it 'is expected to remove permissions' do
447
447
  expect(@instance).to receive(:delete_with_body).with(
448
- '/api/v2/users/USER_ID/permissions',
448
+ '/api/v2/users/USER_ID/permissions', {
449
449
  permissions: [
450
450
  {
451
451
  permission_name: 'permission-name-1',
@@ -456,7 +456,7 @@ describe Auth0::Api::V2::Users do
456
456
  resource_server_identifier: 'server-id-2'
457
457
  }
458
458
  ]
459
- )
459
+ })
460
460
  expect do
461
461
  @instance.remove_user_permissions(
462
462
  'USER_ID',
@@ -134,7 +134,7 @@ describe Auth0::Client do
134
134
  it_should_behave_like 'Authentication API client'
135
135
  end
136
136
 
137
- context 'when try to get an API tokenwith organization' do
137
+ context 'when try to get an API token with organization' do
138
138
  before do
139
139
  stub_api_token_with_organization
140
140
  end
@@ -147,6 +147,7 @@ describe Auth0::Client do
147
147
  organization: organization
148
148
  )
149
149
  end
150
+
150
151
  it_should_behave_like 'v2 API client'
151
152
  it_should_behave_like 'Authentication API client'
152
153
  end
@@ -209,8 +210,7 @@ describe Auth0::Client do
209
210
  {
210
211
  grant_type: 'client_credentials',
211
212
  client_id: client_id,
212
- client_secret: client_secret,
213
- organization: organization
213
+ client_secret: client_secret
214
214
  }
215
215
  )
216
216
  )