Class: EVSS::Letters::Letter
- Inherits:
-
Common::Base
- Object
- Common::Base
- EVSS::Letters::Letter
- Defined in:
- lib/evss/letters/letter.rb
Overview
Model for a letter
Constant Summary collapse
- LETTER_TYPES =
if you update LETTER_TYPES, update LETTER_TYPES in vets-website src/applications/letters/utils/constants.js
%w[ benefit_summary benefit_summary_dependent benefit_verification certificate_of_eligibility civil_service commissary medicare_partd minimum_essential_coverage proof_of_service service_verification ].freeze
Instance Attribute Summary collapse
-
#letter_type ⇒ String
The letter type (must be one of LETTER_TYPES).
-
#name ⇒ String
The letter name.
Attributes inherited from Common::Base
Instance Method Summary collapse
-
#initialize(args) ⇒ Letter
constructor
A new instance of Letter.
Methods inherited from Common::Base
#changed, #changed?, #changes, default_sort, filterable_attributes, max_per_page, per_page, sortable_attributes
Constructor Details
#initialize(args) ⇒ Letter
Returns a new instance of Letter.
35 36 37 38 39 40 41 42 |
# File 'lib/evss/letters/letter.rb', line 35 def initialize(args) raise ArgumentError, 'name and letter_type are required' if args.values.any?(&:nil?) unless LETTER_TYPES.include? args['letter_type'] raise ArgumentError, "invalid letter type: #{args['letter_type']}" end super({ name: args['letter_name'], letter_type: args['letter_type'] }) end |
Instance Attribute Details
#letter_type ⇒ String
Returns The letter type (must be one of LETTER_TYPES).
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 |
# File 'lib/evss/letters/letter.rb', line 17 class Letter < Common::Base # if you update LETTER_TYPES, update LETTER_TYPES in vets-website src/applications/letters/utils/constants.js LETTER_TYPES = %w[ benefit_summary benefit_summary_dependent benefit_verification certificate_of_eligibility civil_service commissary medicare_partd minimum_essential_coverage proof_of_service service_verification ].freeze attribute :name, String attribute :letter_type, String def initialize(args) raise ArgumentError, 'name and letter_type are required' if args.values.any?(&:nil?) unless LETTER_TYPES.include? args['letter_type'] raise ArgumentError, "invalid letter type: #{args['letter_type']}" end super({ name: args['letter_name'], letter_type: args['letter_type'] }) end end |
#name ⇒ String
Returns The letter name.
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 |
# File 'lib/evss/letters/letter.rb', line 17 class Letter < Common::Base # if you update LETTER_TYPES, update LETTER_TYPES in vets-website src/applications/letters/utils/constants.js LETTER_TYPES = %w[ benefit_summary benefit_summary_dependent benefit_verification certificate_of_eligibility civil_service commissary medicare_partd minimum_essential_coverage proof_of_service service_verification ].freeze attribute :name, String attribute :letter_type, String def initialize(args) raise ArgumentError, 'name and letter_type are required' if args.values.any?(&:nil?) unless LETTER_TYPES.include? args['letter_type'] raise ArgumentError, "invalid letter type: #{args['letter_type']}" end super({ name: args['letter_name'], letter_type: args['letter_type'] }) end end |