auth0 4.15.0 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +26 -3
  3. data/.github/CODEOWNERS +1 -1
  4. data/.github/ISSUE_TEMPLATE/config.yml +8 -0
  5. data/.github/ISSUE_TEMPLATE/feature_request.md +39 -0
  6. data/.github/ISSUE_TEMPLATE/report_a_bug.md +55 -0
  7. data/.gitignore +1 -1
  8. data/.yardoc/checksums +22 -0
  9. data/.yardoc/complete +0 -0
  10. data/.yardoc/object_types +0 -0
  11. data/.yardoc/objects/root.dat +0 -0
  12. data/.yardoc/proxy_types +0 -0
  13. data/CHANGELOG.md +83 -0
  14. data/Gemfile +0 -1
  15. data/README.md +5 -7
  16. data/Rakefile +0 -22
  17. data/auth0.gemspec +4 -3
  18. data/examples/ruby-api/.gitignore +0 -6
  19. data/lib/auth0/api/authentication_endpoints.rb +6 -220
  20. data/lib/auth0/api/v2/jobs.rb +11 -1
  21. data/lib/auth0/api/v2/tickets.rb +12 -1
  22. data/lib/auth0/api/v2/users.rb +21 -8
  23. data/lib/auth0/exception.rb +2 -7
  24. data/lib/auth0/mixins.rb +0 -1
  25. data/lib/auth0/mixins/access_token_struct.rb +2 -2
  26. data/lib/auth0/mixins/api_token_struct.rb +2 -2
  27. data/lib/auth0/mixins/httpproxy.rb +3 -1
  28. data/lib/auth0/mixins/initializer.rb +1 -7
  29. data/lib/auth0/mixins/permission_struct.rb +2 -2
  30. data/lib/auth0/mixins/validation.rb +1 -1
  31. data/lib/auth0/version.rb +1 -1
  32. data/spec/integration/lib/auth0/api/api_authentication_spec.rb +1 -1
  33. data/spec/integration/lib/auth0/api/v2/api_jobs_spec.rb +13 -1
  34. data/spec/integration/lib/auth0/api/v2/api_roles_spec.rb +1 -1
  35. data/spec/integration/lib/auth0/api/v2/api_tickets_spec.rb +7 -1
  36. data/spec/integration/lib/auth0/api/v2/api_user_blocks_spec.rb +1 -1
  37. data/spec/integration/lib/auth0/api/v2/api_users_spec.rb +1 -1
  38. data/spec/lib/auth0/api/v2/jobs_spec.rb +17 -0
  39. data/spec/lib/auth0/api/v2/roles_spec.rb +4 -4
  40. data/spec/lib/auth0/api/v2/tickets_spec.rb +17 -0
  41. data/spec/lib/auth0/api/v2/users_spec.rb +38 -11
  42. data/spec/lib/auth0/mixins/httpproxy_spec.rb +2 -2
  43. data/spec/spec_helper.rb +6 -1
  44. data/spec/support/credentials.rb +0 -19
  45. metadata +43 -44
  46. data/.github/ISSUE_TEMPLATE.md +0 -39
  47. data/Gemfile.lock +0 -229
  48. data/deploy_documentation.sh +0 -29
  49. data/doc_config/templates/default/fulldoc/html/css/full_list.css +0 -79
  50. data/doc_config/templates/default/fulldoc/html/css/style.css +0 -546
  51. data/doc_config/templates/default/layout/html/breadcrumb.erb +0 -11
  52. data/doc_config/templates/default/layout/html/footer.erb +0 -115
  53. data/doc_config/templates/default/layout/html/headers.erb +0 -17
  54. data/doc_config/templates/default/layout/html/layout.erb +0 -27
  55. data/lib/auth0/api/v1.rb +0 -19
  56. data/lib/auth0/api/v1/clients.rb +0 -58
  57. data/lib/auth0/api/v1/connections.rb +0 -68
  58. data/lib/auth0/api/v1/logs.rb +0 -43
  59. data/lib/auth0/api/v1/rules.rb +0 -57
  60. data/lib/auth0/api/v1/users.rb +0 -227
  61. data/spec/lib/auth0/api/authentication_endpoints_spec.rb +0 -703
@@ -78,14 +78,24 @@ module Auth0
78
78
  # @see https://auth0.com/docs/api/management/v2#!/Jobs/post_verification_email
79
79
  # @param user_id [string] The user_id of the user to whom the email will be sent.
