Class: EtCcdClient::IdamClient

Inherits:
Object
  • Object
show all
Includes:
CommonRestClient
Defined in:
lib/et_ccd_client/idam_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CommonRestClient

#get_request, #post_request

Constructor Details

#initialize(config: ::EtCcdClient.config) ⇒ IdamClient

Returns a new instance of IdamClient.



11
12
13
14
15
16
17
# File 'lib/et_ccd_client/idam_client.rb', line 11

def initialize(config: ::EtCcdClient.config)
  self.config = config
  self.logger = config.logger
  self.service_token = nil
  self.user_token = nil
  self.user_details = nil
end

Instance Attribute Details

#service_tokenObject

Returns the value of attribute service_token.



9
10
11
# File 'lib/et_ccd_client/idam_client.rb', line 9

def service_token
  @service_token
end

#user_detailsObject

Returns the value of attribute user_details.



9
10
11
# File 'lib/et_ccd_client/idam_client.rb', line 9

def user_details
  @user_details
end

#user_tokenObject

Returns the value of attribute user_token.



9
10
11
# File 'lib/et_ccd_client/idam_client.rb', line 9

def user_token
  @user_token
end

Instance Method Details

#login(username: config.sidam_username, password: config.sidam_password) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/et_ccd_client/idam_client.rb', line 19

def (username: config.sidam_username, password: config.sidam_password)
  logger.tagged('EtCcdClient::IdamClient') do
    self.service_token = exchange_service_token
    self.user_token = exchange_sidam_user_token(username, password)
    self.user_details = fetch_user_details
  end
end