Class: MHV::AccountCreation::Configuration

Inherits:
Common::Client::Configuration::REST show all
Defined in:
lib/mhv/account_creation/configuration.rb

Instance Attribute Summary

Attributes inherited from Common::Client::Configuration::Base

#base_request_headers, #open_timeout, #read_timeout, #request_types, #user_agent

Instance Method Summary collapse

Methods inherited from Common::Client::Configuration::Base

#breakers_error_threshold, #breakers_exception_handler, #breakers_matcher, #breakers_service, #create_new_breakers_service, #current_module, #request_options, #service_exception

Instance Method Details

#access_keyObject



41
42
43
# File 'lib/mhv/account_creation/configuration.rb', line 41

def access_key
  Settings.mhv..access_key
end

#account_creation_pathObject



17
18
19
# File 'lib/mhv/account_creation/configuration.rb', line 17

def 
  'v1/usermgmt/account-service/account'
end

#base_pathObject



9
10
11
# File 'lib/mhv/account_creation/configuration.rb', line 9

def base_path
  Settings.mhv..host
end

#connectionObject



45
46
47
48
49
50
51
52
53
# File 'lib/mhv/account_creation/configuration.rb', line 45

def connection
  Faraday.new(base_path, headers: base_request_headers, request: request_options) do |conn|
    conn.use :breakers
    conn.use Faraday::Response::RaiseError
    conn.adapter Faraday.default_adapter
    conn.response :json
    conn.response :betamocks if Settings.mhv..mock
  end
end

#logging_prefixObject



21
22
23
# File 'lib/mhv/account_creation/configuration.rb', line 21

def logging_prefix
  '[MHV][AccountCreation][Service]'
end

#mhv_sts_settingsObject (private)



82
83
84
# File 'lib/mhv/account_creation/configuration.rb', line 82

def mhv_sts_settings
  Settings.mhv..sts
end

#service_nameObject



13
14
15
# File 'lib/mhv/account_creation/configuration.rb', line 13

def service_name
  'mhv_account_creation'
end

#sts_client(user_identifier) ⇒ Object (private)



67
68
69
70
71
72
73
74
75
76
# File 'lib/mhv/account_creation/configuration.rb', line 67

def sts_client(user_identifier)
  SignInService::Sts.new(
    service_account_id: mhv_sts_settings.,
    issuer: mhv_sts_settings.issuer,
    private_key_path: Settings..sts_client.key_path,
    scopes: sts_scopes,
    user_identifier:,
    user_attributes: { icn: user_identifier }
  )
end

#sts_scopesObject (private)



78
79
80
# File 'lib/mhv/account_creation/configuration.rb', line 78

def sts_scopes
  ["#{base_path}/#{}"]
end

#sts_token(user_identifier:) ⇒ Object



55
56
57
58
59
60
61
62
63
# File 'lib/mhv/account_creation/configuration.rb', line 55

def sts_token(user_identifier:)
  token = sts_client(user_identifier).token
  Rails.logger.info("#{logging_prefix} sts token request success", user_identifier:)
  token
rescue SignInService::Error => e
  error_message = e.message
  Rails.logger.error("#{logging_prefix} sts token request failed", user_identifier:, error_message:)
  raise Common::Client::Errors::ClientError, error_message
end

#tou_doc_titleObject



37
38
39
# File 'lib/mhv/account_creation/configuration.rb', line 37

def tou_doc_title
  'VA Enterprise Terms of Use'
end


33
34
35
# File 'lib/mhv/account_creation/configuration.rb', line 33

def tou_legal_version
  '1.0'
end

#tou_revisionObject



29
30
31
# File 'lib/mhv/account_creation/configuration.rb', line 29

def tou_revision
  '3'
end

#tou_statusObject



25
26
27
# File 'lib/mhv/account_creation/configuration.rb', line 25

def tou_status
  'accepted'
end