80
80
  # @param client_id [string] Client ID to send an Application-specific email.
81
+ # @param identity [hash] Used to verify secondary, federated, and passwordless-email identities.
82
+ # * :user_id [string] user_id of the identity.
83
+ # * :provider [string] provider of the identity.
81
84
  #
82
85
  # @return [json] Returns the job status and properties.
83
- def send_verification_email(user_id, client_id = nil)
86
+ def send_verification_email(user_id, client_id = nil, identity: nil)
84
87
  raise Auth0::InvalidParameter, 'Must specify a user id' if user_id.to_s.empty?
85
88
 
86
89
  request_params = { user_id: user_id }
87
90
  request_params[:client_id] = client_id unless client_id.nil?
88
91
 
92
+ if identity
93
+ unless identity.is_a? Hash
94
+ raise Auth0::InvalidParameter, 'Identity must be a hash send an email verification'
95
+ end
96
+ request_params[:identity] = identity
97
+ end
98
+
89
99
  path = "#{jobs_path}/verification-email"
90
100
  post(path, request_params)
91
101
  end
@@ -12,9 +12,12 @@ module Auth0
12
12
  # @param ttl_sec [integer] The ticket's lifetime in seconds starting from the moment of creation.
13
13
  # After expiration, the ticket cannot be used to verify the user's email. If not specified or if
14
14
  # you send 0, the Auth0 default lifetime of five days will be applied
15
+ # @param identity [hash] Used to verify secondary, federated, and passwordless-email identities.
16
+ # * :user_id [string] user_id of the identity.
17
+ # * :provider [string] provider of the identity.
15
18
  #
16
19
  # @return [json] Returns the created ticket url.
17
- def post_email_verification(user_id, result_url: nil, ttl_sec: nil)
20
+ def post_email_verification(user_id, result_url: nil, ttl_sec: nil, identity: nil)
18
21
  if user_id.to_s.empty?
19
22
  raise Auth0::InvalidParameter, 'Must supply a valid user id to post an email verification'
20
23
  end
@@ -24,6 +27,14 @@ module Auth0
24
27
  result_url: result_url,
25
28
  ttl_sec: ttl_sec.is_a?(Integer) ? ttl_sec : nil
26
29
  }
30
+
31
+ if identity
32
+ unless identity.is_a? Hash
33
+ raise Auth0::InvalidParameter, 'Identity must be a hash to post an email verification'
34
+ end
35
+ request_params[:identity] = identity
36
+ end
37
+
27
38
  post(path, request_params)
28
39
  end
29
40
 
@@ -43,13 +43,15 @@ module Auth0
43
43
  # The attribute connection is always mandatory but depending on the type of connection you are using there
44
44
  # could be others too. For instance, Auth0 DB Connections require email and password.
45
45
  # @see https://auth0.com/docs/api/v2#!/Users/post_users
46
- # @param name [string] The user name.
47
- # @param options [hash]
48
- # * :connection [string] The connection the user belongs to.
46
+ # @param connection [string] The connection the user belongs to.
47
+ # @param options [hash] See https://auth0.com/docs/api/management/v2#!/Users/post_users for available options
49
48
  # @return [json] Returns the created user.
50
- def create_user(name, options = {})
49
+ def create_user(connection, options = {})
50
+ if !connection.is_a?(String) || connection.empty?
51
+ raise Auth0::MissingParameter, 'Must supply a valid connection'
52
+ end
51
53
  request_params = Hash[options.map { |(k, v)| [k.to_sym, v] }]
52
- request_params[:name] = name
54
+ request_params[:connection] = connection
53
55
  post(users_path, request_params)
54
56
  end
55
57
 
@@ -248,11 +250,22 @@ module Auth0
248
250
  # @see https://auth0.com/docs/api/management/v2#!/Users/get_permissions
249
251
  #
250
252
  # @param user_id [string] The user_id of the permissions to get.
253
+ # @param options [hash] A hash of options for getting permissions
254
+ # * :per_page [integer] The amount of permissions per page. (optional)
255
+ # * :page [integer] The page number. Zero based. (optional)
256
+ # * :include_totals [boolean] True if a query summary must be included in the result. (optional)
251
257
  #
252
258
  # @return [json] Returns permissions for the given user_id.
253
- def get_user_permissions(user_id)
259
+ def get_user_permissions(user_id, options = {})
254
260
  raise Auth0::MissingUserId, 'Must supply a valid user_id' if user_id.to_s.empty?
