login_radius 11.0.0 → 11.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +21 -21
  3. data/README.md +58 -58
  4. data/lib/login_radius/api/account/account_api.rb +581 -581
  5. data/lib/login_radius/api/account/role_api.rb +330 -330
  6. data/lib/login_radius/api/account/sott_api.rb +47 -47
  7. data/lib/login_radius/api/advanced/configuration_api.rb +57 -57
  8. data/lib/login_radius/api/advanced/consent_management_api.rb +161 -161
  9. data/lib/login_radius/api/advanced/custom_object_api.rb +316 -316
  10. data/lib/login_radius/api/advanced/custom_registration_data_api.rb +195 -195
  11. data/lib/login_radius/api/advanced/multi_factor_authentication_api.rb +942 -606
  12. data/lib/login_radius/api/advanced/re_authentication_api.rb +317 -243
  13. data/lib/login_radius/api/advanced/web_hook_api.rb +101 -101
  14. data/lib/login_radius/api/authentication/authentication_api.rb +1036 -989
  15. data/lib/login_radius/api/authentication/one_touch_login_api.rb +160 -160
  16. data/lib/login_radius/api/authentication/password_less_login_api.rb +202 -158
  17. data/lib/login_radius/api/authentication/phone_authentication_api.rb +329 -329
  18. data/lib/login_radius/api/authentication/pin_authentication_api.rb +316 -316
  19. data/lib/login_radius/api/authentication/risk_based_authentication_api.rb +286 -286
  20. data/lib/login_radius/api/authentication/smart_login_api.rb +146 -146
  21. data/lib/login_radius/api/social/native_social_api.rb +255 -255
  22. data/lib/login_radius/api/social/social_api.rb +784 -806
  23. data/lib/login_radius/error.rb +7 -7
  24. data/lib/login_radius/request_client.rb +311 -295
  25. data/lib/login_radius/response.rb +18 -12
  26. data/lib/login_radius/version.rb +2 -2
  27. data/lib/login_radius.rb +30 -30
  28. data/login_radius.gemspec +25 -28
  29. metadata +7 -7
