login_radius 3.0.0 → 10.0.0.pre.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +5 -5
  2. data/LICENSE.txt +21 -0
  3. data/README.md +58 -52
  4. data/lib/login_radius.rb +30 -15
  5. data/lib/login_radius/api/account/account_api.rb +581 -0
  6. data/lib/login_radius/api/account/role_api.rb +330 -0
  7. data/lib/login_radius/api/account/sott_api.rb +47 -0
  8. data/lib/login_radius/api/advanced/configuration_api.rb +57 -0
  9. data/lib/login_radius/api/advanced/consent_management_api.rb +161 -0
  10. data/lib/login_radius/api/advanced/custom_object_api.rb +316 -0
  11. data/lib/login_radius/api/advanced/custom_registration_data_api.rb +195 -0
  12. data/lib/login_radius/api/advanced/multi_factor_authentication_api.rb +606 -0
  13. data/lib/login_radius/api/advanced/re_authentication_api.rb +243 -0
  14. data/lib/login_radius/api/advanced/web_hook_api.rb +101 -0
  15. data/lib/login_radius/api/authentication/authentication_api.rb +986 -0
  16. data/lib/login_radius/api/authentication/one_touch_login_api.rb +160 -0
  17. data/lib/login_radius/api/authentication/password_less_login_api.rb +158 -0
  18. data/lib/login_radius/api/authentication/phone_authentication_api.rb +329 -0
  19. data/lib/login_radius/api/authentication/pin_authentication_api.rb +316 -0
  20. data/lib/login_radius/api/authentication/risk_based_authentication_api.rb +286 -0
  21. data/lib/login_radius/api/authentication/smart_login_api.rb +146 -0
  22. data/lib/login_radius/api/social/native_social_api.rb +193 -0
  23. data/lib/login_radius/api/social/social_api.rb +802 -0
  24. data/lib/login_radius/error.rb +7 -0
  25. data/lib/login_radius/request_client.rb +295 -0
  26. data/lib/login_radius/response.rb +12 -0
  27. data/lib/login_radius/version.rb +3 -3
  28. data/login_radius.gemspec +36 -0
  29. metadata +61 -20
  30. data/LICENSE +0 -22
  31. data/lib/hash.rb +0 -12
  32. data/lib/login_radius/advanced_api.rb +0 -133
  33. data/lib/login_radius/authentication_api.rb +0 -597
  34. data/lib/login_radius/exception.rb +0 -4
  35. data/lib/login_radius/management_api.rb +0 -327
  36. data/lib/login_radius/rest_request.rb +0 -142
  37. data/lib/login_radius/social_api.rb +0 -402
  38. data/lib/login_radius/two_fa_api.rb +0 -191
  39. data/lib/string.rb +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 51d34e0cc8878984ba63856bc11c98bf1c10dd52
4
- data.tar.gz: c346f4b1b45319011cccc9ecf72b15b14fca0431
2
+ SHA256:
3
+ metadata.gz: 01fe092cde5a317cc5d103c37fb73ca02cdf7b741c3ee5d894c525f917c634e5
4
+ data.tar.gz: 2a55b8a2c9af6ed7485456287e458f7b6d200de549d4f67f836877254b657a26
5
5
  SHA512:
