Class: MlaActiveDutyStatus::Applicant
- Inherits:
-
Object
- Object
- MlaActiveDutyStatus::Applicant
- Includes:
- SemanticLogger::Loggable
- Defined in:
- lib/mla_active_duty_status/applicant.rb
Instance Attribute Summary collapse
-
#date_of_birth ⇒ Object
readonly
Returns the value of attribute date_of_birth.
-
#date_of_birth_usa ⇒ Object
readonly
Returns the value of attribute date_of_birth_usa.
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#first_name ⇒ Object
readonly
Returns the value of attribute first_name.
-
#last_name ⇒ Object
readonly
Returns the value of attribute last_name.
-
#middle_name ⇒ Object
readonly
Returns the value of attribute middle_name.
-
#ssn ⇒ Object
readonly
Returns the value of attribute ssn.
Instance Method Summary collapse
- #active_duty_status ⇒ Object
- #file_format ⇒ Object
-
#initialize(last_name, first_name, middle_name, ssn, date_of_birth) ⇒ Applicant
constructor
A new instance of Applicant.
- #valid? ⇒ Boolean
Constructor Details
#initialize(last_name, first_name, middle_name, ssn, date_of_birth) ⇒ Applicant
Returns a new instance of Applicant.
12 13 14 15 16 17 18 19 20 |
# File 'lib/mla_active_duty_status/applicant.rb', line 12 def initialize(last_name, first_name, middle_name, ssn, date_of_birth) @last_name = last_name.to_s.strip @first_name = first_name.to_s.strip @middle_name = middle_name.to_s.strip @ssn = ssn.to_s.strip.gsub(/\D/, '') @date_of_birth = date_of_birth @date_of_birth_usa = nil @errors = [] end |
Instance Attribute Details
#date_of_birth ⇒ Object (readonly)
Returns the value of attribute date_of_birth.
10 11 12 |
# File 'lib/mla_active_duty_status/applicant.rb', line 10 def date_of_birth @date_of_birth end |
#date_of_birth_usa ⇒ Object (readonly)
Returns the value of attribute date_of_birth_usa.
10 11 12 |
# File 'lib/mla_active_duty_status/applicant.rb', line 10 def date_of_birth_usa @date_of_birth_usa end |
#errors ⇒ Object
Returns the value of attribute errors.
8 9 10 |
# File 'lib/mla_active_duty_status/applicant.rb', line 8 def errors @errors end |
#first_name ⇒ Object (readonly)
Returns the value of attribute first_name.
10 11 12 |
# File 'lib/mla_active_duty_status/applicant.rb', line 10 def first_name @first_name end |
#last_name ⇒ Object (readonly)
Returns the value of attribute last_name.
10 11 12 |
# File 'lib/mla_active_duty_status/applicant.rb', line 10 def last_name @last_name end |
#middle_name ⇒ Object (readonly)
Returns the value of attribute middle_name.
10 11 12 |
# File 'lib/mla_active_duty_status/applicant.rb', line 10 def middle_name @middle_name end |
#ssn ⇒ Object (readonly)
Returns the value of attribute ssn.
10 11 12 |
# File 'lib/mla_active_duty_status/applicant.rb', line 10 def ssn @ssn end |
Instance Method Details
#active_duty_status ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/mla_active_duty_status/applicant.rb', line 27 def active_duty_status logger.measure_info '#mla_active_duty_status', metric: 'supplier/mla/active_duty_status' do if !self.valid? return status = MLA_INVALID, pdf = nil exit end status, pdf = MlaActiveDutyStatus::Client.call_mla_site(self) end rescue Timeout::Error return status = MLA_ERROR, pdf = nil end |
#file_format ⇒ Object
39 40 41 |
# File 'lib/mla_active_duty_status/applicant.rb', line 39 def file_format sprintf('%9s', @ssn) + @date_of_birth.strftime('%Y%m%d') + sprintf('%-26.26s', @last_name) + sprintf('%-20.20s', @first_name) + sprintf('%-20.20s', @middle_name) + sprintf('%-28.28s', '') end |
#valid? ⇒ Boolean
22 23 24 25 |
# File 'lib/mla_active_duty_status/applicant.rb', line 22 def valid? validate_args errors.empty? end |