Class: VAProfileRedis::VeteranStatus

Inherits:
Common::RedisStore show all
Includes:
Common::CacheAside
Defined in:
app/models/va_profile_redis/veteran_status.rb

Constant Summary

Constants inherited from Common::RedisStore

Common::RedisStore::REQ_CLASS_INSTANCE_VARS

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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 Attribute Details

#userObject

Returns the value of attribute user.



14
15
16
# File 'app/models/va_profile_redis/veteran_status.rb', line 14

def user
  @user
end

Class Method Details

.for_user(user) ⇒ Object



16
17
18
19
20
21
22
# File 'app/models/va_profile_redis/veteran_status.rb', line 16

def self.for_user(user)
  veteran_status      = new
  veteran_status.user = user
  veteran_status.populate_from_redis

  veteran_status
end

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/va_profile_redis/veteran_status.rb', line 39

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

#populate_from_redisObject



53
54
55
# File 'app/models/va_profile_redis/veteran_status.rb', line 53

def populate_from_redis
  response_from_redis_or_service
end

#responseObject



49
50
51
# File 'app/models/va_profile_redis/veteran_status.rb', line 49

def response
  @response ||= response_from_redis_or_service
end

#statusObject



43
44
45
46
47
# File 'app/models/va_profile_redis/veteran_status.rb', line 43

def status
  return VAProfile::Response::RESPONSE_STATUS[:not_authorized] unless @user.loa3?

  response.status
end

#title38_statusObject



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

def title38_status
  return unless @user.loa3?

  value_for('title38_status_code')
end

#veteran?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'app/models/va_profile_redis/veteran_status.rb', line 24

def veteran?
  title38_status == 'V1'
end