255
- get "#{users_path}/#{user_id}/permissions"
261
+
262
+ request_params = {
263
+ per_page: options.fetch(:per_page, nil),
264
+ page: options.fetch(:page, nil),
265
+ include_totals: options.fetch(:include_totals, nil)
266
+ }
267
+
268
+ get "#{users_path}/#{user_id}/permissions", request_params
256
269
  end
257
270
 
258
271
  # Remove one or more permissions from a specific user.
@@ -283,7 +296,7 @@ module Auth0
283
296
  # @param user_id [string] The user_id of the recovery codes to regenerate.
284
297
  def generate_recovery_code(user_id)
285
298
  raise Auth0::MissingUserId, 'Must supply a valid user_id' if user_id.to_s.empty?
286
- post "#{users_path}/#{user_id}/recovery-code-generation"
299
+ post "#{users_path}/#{user_id}/recovery-code-regeneration"
287
300
  end
288
301
 
289
302
  # Invalidate all remembered browsers for all authentication factors for a specific user.
@@ -44,17 +44,12 @@ module Auth0
44
44
  class AccessDenied < Auth0::HTTPError; end
45
45
  # Invalid parameter passed, e.g. empty where ID is required
46
46
  class InvalidParameter < Auth0::Exception; end
47
- # Invalid Auth0 credentials either client_id/secret for API v1
48
- # or JWT for API v2/
47
+ # Invalid JWT
49
48
  class InvalidCredentials < Auth0::Exception; end
50
49
  # Invalid Auth0 API namespace
51
50
  class InvalidApiNamespace < Auth0::Exception; end
52
51
  # Auth0 API rate-limiting encountered
53
- # TODO: When making API-breaking changes, make this a subclass
54
- # of Auth0::HTTPError directly rather than Auth0::Unsupported.
55
- # It's currently under Unsupported to avoid breaking compatibility
56
- # with prior gem versions that treated 429 errors as unknown errors.
57
- class RateLimitEncountered < Auth0::Unsupported
52
+ class RateLimitEncountered < Auth0::HTTPError
58
53
  def reset
59
54
  Time.at(headers['X-RateLimit-Reset']).utc
60
55
  end
data/lib/auth0/mixins.rb CHANGED
@@ -11,7 +11,6 @@ require 'auth0/mixins/permission_struct'
11
11
  require 'auth0/mixins/validation'
12
12
 
13
13
  require 'auth0/api/authentication_endpoints'
14
- require 'auth0/api/v1'
15
14
  require 'auth0/api/v2'
16
15
 
17
16
  module Auth0
