Class: LoginRadius::OneTouchLoginApi
- Inherits:
-
Object
- Object
- LoginRadius::OneTouchLoginApi
- Includes:
- RequestClient
- Defined in:
- lib/login_radius/api/authentication/one_touch_login_api.rb
Overview
OneTouchLoginApi module
Constant Summary
Constants included from RequestClient
RequestClient::API_V2_BASE_URL, RequestClient::API_V2_BASE_URL_CONFIG, RequestClient::INIT_VECTOR, RequestClient::KEY_SIZE
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#api_secret ⇒ Object
Returns the value of attribute api_secret.
-
#site_name ⇒ Object
Returns the value of attribute site_name.
Instance Method Summary collapse
-
#initialize ⇒ OneTouchLoginApi
constructor
Initializes a LoginRadius Account object with an apikey and secret Takes in a hash containing site_name(required), api_key(required), api_secret(required).
-
#one_touch_email_verification(verification_token, welcome_email_template = '') ⇒ Object
This API verifies the provided token for One Touch Login.
-
#one_touch_login_by_email(one_touch_login_by_email_model, one_touch_login_email_template = '', redirecturl = '', welcomeemailtemplate = '') ⇒ Object
This API is used to send a link to a specified email for a frictionless login/registration.
-
#one_touch_login_by_phone(one_touch_login_by_phone_model, sms_template = '') ⇒ Object
This API is used to send one time password to a given phone number for a frictionless login/registration.
-
#one_touch_login_otp_verification(otp, phone, fields = '', sms_template = '') ⇒ Object
This API is used to verify the otp for One Touch Login.
-
#one_touch_login_ping(client_guid, fields = '') ⇒ Object
This API is used to check if the One Touch Login link has been clicked or not.
Methods included from RequestClient
#build_new_uri_obj, #create_hash_secret, #delete_request, #getValidationMessage, #get_request, #get_sott, #isNullOrWhiteSpace, #local_generate_sott, #post_request, #put_request
Constructor Details
#initialize ⇒ OneTouchLoginApi
Initializes a LoginRadius Account object with an apikey and secret Takes in a hash containing site_name(required), api_key(required), api_secret(required)
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/login_radius/api/authentication/one_touch_login_api.rb', line 16 def initialize @site_name = ENV['SITE_NAME'] @api_key = ENV['API_KEY'] @api_secret = ENV['API_SECRET'] raise LoginRadius::Error.new, "'site_name' is a required option for Account class initialization." \ unless @site_name != '' && @site_name != nil raise LoginRadius::Error.new, "'api_key' is a required option for Account class initialization." \ unless @api_key != '' && @api_key != nil raise LoginRadius::Error.new, "'api_secret is a required option for Account class initialization." \ unless @api_secret != '' && @api_secret != nil end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
12 13 14 |
# File 'lib/login_radius/api/authentication/one_touch_login_api.rb', line 12 def api_key @api_key end |
#api_secret ⇒ Object
Returns the value of attribute api_secret.
12 13 14 |
# File 'lib/login_radius/api/authentication/one_touch_login_api.rb', line 12 def api_secret @api_secret end |
#site_name ⇒ Object
Returns the value of attribute site_name.
12 13 14 |
# File 'lib/login_radius/api/authentication/one_touch_login_api.rb', line 12 def site_name @site_name end |
Instance Method Details
#one_touch_email_verification(verification_token, welcome_email_template = '') ⇒ Object
This API verifies the provided token for One Touch Login
8.4.2
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/login_radius/api/authentication/one_touch_login_api.rb', line 121 def one_touch_email_verification(verification_token, welcome_email_template = '') if isNullOrWhiteSpace(verification_token) raise LoginRadius::Error.new, getValidationMessage('verification_token') end query_parameters = {} query_parameters['apiKey'] = @api_key query_parameters['verificationToken'] = verification_token unless isNullOrWhiteSpace(welcome_email_template) query_parameters['welcomeEmailTemplate'] = welcome_email_template end resource_path = 'identity/v2/auth/email/onetouchlogin' get_request(resource_path, query_parameters, {}) end |
#one_touch_login_by_email(one_touch_login_by_email_model, one_touch_login_email_template = '', redirecturl = '', welcomeemailtemplate = '') ⇒ Object
This API is used to send a link to a specified email for a frictionless login/registration
1.2
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/login_radius/api/authentication/one_touch_login_api.rb', line 37 def one_touch_login_by_email(one_touch_login_by_email_model, one_touch_login_email_template = '', redirecturl = '', welcomeemailtemplate = '') if one_touch_login_by_email_model.blank? raise LoginRadius::Error.new, getValidationMessage('one_touch_login_by_email_model') end query_parameters = {} query_parameters['apiKey'] = @api_key unless isNullOrWhiteSpace(one_touch_login_email_template) query_parameters['oneTouchLoginEmailTemplate'] = one_touch_login_email_template end unless isNullOrWhiteSpace(redirecturl) query_parameters['redirecturl'] = redirecturl end unless isNullOrWhiteSpace(welcomeemailtemplate) query_parameters['welcomeemailtemplate'] = welcomeemailtemplate end resource_path = 'identity/v2/auth/onetouchlogin/email' post_request(resource_path, query_parameters, one_touch_login_by_email_model) end |
#one_touch_login_by_phone(one_touch_login_by_phone_model, sms_template = '') ⇒ Object
This API is used to send one time password to a given phone number for a frictionless login/registration.
1.4
65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/login_radius/api/authentication/one_touch_login_api.rb', line 65 def one_touch_login_by_phone(one_touch_login_by_phone_model, sms_template = '') if one_touch_login_by_phone_model.blank? raise LoginRadius::Error.new, getValidationMessage('one_touch_login_by_phone_model') end query_parameters = {} query_parameters['apiKey'] = @api_key unless isNullOrWhiteSpace(sms_template) query_parameters['smsTemplate'] = sms_template end resource_path = 'identity/v2/auth/onetouchlogin/phone' post_request(resource_path, query_parameters, one_touch_login_by_phone_model) end |
#one_touch_login_otp_verification(otp, phone, fields = '', sms_template = '') ⇒ Object
This API is used to verify the otp for One Touch Login.
1.5
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/login_radius/api/authentication/one_touch_login_api.rb', line 89 def one_touch_login_otp_verification(otp, phone, fields = '', sms_template = '') if isNullOrWhiteSpace(otp) raise LoginRadius::Error.new, getValidationMessage('otp') end if isNullOrWhiteSpace(phone) raise LoginRadius::Error.new, getValidationMessage('phone') end query_parameters = {} query_parameters['apiKey'] = @api_key query_parameters['otp'] = otp unless isNullOrWhiteSpace(fields) query_parameters['fields'] = fields end unless isNullOrWhiteSpace(sms_template) query_parameters['smsTemplate'] = sms_template end body_parameters = {} body_parameters['phone'] = phone resource_path = 'identity/v2/auth/onetouchlogin/phone/verify' put_request(resource_path, query_parameters, body_parameters) end |
#one_touch_login_ping(client_guid, fields = '') ⇒ Object
This API is used to check if the One Touch Login link has been clicked or not.
9.21.2
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/login_radius/api/authentication/one_touch_login_api.rb', line 144 def one_touch_login_ping(client_guid, fields = '') if isNullOrWhiteSpace(client_guid) raise LoginRadius::Error.new, getValidationMessage('client_guid') end query_parameters = {} query_parameters['apiKey'] = @api_key query_parameters['clientGuid'] = client_guid unless isNullOrWhiteSpace(fields) query_parameters['fields'] = fields end resource_path = 'identity/v2/auth/login/smartlogin/ping' get_request(resource_path, query_parameters, {}) end |