Class: EMISRedis::VeteranStatus

Inherits:
Model show all
Defined in:
app/models/emis_redis/veteran_status.rb

Overview

EMIS veteran status service redis cached model. Much of this class depends on the Title 38 Status codes, which are:

V1 = Title 38 Veteran V2 = VA Beneficiary V3 = Military Person, not Title 38 Veteran, NOT DoD-Affiliated V4 = Non-military person V5 = EDI PI Not Found in VADIR (service response only not stored in table) V6 = Military Person, not Title 38 Veteran, DoD-Affiliated

Defined Under Namespace

Classes: NotAuthorized, RecordNotFound

Constant Summary collapse

CLASS_NAME =

Class name of the EMIS service used to fetch data

'VeteranStatusService'

Constants inherited from Common::RedisStore

Common::RedisStore::REQ_CLASS_INSTANCE_VARS

Instance Attribute Summary

Attributes inherited from Model

#user

Instance Method Summary collapse

Methods inherited from Model

for_user

Methods included from Common::CacheAside

#cache, #cached?, #do_cached_with

Methods inherited from Common::RedisStore

create, delete, #destroy, #destroyed?, exists?, #expire, find, find_or_build, #initialize, #initialize_dup, keys, #persisted?, pop, redis_key, redis_store, redis_ttl, #save, #save!, #ttl, #update, #update!

Constructor Details

This class inherits a constructor from Common::RedisStore

Instance Method Details

#military_person?Boolean

Returns boolean for user being/not being considered a military person, by eMIS, based on their Title 38 Status Code.

Returns:

  • (Boolean)


39
40
41
# File 'app/models/emis_redis/veteran_status.rb', line 39

def military_person?
  title38_status == 'V3' || title38_status == 'V6'
end

#title38_statusString

Returns Title 38 status code.

Returns:

  • (String)

    Title 38 status code



28
29
30
31
32
# File 'app/models/emis_redis/veteran_status.rb', line 28

def title38_status
  result = validated_response&.title38_status_code
  Rails.logger.info "EMIS title38: #{result}" if Settings.vsp_enironment == 'staging'
  result
end

#veteran?Boolean

Returns true if user is a title 38 veteran.

Returns:

  • (Boolean)

    true if user is a title 38 veteran



23
24
25
# File 'app/models/emis_redis/veteran_status.rb', line 23

def veteran?
  title38_status == 'V1'
end