@@ -1,4 +1,4 @@
1
- AccessToken = Struct.new(
1
+ Auth0::AccessToken = Struct.new(
2
2
  :access_token,
3
3
  :expires_in,
4
4
  :refresh_token,
@@ -17,4 +17,4 @@ AccessToken = Struct.new(
17
17
  def token
18
18
  access_token
19
19
  end
20
- end
20
+ end
@@ -1,4 +1,4 @@
1
- ApiToken = Struct.new :access_token, :scope, :expires_in do
1
+ Auth0::ApiToken = Struct.new :access_token, :scope, :expires_in do
2
2
 
3
3
  def token
4
4
  access_token
@@ -7,4 +7,4 @@ ApiToken = Struct.new :access_token, :scope, :expires_in do
7
7
  def scopes
8
8
  scope.split
9
9
  end
10
- end
10
+ end
@@ -1,3 +1,5 @@
1
+ require "addressable/uri"
2
+
1
3
  module Auth0
2
4
  module Mixins
3
5
  # here's the proxy for Rest calls based on rest-client, we're building all request on that gem
@@ -8,7 +10,7 @@ module Auth0
8
10
  # proxying requests from instance methods to HTTP class methods
9
11
  %i(get post post_file put patch delete delete_with_body).each do |method|
10
12
  define_method(method) do |path, body = {}, extra_headers = {}|
11
- safe_path = URI.escape(path)
13
+ safe_path = Addressable::URI.escape(path)
12
14
  body = body.delete_if { |_, v| v.nil? }
13
15
  result = if method == :get
14
16
  # Mutate the headers property to add parameters.
@@ -40,7 +40,7 @@ module Auth0
40
40
  private
41
41
 
42
42
  def initialize_api(options)
43
- api_v2?(options) ? initialize_v2(options) : initialize_v1
43
+ initialize_v2(options)
44
44
  raise InvalidCredentials, 'Must supply a valid API token' if @token.nil?
45
45
  if options.fetch(:authorization, nil) == 'Basic'
46
46
  authorization_header_basic(options)
@@ -61,12 +61,6 @@ module Auth0
61
61
  @token = api_token.token if @token.nil? && @client_id && @client_secret
62
62
  end
63
63
 
64
- def initialize_v1
65
- extend Auth0::Api::V1
66
- raise InvalidCredentials, 'Invalid API v1 client_id and client_secret' if @client_id.nil? || @client_secret.nil?
67
- @token = obtain_access_token
68
- end
69
-
70
64
  def api_v2?(options)
71
65
  version = options[:api_version] || 2
72
66
  protocol = options[:protocols].to_s
@@ -1,3 +1,3 @@
1
- Permission = Struct.new :permission_name, :resource_server_identifier do
1
+ Auth0::Permission = Struct.new :permission_name, :resource_server_identifier do
2
2
 
3
- end
3
+ end
@@ -23,7 +23,7 @@ module Auth0
23
23
  raise Auth0::InvalidParameter, 'Must supply an array of Permissions' unless permissions.kind_of?(Array)
24
24
  raise Auth0::MissingParameter, 'Must supply an array of Permissions' if permissions.empty?
25
25
  raise Auth0::InvalidParameter, 'All array elements must be Permissions' unless permissions.all? do |permission|
26
- permission.kind_of? Permission
26
+ permission.kind_of? ::Auth0::Permission
27
27
  end
28
28
  permissions.map { |permission| permission.to_h }
29
29
  end
data/lib/auth0/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # current version of gem
2
2
  module Auth0
3
- VERSION = '4.15.0'.freeze
3
+ VERSION = '5.0.1'.freeze
4
4
  end
@@ -60,7 +60,7 @@ describe Auth0::Api::AuthenticationEndpoints do
60
60
  end
61
61
 
62
62
  it 'should return the userinfo' do
63
- tokens = @client.login(test_user_email, test_user_pwd, nil, nil)
63
+ tokens = @client.login_with_resource_owner(test_user_email, test_user_pwd)
64
64
  expect(@client.userinfo(tokens['access_token'])).to(
65
65
  include( 'email' => test_user_email )
66
66
  )
@@ -4,7 +4,7 @@ describe Auth0::Api::V2::Jobs do
4
4
 
5
5
  let(:client) { Auth0Client.new(v2_creds) }
6
6
  let(:username) { Faker::Internet.user_name }
7
- let(:email) { "#{entity_suffix}#{Faker::Internet.safe_email(username)}" }
7
+ let(:email) { "#{entity_suffix}#{Faker::Internet.safe_email(name: username)}" }
8
8
  let(:connection_id) do
9
9
  VCR.use_cassette('Auth0_Api_V2_Jobs/search_for_connection_id') do
10
10
  client.connections.find do |connection|
@@ -100,6 +100,18 @@ describe Auth0::Api::V2::Jobs do
100
100
  client.send_verification_email(user['user_id'], Random.new(32).to_s)
101
101
  end.to raise_error Auth0::BadRequest
102
102
  end
103
+
104
+ it 'should raise an error if the user id is empty' do
105
+ expect do
106
+ client.send_verification_email( '' )
107
+ end.to raise_error Auth0::InvalidParameter, 'Must specify a user id'
108
+ end
109
+
110
+ it 'should raise an error if the identity supplied is not a Hash' do
111
+ expect do
112
+ client.send_verification_email( 'user_id', identity: 'not a hash')
113
+ end.to raise_error Auth0::InvalidParameter, 'Identity must be a hash send an email verification'
114
+ end
103
115
  end
104
116
 
105
117
  after(:all) do
@@ -14,7 +14,7 @@ describe Auth0::Api::V2::Roles do
14
14
  @test_role_name = "#{entity_suffix}-test-role"
15
15
 
16
16
  @test_permission_name = "#{entity_suffix}-test-permission"
17
- @test_permission = Permission.new(@test_permission_name, @test_api_name)
17
+ @test_permission = ::Auth0::Permission.new(@test_permission_name , @test_api_name)
18
18
 
19
19
  VCR.use_cassette('Auth0_Api_V2_Roles/create_test_user') do
20
20
  @test_user ||= client.create_user(
@@ -35,7 +35,13 @@ describe Auth0::Api::V2::Tickets do
35
35
  it 'should raise an error if the user id is empty' do
36
36
  expect do
37
37
  client.post_email_verification( '' )
38
- end.to raise_error Auth0::InvalidParameter
38
+ end.to raise_error Auth0::InvalidParameter, 'Must supply a valid user id to post an email verification'
39
+ end
40
+
41
+ it 'should raise an error if the identity supplied is not a Hash' do
42
+ expect do
43
+ client.post_email_verification( '', identity: 'not a hash')
44
+ end.to raise_error Auth0::InvalidParameter, 'Must supply a valid user id to post an email verification'
39
45
  end
40
46
  end
41
47
 
@@ -6,7 +6,7 @@ describe Auth0::Api::V2::UserBlocks do
6
6
  before(:all) do
7
7
  @client = Auth0Client.new(v2_creds)
8
8
  username = Faker::Internet.user_name
9
- @email = "#{entity_suffix}#{Faker::Internet.safe_email(username)}"
9
+ @email = "#{entity_suffix}#{Faker::Internet.safe_email(name: username)}"
10
10
  password = Faker::Internet.password
11
11
  @user = client.create_user(username, 'email' => email,
12
12
  'password' => password,
@@ -14,7 +14,7 @@ describe Auth0::Api::V2::Users do
14
14
  @test_api_scope = 'test:scope'
15
15
 
16
16
  @test_permission_name = "#{entity_suffix}-test-permission-for-users"
17
- @test_permission = Permission.new("#{entity_suffix}-test-permission-for-users", @test_api_name)
17
+ @test_permission = ::Auth0::Permission.new("#{entity_suffix}-test-permission-for-users", @test_api_name)
18
18
 
19
19
  VCR.use_cassette('Auth0_Api_V2_Users/create_test_user') do
20
20
  @test_user ||= client.create_user(
@@ -102,6 +102,23 @@ describe Auth0::Api::V2::Jobs do
102
102
  end.not_to raise_error
103
103
  end
104
104
 
105
+ it 'expect client to accept hash identity' do
106
+ expect(@instance).to receive(:post).with('/api/v2/jobs/verification-email', user_id: 'user_id',
107
+ identity: {
108
+ provider: "auth0",
109
+ user_id: "user_id"
110
+ })
111
+ expect {
112
+ @instance.send_verification_email('user_id', identity: { provider: "auth0", user_id: "user_id"})
113
+ }.not_to raise_error
114
+ end
115
+
116
+ it 'expect client to return nil when calling with a non-hash identity' do
117
+ expect { @instance.send_verification_email('user_id', identity: "nonhash") }.to raise_error(
118
+ 'Identity must be a hash send an email verification'
119
+ )
120
+ end
121
+
105
122
  it 'should raise an error if the user_id is empty' do
106
123
  expect do
107
124
  @instance.send_verification_email('')
@@ -293,8 +293,8 @@ describe Auth0::Api::V2::Roles do
293
293
  @instance.add_role_permissions(
294
294
  'ROLE_ID',
295
295
  [
296
- Permission.new('permission-name-1', 'server-id-1'),
297
- Permission.new('permission-name-2', 'server-id-2')
296
+ Auth0::Permission.new('permission-name-1', 'server-id-1'),
297
+ Auth0::Permission.new('permission-name-2', 'server-id-2')
298
298
  ]
299
299
  )
300
300
  end.not_to raise_error
@@ -352,8 +352,8 @@ describe Auth0::Api::V2::Roles do
352
352
  @instance.remove_role_permissions(
353
353
  'ROLE_ID',
354
354
  [
355
- Permission.new('permission-name-3', 'server-id-3'),
356
- Permission.new('permission-name-4', 'server-id-4')
355
+ Auth0::Permission.new('permission-name-3', 'server-id-3'),
356
+ Auth0::Permission.new('permission-name-4', 'server-id-4')
357
357
  ]
358
358
  )
359
359
  end.not_to raise_error
@@ -21,6 +21,23 @@ describe Auth0::Api::V2::Tickets do
21
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
+ it 'expect client to accept hash identity' do
25
+ expect(@instance).to receive(:post).with('/api/v2/tickets/email-verification', user_id: 'user_id',
26
+ result_url: nil,
27
+ ttl_sec: nil,
28
+ identity: {
29
+ provider: "auth0",
30
+ user_id: "user_id"
31
+ })
32
+ expect {
33
+ @instance.post_email_verification('user_id', identity: { provider: "auth0", user_id: "user_id"})
34
+ }.not_to raise_error
35
+ end
36
+ it 'expect client to return nil when calling with a non-hash identity' do
37
+ expect { @instance.post_email_verification('user_id', identity: "nonhash") }.to raise_error(
38
+ 'Identity must be a hash to post an email verification'
39
+ )
40
+ end
24
41
  it 'expect client to rasie error when calling with empty body' do
25
42
  expect { @instance.post_email_verification(nil) }.to raise_error(
26
43
  'Must supply a valid user id to post an email verification'
@@ -86,18 +86,28 @@ describe Auth0::Api::V2::Users do
86
86
  '/api/v2/users',
87
87
  email: 'test@test.com',
88
88
  password: 'password',
89
- connection: 'conn',
90
- name: 'name'
89
+ connection: 'conn'
91
90
  )
92
91
  expect do
93
92
  @instance.create_user(
94
- 'name',
93
+ 'conn',
95
94
  email: 'test@test.com',
96
- password: 'password',
97
- connection: 'conn'
95
+ password: 'password'
98
96
  )
99
97
  end.not_to raise_error
100
98
  end
99
+
100
+ it 'is expected to raise error if connection is not specified' do
101
+ expect(@instance).not_to receive(:delete)
102
+ expect {
103
+ @instance.create_user(
104
+ email: 'test@test.com',
105
+ password: 'password'
106
+ )
107
+ }.to raise_exception(
108
+ Auth0::MissingParameter
109
+ )
110
+ end
101
111
  end
102
112
 
103
113
  context '.delete_users' do
@@ -390,11 +400,28 @@ describe Auth0::Api::V2::Users do
390
400
  end
391
401
 
392
402
  it 'is expected to get permissions' do
393
- expect(@instance).to receive(:get).with('/api/v2/users/USER_ID/permissions')
403
+ expect(@instance).to receive(:get).with(
404
+ '/api/v2/users/USER_ID/permissions',
405
+ per_page: nil,
406
+ page: nil,
407
+ include_totals: nil,
408
+ )
394
409
  expect do
395
410
  @instance.get_user_permissions('USER_ID')
396
411
  end.not_to raise_error
397
412
  end
413
+
414
+ it 'is expected to get permissions with custom parameters' do
415
+ expect(@instance).to receive(:get).with(
416
+ '/api/v2/users/USER_ID/permissions',
417
+ per_page: 10,
418
+ page: 3,
419
+ include_totals: true
420
+ )
421
+ expect do
422
+ @instance.get_user_permissions('USER_ID', per_page: 10, page: 3, include_totals: true)
423
+ end.not_to raise_error
424
+ end
398
425
  end
399
426
 
400
427
  context '.remove_permissions' do
@@ -434,8 +461,8 @@ describe Auth0::Api::V2::Users do
434
461
  @instance.remove_user_permissions(
435
462
  'USER_ID',
436
463
  [
437
- Permission.new('permission-name-1', 'server-id-1'),
438
- Permission.new('permission-name-2', 'server-id-2')
464
+ Auth0::Permission.new('permission-name-1', 'server-id-1'),
465
+ Auth0::Permission.new('permission-name-2', 'server-id-2')
439
466
  ]
440
467
  )
441
468
  end.not_to raise_error
@@ -479,8 +506,8 @@ describe Auth0::Api::V2::Users do
479
506
  @instance.add_user_permissions(
480
507
  'USER_ID',
481
508
  [
482
- Permission.new('permission-name-1', 'server-id-1'),
483
- Permission.new('permission-name-2', 'server-id-2')
509
+ Auth0::Permission.new('permission-name-1', 'server-id-1'),
510
+ Auth0::Permission.new('permission-name-2', 'server-id-2')
484
511
  ]
485
512
  )
486
513
  end.not_to raise_error
@@ -497,7 +524,7 @@ describe Auth0::Api::V2::Users do
497
524
  end
498
525
 
499
526
  it 'is expected to get generate a recovery code' do
500
- expect(@instance).to receive(:post).with('/api/v2/users/USER_ID/recovery-code-generation')
527
+ expect(@instance).to receive(:post).with('/api/v2/users/USER_ID/recovery-code-regeneration')
501
528
  expect do
502
529
  @instance.generate_recovery_code('USER_ID')
503
530
  end.not_to raise_error