@@ -1,160 +1,160 @@
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
- # OneTouchLoginApi module
9
- class OneTouchLoginApi
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 send a link to a specified email for a frictionless login/registration
29
- #
30
- # @param one_touch_login_by_email_model - Model Class containing Definition of payload for OneTouchLogin By EmailModel API
31
- # @param one_touch_login_email_template - Name of the One Touch Login Email Template
32
- # @param redirecturl - Url where the user will redirect after success authentication
33
- # @param welcomeemailtemplate - Name of the welcome email template
34
- #
35
- # @return Response containing Definition of Complete Validation data
36
- # 1.2
37
- def one_touch_login_by_email(one_touch_login_by_email_model, one_touch_login_email_template = '', redirecturl = '', welcomeemailtemplate = '')
38
- if one_touch_login_by_email_model.blank?
39
- raise LoginRadius::Error.new, getValidationMessage('one_touch_login_by_email_model')
40
- end
41
-
42
- query_parameters = {}
43
- query_parameters['apiKey'] = @api_key
44
- unless isNullOrWhiteSpace(one_touch_login_email_template)
45
- query_parameters['oneTouchLoginEmailTemplate'] = one_touch_login_email_template
46
- end
47
- unless isNullOrWhiteSpace(redirecturl)
48
- query_parameters['redirecturl'] = redirecturl
49
- end
50
- unless isNullOrWhiteSpace(welcomeemailtemplate)
51
- query_parameters['welcomeemailtemplate'] = welcomeemailtemplate
52
- end
53
-
54
- resource_path = 'identity/v2/auth/onetouchlogin/email'
55
- post_request(resource_path, query_parameters, one_touch_login_by_email_model)
56
- end
57
-
58
- # This API is used to send one time password to a given phone number for a frictionless login/registration.
59
- #
60
- # @param one_touch_login_by_phone_model - Model Class containing Definition of payload for OneTouchLogin By PhoneModel API
61
- # @param sms_template - SMS Template name
62
- #
63
- # @return Response containing Definition of Complete Validation data
64
- # 1.4
65
- def one_touch_login_by_phone(one_touch_login_by_phone_model, sms_template = '')
66
- if one_touch_login_by_phone_model.blank?
67
- raise LoginRadius::Error.new, getValidationMessage('one_touch_login_by_phone_model')
68
- end
69
-
70
- query_parameters = {}
71
- query_parameters['apiKey'] = @api_key
72
- unless isNullOrWhiteSpace(sms_template)
73
- query_parameters['smsTemplate'] = sms_template
74
- end
75
-
76
- resource_path = 'identity/v2/auth/onetouchlogin/phone'
77
- post_request(resource_path, query_parameters, one_touch_login_by_phone_model)
78
- end
79
-
80
- # This API is used to verify the otp for One Touch Login.
81
- #
82
- # @param otp - The Verification Code
83
- # @param phone - New Phone Number
84
- # @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
85
- # @param sms_template - SMS Template name
86
- #
87
- # @return Response Containing Access Token and Complete Profile Data
88
- # 1.5
89
- def one_touch_login_otp_verification(otp, phone, fields = '', sms_template = '')
90
- if isNullOrWhiteSpace(otp)
91
- raise LoginRadius::Error.new, getValidationMessage('otp')
92
- end
93
- if isNullOrWhiteSpace(phone)
94
- raise LoginRadius::Error.new, getValidationMessage('phone')
95
- end
96
-
97
- query_parameters = {}
98
- query_parameters['apiKey'] = @api_key
99
- query_parameters['otp'] = otp
100
- unless isNullOrWhiteSpace(fields)
101
- query_parameters['fields'] = fields
102
- end
103
- unless isNullOrWhiteSpace(sms_template)
104
- query_parameters['smsTemplate'] = sms_template
105
- end
106
-
107
- body_parameters = {}
108
- body_parameters['phone'] = phone
109
-
110
- resource_path = 'identity/v2/auth/onetouchlogin/phone/verify'
111
- put_request(resource_path, query_parameters, body_parameters)
112
- end
113
-
114
- # This API verifies the provided token for One Touch Login
115
- #
116
- # @param verification_token - Verification token received in the email
117
- # @param welcome_email_template - Name of the welcome email template
118
- #
119
- # @return Complete verified response data
120
- # 8.4.2
121
- def one_touch_email_verification(verification_token, welcome_email_template = '')
122
- if isNullOrWhiteSpace(verification_token)
123
- raise LoginRadius::Error.new, getValidationMessage('verification_token')
124
- end
125
-
126
- query_parameters = {}
127
- query_parameters['apiKey'] = @api_key
128
- query_parameters['verificationToken'] = verification_token
129
- unless isNullOrWhiteSpace(welcome_email_template)
130
- query_parameters['welcomeEmailTemplate'] = welcome_email_template
131
- end
132
-
133
- resource_path = 'identity/v2/auth/email/onetouchlogin'
134
- get_request(resource_path, query_parameters, nil)
135
- end
136
-
137
- # This API is used to check if the One Touch Login link has been clicked or not.
138
- #
139
- # @param client_guid - Unique string used in the Smart Login request
140
- # @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
141
- #
142
- # @return Response containing User Profile Data and access token
143
- # 9.21.2
144
- def one_touch_login_ping(client_guid, fields = '')
145
- if isNullOrWhiteSpace(client_guid)
146
- raise LoginRadius::Error.new, getValidationMessage('client_guid')
147
- end
148
-
149
- query_parameters = {}
150
- query_parameters['apiKey'] = @api_key
151
- query_parameters['clientGuid'] = client_guid
152
- unless isNullOrWhiteSpace(fields)
153
- query_parameters['fields'] = fields
154
- end
155
-
156
- resource_path = 'identity/v2/auth/login/smartlogin/ping'
157
- get_request(resource_path, query_parameters, nil)
158
- end
159
- end
160
- end
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
+ # OneTouchLoginApi module
9
+ class OneTouchLoginApi
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 send a link to a specified email for a frictionless login/registration
29
+ #
30
+ # @param one_touch_login_by_email_model - Model Class containing Definition of payload for OneTouchLogin By EmailModel API
31
+ # @param one_touch_login_email_template - Name of the One Touch Login Email Template
32
+ # @param redirecturl - Url where the user will redirect after success authentication
33
+ # @param welcomeemailtemplate - Name of the welcome email template
34
+ #
35
+ # @return Response containing Definition of Complete Validation data
36
+ # 1.2
37
+ def one_touch_login_by_email(one_touch_login_by_email_model, one_touch_login_email_template = '', redirecturl = '', welcomeemailtemplate = '')
38
+ if one_touch_login_by_email_model.blank?
39
+ raise LoginRadius::Error.new, getValidationMessage('one_touch_login_by_email_model')
40
+ end
41
+
42
+ query_parameters = {}
43
+ query_parameters['apiKey'] = @api_key
44
+ unless isNullOrWhiteSpace(one_touch_login_email_template)
45
+ query_parameters['oneTouchLoginEmailTemplate'] = one_touch_login_email_template
46
+ end
47
+ unless isNullOrWhiteSpace(redirecturl)
48
+ query_parameters['redirecturl'] = redirecturl
49
+ end
50
+ unless isNullOrWhiteSpace(welcomeemailtemplate)
51
+ query_parameters['welcomeemailtemplate'] = welcomeemailtemplate
52
+ end
53
+
54
+ resource_path = 'identity/v2/auth/onetouchlogin/email'
55
+ post_request(resource_path, query_parameters, one_touch_login_by_email_model)
56
+ end
57
+
58
+ # This API is used to send one time password to a given phone number for a frictionless login/registration.
59
+ #
60
+ # @param one_touch_login_by_phone_model - Model Class containing Definition of payload for OneTouchLogin By PhoneModel API
61
+ # @param sms_template - SMS Template name
62
+ #
63
+ # @return Response containing Definition of Complete Validation data
64
+ # 1.4
65
+ def one_touch_login_by_phone(one_touch_login_by_phone_model, sms_template = '')
66
+ if one_touch_login_by_phone_model.blank?
67
+ raise LoginRadius::Error.new, getValidationMessage('one_touch_login_by_phone_model')
68
+ end
69
+
70
+ query_parameters = {}
71
+ query_parameters['apiKey'] = @api_key
72
+ unless isNullOrWhiteSpace(sms_template)
73
+ query_parameters['smsTemplate'] = sms_template
74
+ end
75
+
76
+ resource_path = 'identity/v2/auth/onetouchlogin/phone'
77
+ post_request(resource_path, query_parameters, one_touch_login_by_phone_model)
78
+ end
79
+
80
+ # This API is used to verify the otp for One Touch Login.
81
+ #
82
+ # @param otp - The Verification Code
83
+ # @param phone - New Phone Number
84
+ # @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
85
+ # @param sms_template - SMS Template name
86
+ #
87
+ # @return Response Containing Access Token and Complete Profile Data
88
+ # 1.5
89
+ def one_touch_login_otp_verification(otp, phone, fields = '', sms_template = '')
90
+ if isNullOrWhiteSpace(otp)
91
+ raise LoginRadius::Error.new, getValidationMessage('otp')
92
+ end
93
+ if isNullOrWhiteSpace(phone)
94
+ raise LoginRadius::Error.new, getValidationMessage('phone')
95
+ end
96
+
97
+ query_parameters = {}
98
+ query_parameters['apiKey'] = @api_key
99
+ query_parameters['otp'] = otp
100
+ unless isNullOrWhiteSpace(fields)
101
+ query_parameters['fields'] = fields
102
+ end
103
+ unless isNullOrWhiteSpace(sms_template)
104
+ query_parameters['smsTemplate'] = sms_template
105
+ end
106
+
107
+ body_parameters = {}
108
+ body_parameters['phone'] = phone
109
+
110
+ resource_path = 'identity/v2/auth/onetouchlogin/phone/verify'
111
+ put_request(resource_path, query_parameters, body_parameters)
112
+ end
113
+
114
+ # This API verifies the provided token for One Touch Login
115
+ #
116
+ # @param verification_token - Verification token received in the email
117
+ # @param welcome_email_template - Name of the welcome email template
118
+ #
119
+ # @return Complete verified response data
120
+ # 8.4.2
121
+ def one_touch_email_verification(verification_token, welcome_email_template = '')
122
+ if isNullOrWhiteSpace(verification_token)
123
+ raise LoginRadius::Error.new, getValidationMessage('verification_token')
124
+ end
125
+
126
+ query_parameters = {}
127
+ query_parameters['apiKey'] = @api_key
128
+ query_parameters['verificationToken'] = verification_token
129
+ unless isNullOrWhiteSpace(welcome_email_template)
130
+ query_parameters['welcomeEmailTemplate'] = welcome_email_template
131
+ end
132
+
133
+ resource_path = 'identity/v2/auth/email/onetouchlogin'
134
+ get_request(resource_path, query_parameters, {})
135
+ end
136
+
137
+ # This API is used to check if the One Touch Login link has been clicked or not.
138
+ #
139
+ # @param client_guid - Unique string used in the Smart Login request
140
+ # @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
141
+ #
142
+ # @return Response containing User Profile Data and access token
143
+ # 9.21.2
144
+ def one_touch_login_ping(client_guid, fields = '')
145
+ if isNullOrWhiteSpace(client_guid)
146
+ raise LoginRadius::Error.new, getValidationMessage('client_guid')
147
+ end
148
+
149
+ query_parameters = {}
150
+ query_parameters['apiKey'] = @api_key
151
+ query_parameters['clientGuid'] = client_guid
152
+ unless isNullOrWhiteSpace(fields)
153
+ query_parameters['fields'] = fields
154
+ end
155
+
156
+ resource_path = 'identity/v2/auth/login/smartlogin/ping'
157
+ get_request(resource_path, query_parameters, {})
158
+ end
159
+ end
160
+ end