class AuthenticationService
Public Class Methods
create_auth_data()
click to toggle source
to remove once tested
# File lib/shilpa20/authentication_service.rb, line 37 def self.create_auth_data auth = Authentication.new auth.grant_type = "password" # auth.client_id = "277ef29692f9a70d511415dc60592daf4cf2c6f6552d3e1b769924b2f2e2e6fe" #auth.client_secret = "d6106f26e8ff5b749a606a1fba557f44eb3dca8f48596847770beb9b643ea352" auth.username = "sachinmurthy56@gmail.com" auth.password = "password" return auth end
create_authentication(auth_data)
click to toggle source
# File lib/shilpa20/authentication_service.rb, line 10 def self.create_authentication(auth_data) auth_data = get_auth_with_client_info(auth_data) auth_payload = Authentication.get_payload(auth_data) return RestClient::Request.execute(method: :post, url: @@authentication_url, payload: auth_payload, headers: {'Content-Type': 'application/json'}) end
get_access_token()
click to toggle source
remove once tested
# File lib/shilpa20/authentication_service.rb, line 58 def self.get_access_token auth_data = AuthenticationService.create_auth_data authJson = AuthenticationService.create_authentication(auth_data) res_data = JSON.parse(authJson) access_token = res_data['data']['token']['access_token'] return access_token end
get_auth_with_client_info(auth_data)
click to toggle source
# File lib/shilpa20/authentication_service.rb, line 30 def self.get_auth_with_client_info(auth_data) auth_data.client_id = ApplicationConfig.get_client_id auth_data.client_secret = ApplicationConfig.get_client_secret return auth_data end
refresh_authentication_token(auth_data, bearer_token)
click to toggle source
# File lib/shilpa20/authentication_service.rb, line 17 def self.refresh_authentication_token(auth_data, bearer_token) auth_data = get_auth_with_client_info(auth_data) auth_payload = Authentication.get_payload(auth_data) return RestClient::Request.execute(method: :post, url: @@authentication_url, payload: auth_payload, headers: {'Content-Type': 'application/json', 'Authorization': bearer_token}) end
revoke_authentication_token(auth_data, bearer_token)
click to toggle source
# File lib/shilpa20/authentication_service.rb, line 24 def self.revoke_authentication_token(auth_data, bearer_token) auth_payload = Authentication.get_payload(auth_data) return RestClient::Request.execute(method: :post, url: @@revoke_url, payload: auth_payload, headers: {'Content-Type': 'application/json', 'Authorization': bearer_token}) end