Class: VAProfile::VeteranStatus::Service
- Inherits:
-
Service
- Object
- Common::Client::Base
- Service
- VAProfile::VeteranStatus::Service
- Includes:
- Common::Client::Concerns::Monitoring
- Defined in:
- lib/va_profile/veteran_status/service.rb
Constant Summary collapse
- OID =
double check swagger
'2.16.840.1.113883.3.42.10001.100001.12'
- AAID =
double check swagger.
'^NI^200DOD^USDOD'
Constants inherited from Service
Instance Method Summary collapse
-
#get_veteran_status ⇒ VAProfile::VeteranStatus::VeteranStatusResponse
GET’s a user’s veteran status info from the VAProfile API If a user is not found in VAProfile, an empty VeteranStatusResponse with a 404 status will be returned.
-
#identity_path ⇒ Object
VA Profile endpoints use the OID (Organizational Identifier), the EDIPI, and the Assigning Authority ID to identify which person will be updated/retrieved.
-
#military_person? ⇒ Boolean
Returns boolean for user being/not being considered a military person based on their Title 38 Status Code.
-
#title38_status ⇒ String
Title 38 status code.
-
#veteran? ⇒ Boolean
True if user is a title 38 veteran.
Methods included from Common::Client::Concerns::Monitoring
Methods inherited from Service
breakers_service, #initialize, #perform
Methods inherited from Common::Client::Base
configuration, #raise_backend_exception
Methods included from SentryLogging
#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger
Constructor Details
This class inherits a constructor from VAProfile::Service
Instance Method Details
#get_veteran_status ⇒ VAProfile::VeteranStatus::VeteranStatusResponse
GET’s a user’s veteran status info from the VAProfile API If a user is not found in VAProfile, an empty VeteranStatusResponse with a 404 status will be returned
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/va_profile/veteran_status/service.rb', line 25 def get_veteran_status with_monitoring do edipi_present! response = perform(:post, identity_path, VAProfile::Models::VeteranStatus.in_json) VeteranStatusResponse.from(@current_user, response) end rescue Common::Client::Errors::ClientError => e handle_client_error(e) rescue => e handle_error(e) end |
#identity_path ⇒ Object
VA Profile endpoints use the OID (Organizational Identifier), the EDIPI, and the Assigning Authority ID to identify which person will be updated/retrieved.
60 61 62 |
# File 'lib/va_profile/veteran_status/service.rb', line 60 def identity_path "#{OID}/#{ERB::Util.url_encode(edipi_with_aaid.to_s)}" end |
#military_person? ⇒ Boolean
Returns boolean for user being/not being considered a military person based on their Title 38 Status Code.
54 55 56 |
# File 'lib/va_profile/veteran_status/service.rb', line 54 def military_person? title38_status == 'V3' || title38_status == 'V6' end |
#title38_status ⇒ String
Returns Title 38 status code.
43 44 45 46 47 |
# File 'lib/va_profile/veteran_status/service.rb', line 43 def title38_status result = get_veteran_status&.title38_status_code&.title38_status_code Rails.logger.info "VaProfile title38: #{result}" result end |
#veteran? ⇒ Boolean
Returns true if user is a title 38 veteran.
38 39 40 |
# File 'lib/va_profile/veteran_status/service.rb', line 38 def veteran? title38_status == 'V1' end |