6
- metadata.gz: 98d28d1c1bf91b0558d5bf606c808272a03f2621707dcfde759c97fb2a050d8203d2b48fde50d80400c984615d473d04863a51248a50f998e12433b78b71521b
7
- data.tar.gz: dfbe12ac630adff536aacdf364121167c9218738885bfce8daeadef1447b2467e446be285a0b5dd6c9f76538625bf441e0850a592fa518c1512c9628921bc9aa
6
+ metadata.gz: 8917928758b9cc5071a1d3963e3643719a17253e2ff1eaca930ad2d7f2df174f5aeb611f096ae18411b1eeee9bef6707e6fa8b6d55737a99975303a3314e7a80
7
+ data.tar.gz: a8525bf5882864e098a7bbf37c8ac6b9170be4b546d648b764be258da210ada2d9d8e5aa85b4e257d38d06146398d32e7430306cf47e5c1cf46101a529f1c331
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,52 +1,58 @@
1
- # LoginRadius
2
-
3
- Ruby wrapper for the LoginRadius API. Get social graph information and send messages using LoginRadius'
4
- many social network clients!
5
-
6
- Optional Asynchronous EventMachine friendly option!
7
-
8
- ## Installation
9
-
10
- Add this line to your application's Gemfile:
11
-
12
- gem 'login_radius'
13
-
14
- And then execute:
15
-
16
- $ bundle
17
-
18
- Or install it yourself as:
19
-
20
- $ gem install login_radius
21
-
22
- ## Usage
23
-
24
- Take a peek:
25
-
26
- @LoginRadius = {
27
- :sitename => "<LOGINRADIUS_SITE_NAME>",
28
- :appkey => "<LOGINRADIUS_APPKEY>",
29
- :appsecret => "<LOGINRADIUS_APPSECRET>",
30
- :objectId => "<LOGINRADIUS_OBJECT_ID>"
31
- }
32
- @user_profile = LoginRadius::RestRequest.new(@LoginRadius);
33
-
34
-
35
- ### How to get a token and actually make a client
36
-
37
- On the LoginRadius website, you are able to enter your own callback URL for your site. You will need
38
- to setup a route on whatever framework you use, maybe "/callback." Then, get the gem forward(www.example.com)
39
- and use it to set up a public web address for your localhost server. Then, you can enter the callback on LoginRadius
40
- as https://example.com/callback, for instance.
41
-
42
- Paste their example login stuff onto your index page, and then configuration provider on your LoginRadius site.
43
-
44
- Now you're ready to go with testing!
45
-
46
- When LoginRadius hits your callback after a user logs in, you'll see parameters like this:
47
-
48
- Parameters: {"token"=>"yourtokenhere"}
49
-
50
- This token is the token used in the above example. This is what you'll need to get your access token and fetch user's profile from LoginRadius.
51
- Just paste it into the code above, and you can immediately grab their user profile on the callback,
52
- login, and grab their contacts.
1
+ ## Installation
2
+
3
+ Install the SDK by adding LoginRadius to your application's `Gemfile`.
4
+
5
+ ```ruby
6
+ gem 'login_radius'
7
+ ```
8
+
9
+ Then, run `$ bundle`. A copy of the SDK can also be found on our [Github](https://github.com/LoginRadius/ruby-on-rails-gem/tree/master).
10
+
11
+ ## Quickstart Guide
12
+
13
+ 1)Before using any of the functions available in the library, its corresponding module must first define the global constant in `config/application.yml`:
14
+
15
+ ```
16
+ SITE_NAME: "<site name>"
17
+ API_KEY: "<api-key>"
18
+ API_SECRET: "<api-secret>"
19
+ CUSTOM_API_DOMAIN: "<custom-domain-url-if-any>"
20
+ API_REQUEST_SIGNING: "false"
21
+ ```
22
+
23
+ 2)After define the configuration key details, its corresponding module must first be instantiated:
24
+
25
+ Create `login_radius.rb` in `/config/initializers`:
26
+
27
+
28
+
29
+ ```
30
+ require 'login_radius'
31
+
32
+ ::AccountApi = LoginRadius::AccountApi.new
33
+ ::RoleApi = LoginRadius::RoleApi.new
34
+ ::SottApi = LoginRadius::SottApi.new
35
+
36
+ ::ConfigurationApi = LoginRadius::ConfigurationApi.new
37
+ ::ConsentManagementApi = LoginRadius::ConsentManagementApi.new
38
+ ::CustomObjectApi = LoginRadius::CustomObjectApi.new
39
+ ::CustomRegistrationDataApi = LoginRadius::CustomRegistrationDataApi.new
40
+ ::MultiFactorAuthenticationApi = LoginRadius::MultiFactorAuthenticationApi.new
41
+ ::ReAuthenticationApi = LoginRadius::ReAuthenticationApi.new
42
+ ::WebHookApi = LoginRadius::WebHookApi.new
43
+
44
+ ::AuthenticationApi = LoginRadius::AuthenticationApi.new
45
+ ::OneTouchLoginApi = LoginRadius::OneTouchLoginApi.new
46
+ ::PasswordLessLoginApi = LoginRadius::PasswordLessLoginApi.new
47
+ ::PhoneAuthenticationApi = LoginRadius::PhoneAuthenticationApi.new
48
+ ::PINAuthenticationApi = LoginRadius::PINAuthenticationApi.new
49
+ ::RiskBasedAuthenticationApi = LoginRadius::RiskBasedAuthenticationApi.new
50
+ ::SmartLoginApi = LoginRadius::SmartLoginApi.new
51
+
52
+ ::NativeSocialApi = LoginRadius::NativeSocialApi.new
53
+ ::SocialApi = LoginRadius::SocialApi.new
54
+ ```
55
+
56
+ Please note that you only have to initiate modules you need.
57
+
58
+ The API key and secret can be obtained from the LoginRadius Admin Console. Details on retrieving your key and secret can be found [here](loginradius.com/docs/api/v2/admin-console/platform-security/api-key-and-secret/).
data/lib/login_radius.rb CHANGED
@@ -1,15 +1,30 @@
1
- require "login_radius/version"
2
- require "login_radius/authentication_api"
3
- require "login_radius/advanced_api"
4
- require "login_radius/social_api"
5
- require "login_radius/management_api"
6
- require "login_radius/two_fa_api"
7
- require "login_radius/exception"
8
- require "login_radius/rest_request"
9
- require "string"
10
- require "hash"
11
-
12
-
13
- module LoginRadius
14
-
15
- end
1
+ require_relative "login_radius/version"
2
+ require_relative "login_radius/error"
3
+ require_relative "login_radius/response"
4
+ require_relative "login_radius/api/account/account_api"
5
+ require_relative "login_radius/api/account/role_api"
6
+ require_relative "login_radius/api/account/sott_api"
7
+ require_relative "login_radius/api/advanced/configuration_api"
8
+ require_relative "login_radius/api/advanced/consent_management_api"
9
+ require_relative "login_radius/api/advanced/custom_object_api"
10
+ require_relative "login_radius/api/advanced/custom_registration_data_api"
11
+ require_relative "login_radius/api/advanced/multi_factor_authentication_api"
12
+ require_relative "login_radius/api/advanced/re_authentication_api"
13
+ require_relative "login_radius/api/advanced/web_hook_api"
14
+ require_relative "login_radius/api/authentication/authentication_api"
15
+ require_relative "login_radius/api/authentication/one_touch_login_api"
16
+ require_relative "login_radius/api/authentication/password_less_login_api"
17
+ require_relative "login_radius/api/authentication/phone_authentication_api"
18
+ require_relative "login_radius/api/authentication/pin_authentication_api"
19
+ require_relative "login_radius/api/authentication/risk_based_authentication_api"
20
+ require_relative "login_radius/api/authentication/smart_login_api"
21
+ require_relative "login_radius/api/social/native_social_api"
22
+ require_relative "login_radius/api/social/social_api"
23
+ require_relative "login_radius/request_client"
24
+
25
+
26
+ require "json"
27
+
28
+ module LoginRadius
29
+ # LoginRadius parent module
30
+ end
@@ -0,0 +1,581 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Created by LoginRadius Development Team
4
+ # Copyright 2019 LoginRadius Inc. All rights reserved.
5
+ require_relative '../../request_client'
6
+
7
+ module LoginRadius
8
+ # AccountApi module
9
+ class AccountApi
10
+ include RequestClient
11
+
12
+ attr_accessor :site_name, :api_key, :api_secret
13
+
14
+ # Initializes a LoginRadius Account object with an apikey and secret
15
+ # Takes in a hash containing site_name(required), api_key(required), api_secret(required)
16
+ def initialize
17
+ @site_name = ENV['SITE_NAME']
18
+ @api_key = ENV['API_KEY']
19
+ @api_secret = ENV['API_SECRET']
20
+ raise LoginRadius::Error.new, "'site_name' is a required option for Account class initialization." \
21
+ unless @site_name != '' && @site_name != nil
22
+ raise LoginRadius::Error.new, "'api_key' is a required option for Account class initialization." \
23
+ unless @api_key != '' && @api_key != nil
24
+ raise LoginRadius::Error.new, "'api_secret is a required option for Account class initialization." \
25
+ unless @api_secret != '' && @api_secret != nil
26
+ end
27
+
28
+ # This API is used to retrieve all of the accepted Policies by the user, associated with their UID.
29
+ #
30
+ # @param uid - UID, the unified identifier for each user account
31
+ #
32
+ # @return Complete Policy History data
33
+ # 15.1.1
34
+ def get_privacy_policy_history_by_uid(uid)
35
+ if isNullOrWhiteSpace(uid)
36
+ raise LoginRadius::Error.new, getValidationMessage('uid')
37
+ end
38
+
39
+ query_parameters = {}
40
+ query_parameters['apiKey'] = @api_key
41
+ query_parameters['apiSecret'] = @api_secret
42
+
43
+ resource_path = 'identity/v2/manage/account/' + uid + '/privacypolicy/history'
44
+ get_request(resource_path, query_parameters, nil)
45
+ end
46
+
47
+ # This API is used to create an account in Cloud Storage. This API bypass the normal email verification process and manually creates the user. <br><br>In order to use this API, you need to format a JSON request body with all of the mandatory fields
48
+ #
49
+ # @param account_create_model - Model Class containing Definition of payload for Account Create API
50
+ # @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
51
+ #
52
+ # @return Response containing Definition for Complete profile data
53
+ # 18.1
54
+ def create_account(account_create_model, fields = '')
55
+ if account_create_model.blank?
56
+ raise LoginRadius::Error.new, getValidationMessage('account_create_model')
57
+ end
58
+
59
+ query_parameters = {}
60
+ query_parameters['apiKey'] = @api_key
61
+ query_parameters['apiSecret'] = @api_secret
62
+ unless isNullOrWhiteSpace(fields)
63
+ query_parameters['fields'] = fields
64
+ end
65
+
66
+ resource_path = 'identity/v2/manage/account'
67
+ post_request(resource_path, query_parameters, account_create_model)
68
+ end
69
+
70
+ # This API is used to retrieve all of the profile data, associated with the specified account by email in Cloud Storage.
71
+ #
72
+ # @param email - Email of the user
73
+ # @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
74
+ #
75
+ # @return Response containing Definition for Complete profile data
76
+ # 18.2
77
+ def get_account_profile_by_email(email, fields = '')
78
+ if isNullOrWhiteSpace(email)
79
+ raise LoginRadius::Error.new, getValidationMessage('email')
80
+ end
81
+
82
+ query_parameters = {}
83
+ query_parameters['apiKey'] = @api_key
84
+ query_parameters['apiSecret'] = @api_secret
85
+ query_parameters['email'] = email
86
+ unless isNullOrWhiteSpace(fields)
87
+ query_parameters['fields'] = fields
88
+ end
89
+
90
+ resource_path = 'identity/v2/manage/account'
91
+ get_request(resource_path, query_parameters, nil)
92
+ end
93
+
94
+ # This API is used to retrieve all of the profile data associated with the specified account by user name in Cloud Storage.
95
+ #
96
+ # @param user_name - UserName of the user
97
+ # @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
98
+ #
99
+ # @return Response containing Definition for Complete profile data
100
+ # 18.3
101
+ def get_account_profile_by_user_name(user_name, fields = '')
102
+ if isNullOrWhiteSpace(user_name)
103
+ raise LoginRadius::Error.new, getValidationMessage('user_name')
104
+ end
105
+
106
+ query_parameters = {}
107
+ query_parameters['apiKey'] = @api_key
108
+ query_parameters['apiSecret'] = @api_secret
109
+ query_parameters['userName'] = user_name
110
+ unless isNullOrWhiteSpace(fields)
111
+ query_parameters['fields'] = fields
112
+ end
113
+
114
+ resource_path = 'identity/v2/manage/account'
115
+ get_request(resource_path, query_parameters, nil)
116
+ end
117
+
118
+ # This API is used to retrieve all of the profile data, associated with the account by phone number in Cloud Storage.
119
+ #
120
+ # @param phone - The Registered Phone Number
121
+ # @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
122
+ #
123
+ # @return Response containing Definition for Complete profile data
124
+ # 18.4
125
+ def get_account_profile_by_phone(phone, fields = '')
126
+ if isNullOrWhiteSpace(phone)
127
+ raise LoginRadius::Error.new, getValidationMessage('phone')
128
+ end
129
+
130
+ query_parameters = {}
131
+ query_parameters['apiKey'] = @api_key
132
+ query_parameters['apiSecret'] = @api_secret
133
+ query_parameters['phone'] = phone
134
+ unless isNullOrWhiteSpace(fields)
135
+ query_parameters['fields'] = fields
136
+ end
137
+
138
+ resource_path = 'identity/v2/manage/account'
139
+ get_request(resource_path, query_parameters, nil)
140
+ end
141
+
142
+ # This API is used to retrieve all of the profile data, associated with the account by uid in Cloud Storage.
143
+ #
144
+ # @param uid - UID, the unified identifier for each user account
145
+ # @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
146
+ #
147
+ # @return Response containing Definition for Complete profile data
148
+ # 18.5
149
+ def get_account_profile_by_uid(uid, fields = '')
150
+ if isNullOrWhiteSpace(uid)
151
+ raise LoginRadius::Error.new, getValidationMessage('uid')
152
+ end
153
+
154
+ query_parameters = {}
155
+ query_parameters['apiKey'] = @api_key
156
+ query_parameters['apiSecret'] = @api_secret
157
+ unless isNullOrWhiteSpace(fields)
158
+ query_parameters['fields'] = fields
159
+ end
160
+
161
+ resource_path = 'identity/v2/manage/account/' + uid
162
+ get_request(resource_path, query_parameters, nil)
163
+ end
164
+
165
+ # This API is used to update the information of existing accounts in your Cloud Storage. See our Advanced API Usage section <a href='https://www.loginradius.com/docs/api/v2/customer-identity-api/advanced-api-usage/'>Here</a> for more capabilities.
166
+ #
167
+ # @param account_user_profile_update_model - Model Class containing Definition of payload for Account Update API
168
+ # @param uid - UID, the unified identifier for each user account
169
+ # @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
170
+ # @param null_support - Boolean, pass true if you wish to update any user profile field with a NULL value, You can get the details
171
+ #
172
+ # @return Response containing Definition for Complete profile data
173
+ # 18.15
174
+ def update_account_by_uid(account_user_profile_update_model, uid, fields = '', null_support = false)
175
+ if account_user_profile_update_model.blank?
176
+ raise LoginRadius::Error.new, getValidationMessage('account_user_profile_update_model')
177
+ end
178
+ if isNullOrWhiteSpace(uid)
179
+ raise LoginRadius::Error.new, getValidationMessage('uid')
180
+ end
181
+
182
+ query_parameters = {}
183
+ query_parameters['apiKey'] = @api_key
184
+ query_parameters['apiSecret'] = @api_secret
185
+ unless isNullOrWhiteSpace(fields)
186
+ query_parameters['fields'] = fields
187
+ end
188
+ unless null_support == false
189
+ query_parameters['nullSupport'] = null_support
190
+ end
191
+
192
+ resource_path = 'identity/v2/manage/account/' + uid
193
+ put_request(resource_path, query_parameters, account_user_profile_update_model)
194
+ end
195
+
196
+ # This API is used to update the PhoneId by using the Uid's. Admin can update the PhoneId's for both the verified and unverified profiles. It will directly replace the PhoneId and bypass the OTP verification process.
197
+ #
198
+ # @param phone - Phone number
199
+ # @param uid - UID, the unified identifier for each user account
200
+ # @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
201
+ #
202
+ # @return Response containing Definition for Complete profile data
203
+ # 18.16
204
+ def update_phone_id_by_uid(phone, uid, fields = '')
205
+ if isNullOrWhiteSpace(phone)
206
+ raise LoginRadius::Error.new, getValidationMessage('phone')
207
+ end
208
+ if isNullOrWhiteSpace(uid)
209
+ raise LoginRadius::Error.new, getValidationMessage('uid')
210
+ end
211
+
212
+ query_parameters = {}
213
+ query_parameters['apiKey'] = @api_key
214
+ query_parameters['apiSecret'] = @api_secret
215
+ unless isNullOrWhiteSpace(fields)
216
+ query_parameters['fields'] = fields
217
+ end
218
+
219
+ body_parameters = {}
220
+ body_parameters['phone'] = phone
221
+
222
+ resource_path = 'identity/v2/manage/account/' + uid + '/phoneid'
223
+ put_request(resource_path, query_parameters, body_parameters)
224
+ end
225
+
226
+ # This API use to retrive the hashed password of a specified account in Cloud Storage.
227
+ #
228
+ # @param uid - UID, the unified identifier for each user account
229
+ #
230
+ # @return Response containing Definition for Complete PasswordHash data
231
+ # 18.17
232
+ def get_account_password_hash_by_uid(uid)
233
+ if isNullOrWhiteSpace(uid)
234
+ raise LoginRadius::Error.new, getValidationMessage('uid')
235
+ end
236
+
237
+ query_parameters = {}
238
+ query_parameters['apiKey'] = @api_key
239
+ query_parameters['apiSecret'] = @api_secret
240
+
241
+ resource_path = 'identity/v2/manage/account/' + uid + '/password'
242
+ get_request(resource_path, query_parameters, nil)
243
+ end
244
+
245
+ # This API is used to set the password of an account in Cloud Storage.
246
+ #
247
+ # @param password - New password
248
+ # @param uid - UID, the unified identifier for each user account
249
+ #
250
+ # @return Response containing Definition for Complete PasswordHash data
251
+ # 18.18
252
+ def set_account_password_by_uid(password, uid)
253
+ if isNullOrWhiteSpace(password)
254
+ raise LoginRadius::Error.new, getValidationMessage('password')
255
+ end
256
+ if isNullOrWhiteSpace(uid)
257
+ raise LoginRadius::Error.new, getValidationMessage('uid')
258
+ end
259
+
260
+ query_parameters = {}
261
+ query_parameters['apiKey'] = @api_key
262
+ query_parameters['apiSecret'] = @api_secret
263
+
264
+ body_parameters = {}
265
+ body_parameters['password'] = password
266
+
267
+ resource_path = 'identity/v2/manage/account/' + uid + '/password'
268
+ put_request(resource_path, query_parameters, body_parameters)
269
+ end
270
+
271
+ # This API deletes the Users account and allows them to re-register for a new account.
272
+ #
273
+ # @param uid - UID, the unified identifier for each user account
274
+ #
275
+ # @return Response containing Definition of Delete Request
276
+ # 18.19
277
+ def delete_account_by_uid(uid)
278
+ if isNullOrWhiteSpace(uid)
279
+ raise LoginRadius::Error.new, getValidationMessage('uid')
280
+ end
281
+
282
+ query_parameters = {}
283
+ query_parameters['apiKey'] = @api_key
284
+ query_parameters['apiSecret'] = @api_secret
285
+
286
+ resource_path = 'identity/v2/manage/account/' + uid
287
+ delete_request(resource_path, query_parameters, nil)
288
+ end
289
+
290
+ # This API is used to invalidate the Email Verification status on an account.
291
+ #
292
+ # @param uid - UID, the unified identifier for each user account
293
+ # @param email_template - Email template name
294
+ # @param verification_url - Email verification url
295
+ #
296
+ # @return Response containing Definition of Complete Validation data
297
+ # 18.20
298
+ def invalidate_account_email_verification(uid, email_template = '', verification_url = '')
299
+ if isNullOrWhiteSpace(uid)
300
+ raise LoginRadius::Error.new, getValidationMessage('uid')
301
+ end
302
+
303
+ query_parameters = {}
304
+ query_parameters['apiKey'] = @api_key
305
+ query_parameters['apiSecret'] = @api_secret
306
+ unless isNullOrWhiteSpace(email_template)
307
+ query_parameters['emailTemplate'] = email_template
308
+ end
309
+ unless isNullOrWhiteSpace(verification_url)
310
+ query_parameters['verificationUrl'] = verification_url
311
+ end
312
+
313
+ resource_path = 'identity/v2/manage/account/' + uid + '/invalidateemail'
314
+ put_request(resource_path, query_parameters, nil)
315
+ end
316
+
317
+ # This API Returns a Forgot Password Token it can also be used to send a Forgot Password email to the customer. Note: If you have the UserName workflow enabled, you may replace the 'email' parameter with 'username' in the body.
318
+ #
319
+ # @param email - user's email
320
+ # @param email_template - Email template name
321
+ # @param reset_password_url - Url to which user should get re-directed to for resetting the password
322
+ # @param send_email - If set to true, the API will also send a Forgot Password email to the customer, bypassing any Bot Protection challenges that they are faced with.
323
+ #
324
+ # @return Response containing Definition of Complete Forgot Password data
325
+ # 18.22
326
+ def get_forgot_password_token(email, email_template = '', reset_password_url = '', send_email = false)
327
+ if isNullOrWhiteSpace(email)
328
+ raise LoginRadius::Error.new, getValidationMessage('email')
329
+ end
330
+
331
+ query_parameters = {}
332
+ query_parameters['apiKey'] = @api_key
333
+ query_parameters['apiSecret'] = @api_secret
334
+ unless isNullOrWhiteSpace(email_template)
335
+ query_parameters['emailTemplate'] = email_template
336
+ end
337
+ unless isNullOrWhiteSpace(reset_password_url)
338
+ query_parameters['resetPasswordUrl'] = reset_password_url
339
+ end
340
+ unless send_email == false
341
+ query_parameters['sendEmail'] = send_email
342
+ end
343
+
344
+ body_parameters = {}
345
+ body_parameters['email'] = email
346
+
347
+ resource_path = 'identity/v2/manage/account/forgot/token'
348
+ post_request(resource_path, query_parameters, body_parameters)
349
+ end
350
+
351
+ # This API Returns an Email Verification token.
352
+ #
353
+ # @param email - user's email
354
+ #
355
+ # @return Response containing Definition of Complete Verification data
356
+ # 18.23
357
+ def get_email_verification_token(email)
358
+ if isNullOrWhiteSpace(email)
359
+ raise LoginRadius::Error.new, getValidationMessage('email')
360
+ end
361
+
362
+ query_parameters = {}
363
+ query_parameters['apiKey'] = @api_key
364
+ query_parameters['apiSecret'] = @api_secret
365
+
366
+ body_parameters = {}
367
+ body_parameters['email'] = email
368
+
369
+ resource_path = 'identity/v2/manage/account/verify/token'
370
+ post_request(resource_path, query_parameters, body_parameters)
371
+ end
372
+
373
+ # The API is used to get LoginRadius access token based on UID.
374
+ #
375
+ # @param uid - UID, the unified identifier for each user account
376
+ #
377
+ # @return Response containing Definition of Complete Token data
378
+ # 18.24
379
+ def get_access_token_by_uid(uid)
380
+ if isNullOrWhiteSpace(uid)
381
+ raise LoginRadius::Error.new, getValidationMessage('uid')
382
+ end
383
+
384
+ query_parameters = {}
385
+ query_parameters['apiKey'] = @api_key
386
+ query_parameters['apiSecret'] = @api_secret
387
+ query_parameters['uid'] = uid
388
+
389
+ resource_path = 'identity/v2/manage/account/access_token'
390
+ get_request(resource_path, query_parameters, nil)
391
+ end
392
+
393
+ # This API Allows you to reset the phone no verification of an end user’s account.
394
+ #
395
+ # @param uid - UID, the unified identifier for each user account
396
+ # @param sms_template - SMS Template name
397
+ #
398
+ # @return Response containing Definition of Complete Validation data
399
+ # 18.27
400
+ def reset_phone_id_verification_by_uid(uid, sms_template = '')
401
+ if isNullOrWhiteSpace(uid)
402
+ raise LoginRadius::Error.new, getValidationMessage('uid')
403
+ end
404
+
405
+ query_parameters = {}
406
+ query_parameters['apiKey'] = @api_key
407
+ query_parameters['apiSecret'] = @api_secret
408
+ unless isNullOrWhiteSpace(sms_template)
409
+ query_parameters['smsTemplate'] = sms_template
410
+ end
411
+
412
+ resource_path = 'identity/v2/manage/account/' + uid + '/invalidatephone'
413
+ put_request(resource_path, query_parameters, nil)
414
+ end
415
+
416
+ # This API is used to add/upsert another emails in account profile by different-different email types. If the email type is same then it will simply update the existing email, otherwise it will add a new email in Email array.
417
+ #
418
+ # @param upsert_email_model - Model Class containing Definition of payload for UpsertEmail Property
419
+ # @param uid - UID, the unified identifier for each user account
420
+ # @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
421
+ #
422
+ # @return Response containing Definition for Complete profile data
423
+ # 18.29
424
+ def upsert_email(upsert_email_model, uid, fields = '')
425
+ if upsert_email_model.blank?
426
+ raise LoginRadius::Error.new, getValidationMessage('upsert_email_model')
427
+ end
428
+ if isNullOrWhiteSpace(uid)
429
+ raise LoginRadius::Error.new, getValidationMessage('uid')
430
+ end
431
+
432
+ query_parameters = {}
433
+ query_parameters['apiKey'] = @api_key
434
+ query_parameters['apiSecret'] = @api_secret
435
+ unless isNullOrWhiteSpace(fields)
436
+ query_parameters['fields'] = fields
437
+ end
438
+
439
+ resource_path = 'identity/v2/manage/account/' + uid + '/email'
440
+ put_request(resource_path, query_parameters, upsert_email_model)
441
+ end
442
+
443
+ # Use this API to Remove emails from a user Account
444
+ #
445
+ # @param email - user's email
446
+ # @param uid - UID, the unified identifier for each user account
447
+ # @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
448
+ #
449
+ # @return Response containing Definition for Complete profile data
450
+ # 18.30
451
+ def remove_email(email, uid, fields = '')
452
+ if isNullOrWhiteSpace(email)
453
+ raise LoginRadius::Error.new, getValidationMessage('email')
454
+ end
455
+ if isNullOrWhiteSpace(uid)
456
+ raise LoginRadius::Error.new, getValidationMessage('uid')
457
+ end
458
+
459
+ query_parameters = {}
460
+ query_parameters['apiKey'] = @api_key
461
+ query_parameters['apiSecret'] = @api_secret
462
+ unless isNullOrWhiteSpace(fields)
463
+ query_parameters['fields'] = fields
464
+ end
465
+
466
+ body_parameters = {}
467
+ body_parameters['email'] = email
468
+
469
+ resource_path = 'identity/v2/manage/account/' + uid + '/email'
470
+ delete_request(resource_path, query_parameters, body_parameters)
471
+ end
472
+
473
+ # This API is used to refresh an access token via it's associated refresh token.
474
+ #
475
+ # @param refresh__token - LoginRadius refresh token
476
+ #
477
+ # @return Response containing Definition of Complete Token data
478
+ # 18.31
479
+ def refresh_access_token_by_refresh_token(refresh__token)
480
+ if isNullOrWhiteSpace(refresh__token)
481
+ raise LoginRadius::Error.new, getValidationMessage('refresh__token')
482
+ end
483
+
484
+ query_parameters = {}
485
+ query_parameters['apiKey'] = @api_key
486
+ query_parameters['apiSecret'] = @api_secret
487
+ query_parameters['refresh_Token'] = refresh__token
488
+
489
+ resource_path = 'identity/v2/manage/account/access_token/refresh'
490
+ get_request(resource_path, query_parameters, nil)
491
+ end
492
+
493
+ # The Revoke Refresh Access Token API is used to revoke a refresh token or the Provider Access Token, revoking an existing refresh token will invalidate the refresh token but the associated access token will work until the expiry.
494
+ #
495
+ # @param refresh__token - LoginRadius refresh token
496
+ #
497
+ # @return Response containing Definition of Delete Request
498
+ # 18.32
499
+ def revoke_refresh_token(refresh__token)
500
+ if isNullOrWhiteSpace(refresh__token)
501
+ raise LoginRadius::Error.new, getValidationMessage('refresh__token')
502
+ end
503
+
504
+ query_parameters = {}
505
+ query_parameters['apiKey'] = @api_key
506
+ query_parameters['apiSecret'] = @api_secret
507
+ query_parameters['refresh_Token'] = refresh__token
508
+
509
+ resource_path = 'identity/v2/manage/account/access_token/refresh/revoke'
510
+ get_request(resource_path, query_parameters, nil)
511
+ end
512
+
513
+ # Note: This is intended for specific workflows where an email may be associated to multiple UIDs. This API is used to retrieve all of the identities (UID and Profiles), associated with a specified email in Cloud Storage.
514
+ #
515
+ # @param email - Email of the user
516
+ # @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
517
+ #
518
+ # @return Complete user Identity data
519
+ # 18.35
520
+ def get_account_identities_by_email(email, fields = '')
521
+ if isNullOrWhiteSpace(email)
522
+ raise LoginRadius::Error.new, getValidationMessage('email')
523
+ end
524
+
525
+ query_parameters = {}
526
+ query_parameters['apiKey'] = @api_key
527
+ query_parameters['apiSecret'] = @api_secret
528
+ query_parameters['email'] = email
529
+ unless isNullOrWhiteSpace(fields)
530
+ query_parameters['fields'] = fields
531
+ end
532
+
533
+ resource_path = 'identity/v2/manage/account/identities'
534
+ get_request(resource_path, query_parameters, nil)
535
+ end
536
+
537
+ # This API is used to delete all user profiles associated with an Email.
538
+ #
539
+ # @param email - Email of the user
540
+ #
541
+ # @return Response containing Definition of Delete Request
542
+ # 18.36
543
+ def account_delete_by_email(email)
544
+ if isNullOrWhiteSpace(email)
545
+ raise LoginRadius::Error.new, getValidationMessage('email')
546
+ end
547
+
548
+ query_parameters = {}
549
+ query_parameters['apiKey'] = @api_key
550
+ query_parameters['apiSecret'] = @api_secret
551
+ query_parameters['email'] = email
552
+
553
+ resource_path = 'identity/v2/manage/account'
554
+ delete_request(resource_path, query_parameters, nil)
555
+ end
556
+
557
+ # This API is used to update a user's Uid. It will update all profiles, custom objects and consent management logs associated with the Uid.
558
+ #
559
+ # @param update_uid_model - Payload containing Update UID
560
+ # @param uid - UID, the unified identifier for each user account
561
+ #
562
+ # @return Response containing Definition of Complete Validation data
563
+ # 18.41
564
+ def account_update_uid(update_uid_model, uid)
565
+ if update_uid_model.blank?
566
+ raise LoginRadius::Error.new, getValidationMessage('update_uid_model')
567
+ end
568
+ if isNullOrWhiteSpace(uid)
569
+ raise LoginRadius::Error.new, getValidationMessage('uid')
570
+ end
571
+
572
+ query_parameters = {}
573
+ query_parameters['apiKey'] = @api_key
574
+ query_parameters['apiSecret'] = @api_secret
575
+ query_parameters['uid'] = uid
576
+
577
+ resource_path = 'identity/v2/manage/account/uid'
578
+ put_request(resource_path, query_parameters, update_uid_model)
579
+ end
580
+ end
581
+ end