sync_attr_with_auth0 0.1.1 → 0.1.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2d37be3f651d1411d71b74d6d038454d98ae28af
4
- data.tar.gz: 698aef51a19ad87f8292a2b8b789344b7819f282
3
+ metadata.gz: 4238ec4aec0424dcf9d6f2c90d2323658ded3f02
4
+ data.tar.gz: 3ceb41dc971ae1a1507f337f25a5b53e38b2c962
5
5
  SHA512:
6
- metadata.gz: a5d251b0129aa932ed5a3dfb457d545c9e4e6a0ce7762878830054018f601a97a09e3e99b83544c05439b95be634fcfa40d7319246fb4c01540b5cc3b0617173
7
- data.tar.gz: f16dcba015eb2fbd50469a6cb4623581edba472d0d0a8739348a111081011ccd2bd3c6d806f7f7bf4adb4b45c01b22d9733b73e172741330e5e040efa270909f
6
+ metadata.gz: e46c31f066dd85b03fce4120127eed2084ed2776a859d7419a67e415ed0dcba02f64bafa1bccdfe35366ca4f58c5cf2098604cba99bfe54642d7de380b6135d2
7
+ data.tar.gz: 05f9da7d78a48f7ece1ef5a863a5d98ce504b00cd1a0fa8a6a97374e9c27312d9861bf1e5fd021611117aad9f29c60a989f1199abf639bc37ff3ca9ff9a167b4
@@ -84,7 +84,7 @@ module SyncAttrWithAuth0
84
84
  def create_in_auth0
85
85
  params = auth0_create_params
86
86
 
87
- response = SyncAttrWithAuth0::Auth0.create_user(auth0_user_name, params, auth0_sync_configuration)
87
+ response = SyncAttrWithAuth0::Auth0.create_user(auth0_user_name, params, config: auth0_sync_configuration)
88
88
 
89
89
  # Update the record with the uid after_commit
90
90
  @auth0_uid = response['user_id']
@@ -97,7 +97,7 @@ module SyncAttrWithAuth0
97
97
  params = auth0_update_params
98
98
 
99
99
  begin
100
- SyncAttrWithAuth0::Auth0.patch_user(user_uid, params, auth0_sync_configuration)
100
+ SyncAttrWithAuth0::Auth0.patch_user(user_uid, params, config: auth0_sync_configuration)
101
101
 
102
102
  # Update the record with the uid after_commit (in case it doesn't match what's on file).
103
103
  @auth0_uid = user_uid
@@ -113,7 +113,7 @@ module SyncAttrWithAuth0
113
113
  else
114
114
  # The uid was incorrect, so re-attempt with the new uid
115
115
  # and update the one on file.
116
- SyncAttrWithAuth0::Auth0.patch_user(found_user['user_id'], params, auth0_sync_configuration)
116
+ SyncAttrWithAuth0::Auth0.patch_user(found_user['user_id'], params, config: auth0_sync_configuration)
117
117
 
118
118
  # Update the record with the uid after_commit
119
119
  @auth0_uid = found_user['user_id']
@@ -22,7 +22,7 @@ module SyncAttrWithAuth0
22
22
  end # validate_email_with_auth0
23
23
 
24
24
  def users_in_auth0_with_matching_email
25
- return SyncAttrWithAuth0::Auth0.find_users_by_email(auth0_user_email, auth0_sync_configuration)
25
+ return SyncAttrWithAuth0::Auth0.find_users_by_email(auth0_user_email, exclude_user_id: auth0_user_uid, config: auth0_sync_configuration)
26
26
  end # users_in_auth0_with_matching_email
27
27
 
28
28
  end
@@ -27,7 +27,7 @@ module SyncAttrWithAuth0
27
27
  api_version: 2,
28
28
  config: SyncAttrWithAuth0.configuration
29
29
  )
30
- validate_auth0_config_for_api(api_version, config)
30
+ validate_auth0_config_for_api(api_version, config: config)
31
31
 
32
32
  case api_version
33
33
  when 1
@@ -41,7 +41,7 @@ module SyncAttrWithAuth0
41
41
  end # ::create_auth0_client
42
42
 
43
43
 
44
- def self.validate_auth0_config_for_api(api_version, config = SyncAttrWithAuth0.configuration)
44
+ def self.validate_auth0_config_for_api(api_version, config: SyncAttrWithAuth0.configuration)
45
45
  settings_to_validate = []
46
46
  invalid_settings = []
47
47
 
@@ -64,21 +64,26 @@ module SyncAttrWithAuth0
64
64
  end # ::validate_auth0_config_for_api
65
65
 
66
66
 
67
- def self.find_users_by_email(email, config = SyncAttrWithAuth0.configuration)
67
+ def self.find_users_by_email(email, exclude_user_id: nil, config: SyncAttrWithAuth0.configuration)
68
68
  auth0 = SyncAttrWithAuth0::Auth0.create_auth0_client(config: config)
69
+ query_string = "email:\"#{email}\""
69
70
 
70
- return auth0.users(q: "email:\"#{email}\"")
71
+ unless exclude_user_id.nil?
72
+ query_string += " -user_id:\"#{exclude_user_id}\""
73
+ end
74
+
75
+ return auth0.users(q: query_string)
71
76
  end # ::find_users_by_email
72
77
 
73
78
 
74
- def self.create_user(name, params, config = SyncAttrWithAuth0.configuration)
79
+ def self.create_user(name, params, config: SyncAttrWithAuth0.configuration)
75
80
  auth0 = SyncAttrWithAuth0::Auth0.create_auth0_client(config: config)
76
81
 
77
82
  return auth0.create_user(name, params)
78
83
  end # ::create_user
79
84
 
80
85
 
81
- def self.patch_user(uid, params, config = SyncAttrWithAuth0.configuration)
86
+ def self.patch_user(uid, params, config: SyncAttrWithAuth0.configuration)
82
87
  auth0 = SyncAttrWithAuth0::Auth0.create_auth0_client(config: config)
83
88
 
84
89
  return auth0.patch_user(uid, params)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sync_attr_with_auth0
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick McGraw