Class: Preneeds::ServiceRecord
- Defined in:
- app/models/preneeds/service_record.rb
Overview
Models service record information for a BurialForm form
Instance Attribute Summary collapse
-
#date_range ⇒ Preneeds::DateRange
Service date range.
- #discharge_type ⇒ Object
-
#highest_rank ⇒ String
Highest rank achieved.
-
#national_guard_state ⇒ String
State - for national guard service only.
- #service_branch ⇒ Object
Class Method Summary collapse
-
.permitted_params ⇒ Array
List of permitted params for use with Strong Parameters.
Instance Method Summary collapse
-
#as_eoas ⇒ Hash
Converts object attributes to a hash to be used when constructing a SOAP request body.
Methods inherited from Base
Methods included from Vets::Model
#attributes, #initialize, #nested_attributes
Methods included from Vets::Attributes
Instance Attribute Details
#date_range ⇒ Preneeds::DateRange
Returns service date range.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/models/preneeds/service_record.rb', line 17 class ServiceRecord < Preneeds::Base attribute :service_branch, String attribute :discharge_type, String attribute :highest_rank, String attribute :national_guard_state, String attribute :date_range, Preneeds::DateRange # (see Preneeds::BurialForm#as_eoas) # def as_eoas hash = { branchOfService: service_branch, dischargeType: discharge_type, enteredOnDutyDate: date_range.try(:from), highestRank: highest_rank, nationalGuardState: national_guard_state, releaseFromDutyDate: date_range.try(:to) } %i[ enteredOnDutyDate releaseFromDutyDate highestRank nationalGuardState dischargeType ].each do |key| hash.delete(key) if hash[key].blank? end hash end # (see Preneeds::Applicant.permitted_params) # def self.permitted_params [ :service_branch, :discharge_type, :highest_rank, :national_guard_state, { date_range: Preneeds::DateRange.permitted_params } ] end end |
#discharge_type ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/models/preneeds/service_record.rb', line 17 class ServiceRecord < Preneeds::Base attribute :service_branch, String attribute :discharge_type, String attribute :highest_rank, String attribute :national_guard_state, String attribute :date_range, Preneeds::DateRange # (see Preneeds::BurialForm#as_eoas) # def as_eoas hash = { branchOfService: service_branch, dischargeType: discharge_type, enteredOnDutyDate: date_range.try(:from), highestRank: highest_rank, nationalGuardState: national_guard_state, releaseFromDutyDate: date_range.try(:to) } %i[ enteredOnDutyDate releaseFromDutyDate highestRank nationalGuardState dischargeType ].each do |key| hash.delete(key) if hash[key].blank? end hash end # (see Preneeds::Applicant.permitted_params) # def self.permitted_params [ :service_branch, :discharge_type, :highest_rank, :national_guard_state, { date_range: Preneeds::DateRange.permitted_params } ] end end |
#highest_rank ⇒ String
Returns highest rank achieved.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/models/preneeds/service_record.rb', line 17 class ServiceRecord < Preneeds::Base attribute :service_branch, String attribute :discharge_type, String attribute :highest_rank, String attribute :national_guard_state, String attribute :date_range, Preneeds::DateRange # (see Preneeds::BurialForm#as_eoas) # def as_eoas hash = { branchOfService: service_branch, dischargeType: discharge_type, enteredOnDutyDate: date_range.try(:from), highestRank: highest_rank, nationalGuardState: national_guard_state, releaseFromDutyDate: date_range.try(:to) } %i[ enteredOnDutyDate releaseFromDutyDate highestRank nationalGuardState dischargeType ].each do |key| hash.delete(key) if hash[key].blank? end hash end # (see Preneeds::Applicant.permitted_params) # def self.permitted_params [ :service_branch, :discharge_type, :highest_rank, :national_guard_state, { date_range: Preneeds::DateRange.permitted_params } ] end end |
#national_guard_state ⇒ String
Returns state - for national guard service only.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/models/preneeds/service_record.rb', line 17 class ServiceRecord < Preneeds::Base attribute :service_branch, String attribute :discharge_type, String attribute :highest_rank, String attribute :national_guard_state, String attribute :date_range, Preneeds::DateRange # (see Preneeds::BurialForm#as_eoas) # def as_eoas hash = { branchOfService: service_branch, dischargeType: discharge_type, enteredOnDutyDate: date_range.try(:from), highestRank: highest_rank, nationalGuardState: national_guard_state, releaseFromDutyDate: date_range.try(:to) } %i[ enteredOnDutyDate releaseFromDutyDate highestRank nationalGuardState dischargeType ].each do |key| hash.delete(key) if hash[key].blank? end hash end # (see Preneeds::Applicant.permitted_params) # def self.permitted_params [ :service_branch, :discharge_type, :highest_rank, :national_guard_state, { date_range: Preneeds::DateRange.permitted_params } ] end end |
#service_branch ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/models/preneeds/service_record.rb', line 17 class ServiceRecord < Preneeds::Base attribute :service_branch, String attribute :discharge_type, String attribute :highest_rank, String attribute :national_guard_state, String attribute :date_range, Preneeds::DateRange # (see Preneeds::BurialForm#as_eoas) # def as_eoas hash = { branchOfService: service_branch, dischargeType: discharge_type, enteredOnDutyDate: date_range.try(:from), highestRank: highest_rank, nationalGuardState: national_guard_state, releaseFromDutyDate: date_range.try(:to) } %i[ enteredOnDutyDate releaseFromDutyDate highestRank nationalGuardState dischargeType ].each do |key| hash.delete(key) if hash[key].blank? end hash end # (see Preneeds::Applicant.permitted_params) # def self.permitted_params [ :service_branch, :discharge_type, :highest_rank, :national_guard_state, { date_range: Preneeds::DateRange.permitted_params } ] end end |
Class Method Details
.permitted_params ⇒ Array
List of permitted params for use with Strong Parameters
45 46 47 48 49 50 |
# File 'app/models/preneeds/service_record.rb', line 45 def self.permitted_params [ :service_branch, :discharge_type, :highest_rank, :national_guard_state, { date_range: Preneeds::DateRange.permitted_params } ] end |
Instance Method Details
#as_eoas ⇒ Hash
Converts object attributes to a hash to be used when constructing a SOAP request body. Hash attributes must correspond to XSD ordering or API call will fail
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/models/preneeds/service_record.rb', line 27 def as_eoas hash = { branchOfService: service_branch, dischargeType: discharge_type, enteredOnDutyDate: date_range.try(:from), highestRank: highest_rank, nationalGuardState: national_guard_state, releaseFromDutyDate: date_range.try(:to) } %i[ enteredOnDutyDate releaseFromDutyDate highestRank nationalGuardState dischargeType ].each do |key| hash.delete(key) if hash[key].blank? end hash end |