Class: LoginRadius::ConsentManagementApi
- Inherits:
-
Object
- Object
- LoginRadius::ConsentManagementApi
- Includes:
- RequestClient
- Defined in:
- lib/login_radius/api/advanced/consent_management_api.rb
Overview
ConsentManagementApi 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
-
#get_consent_logs(access_token) ⇒ Object
This API is used to fetch consent logs.
-
#get_consent_logs_by_uid(uid) ⇒ Object
This API is used to get the Consent logs of the user.
-
#initialize ⇒ ConsentManagementApi
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).
-
#submit_consent_by_access_token(access_token, consent_submit_model) ⇒ Object
API to provide a way to end user to submit a consent form for particular event type.
-
#submit_consent_by_consent_token(consent_token, consent_submit_model) ⇒ Object
This API is to submit consent form using consent token.
-
#update_consent_profile_by_access_token(access_token, consent_update_model) ⇒ Object
This API is to update consents using access token.
-
#verify_consent_by_access_token(access_token, event, is_custom) ⇒ Object
This API is used to check if consent is submitted for a particular event 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 ⇒ ConsentManagementApi
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/advanced/consent_management_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/advanced/consent_management_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/advanced/consent_management_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/advanced/consent_management_api.rb', line 12 def site_name @site_name end |
Instance Method Details
#get_consent_logs(access_token) ⇒ Object
This API is used to fetch consent logs.
43.2
76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/login_radius/api/advanced/consent_management_api.rb', line 76 def (access_token) if isNullOrWhiteSpace(access_token) raise LoginRadius::Error.new, getValidationMessage('access_token') end query_parameters = {} query_parameters['access_token'] = access_token query_parameters['apiKey'] = @api_key resource_path = 'identity/v2/auth/consent/logs' get_request(resource_path, query_parameters, {}) end |
#get_consent_logs_by_uid(uid) ⇒ Object
This API is used to get the Consent logs of the user.
18.37
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/login_radius/api/advanced/consent_management_api.rb', line 34 def (uid) if isNullOrWhiteSpace(uid) raise LoginRadius::Error.new, getValidationMessage('uid') end query_parameters = {} query_parameters['apiKey'] = @api_key query_parameters['apiSecret'] = @api_secret resource_path = 'identity/v2/manage/account/' + uid + '/consent/logs' get_request(resource_path, query_parameters, {}) end |
#submit_consent_by_access_token(access_token, consent_submit_model) ⇒ Object
API to provide a way to end user to submit a consent form for particular event type.
43.3
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/login_radius/api/advanced/consent_management_api.rb', line 96 def (access_token, ) if isNullOrWhiteSpace(access_token) raise LoginRadius::Error.new, getValidationMessage('access_token') end if .blank? raise LoginRadius::Error.new, getValidationMessage('consent_submit_model') end query_parameters = {} query_parameters['access_token'] = access_token query_parameters['apiKey'] = @api_key resource_path = 'identity/v2/auth/consent/profile' post_request(resource_path, query_parameters, ) end |
#submit_consent_by_consent_token(consent_token, consent_submit_model) ⇒ Object
This API is to submit consent form using consent token.
43.1
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/login_radius/api/advanced/consent_management_api.rb', line 54 def (, ) if isNullOrWhiteSpace() raise LoginRadius::Error.new, getValidationMessage('consent_token') end if .blank? raise LoginRadius::Error.new, getValidationMessage('consent_submit_model') end query_parameters = {} query_parameters['apiKey'] = @api_key query_parameters['consentToken'] = resource_path = 'identity/v2/auth/consent' post_request(resource_path, query_parameters, ) end |
#update_consent_profile_by_access_token(access_token, consent_update_model) ⇒ Object
This API is to update consents using access token.
43.5
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/login_radius/api/advanced/consent_management_api.rb', line 145 def (access_token, ) if isNullOrWhiteSpace(access_token) raise LoginRadius::Error.new, getValidationMessage('access_token') end if .blank? raise LoginRadius::Error.new, getValidationMessage('consent_update_model') end query_parameters = {} query_parameters['access_token'] = access_token query_parameters['apiKey'] = @api_key resource_path = 'identity/v2/auth/consent' put_request(resource_path, query_parameters, ) end |
#verify_consent_by_access_token(access_token, event, is_custom) ⇒ Object
This API is used to check if consent is submitted for a particular event or not.
43.4
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/login_radius/api/advanced/consent_management_api.rb', line 120 def (access_token, event, is_custom) if isNullOrWhiteSpace(access_token) raise LoginRadius::Error.new, getValidationMessage('access_token') end if isNullOrWhiteSpace(event) raise LoginRadius::Error.new, getValidationMessage('event') end query_parameters = {} query_parameters['access_token'] = access_token query_parameters['apiKey'] = @api_key query_parameters['event'] = event query_parameters['isCustom'] = is_custom resource_path = 'identity/v2/auth/consent/verify' get_request(resource_path, query_parameters, {}) end |