Class: VAProfile::Exceptions::Builder
- Inherits:
-
Object
- Object
- VAProfile::Exceptions::Builder
- Defined in:
- lib/va_profile/exceptions/builder.rb
Instance Attribute Summary collapse
-
#detail ⇒ Object
readonly
Returns the value of attribute detail.
-
#error_codes ⇒ Object
readonly
Returns the value of attribute error_codes.
-
#known_exceptions ⇒ Object
readonly
Returns the value of attribute known_exceptions.
-
#needs_detail ⇒ Object
readonly
Returns the value of attribute needs_detail.
-
#needs_title ⇒ Object
readonly
Returns the value of attribute needs_title.
-
#stats ⇒ Object
readonly
Returns the value of attribute stats.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#construct_exceptions_from_csv ⇒ Object
Takes the content from VAProfile’s CSV of current error codes, and converts them into formatted exceptions.
-
#initialize ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize ⇒ Builder
Returns a new instance of Builder.
12 13 14 15 16 17 18 |
# File 'lib/va_profile/exceptions/builder.rb', line 12 def initialize @known_exceptions = VAProfile::Exceptions::Parser.instance.known_exceptions @stats = initial_stats @error_codes = [] @needs_title = [] @needs_detail = [] end |
Instance Attribute Details
#detail ⇒ Object (readonly)
Returns the value of attribute detail.
10 11 12 |
# File 'lib/va_profile/exceptions/builder.rb', line 10 def detail @detail end |
#error_codes ⇒ Object (readonly)
Returns the value of attribute error_codes.
10 11 12 |
# File 'lib/va_profile/exceptions/builder.rb', line 10 def error_codes @error_codes end |
#known_exceptions ⇒ Object (readonly)
Returns the value of attribute known_exceptions.
10 11 12 |
# File 'lib/va_profile/exceptions/builder.rb', line 10 def known_exceptions @known_exceptions end |
#needs_detail ⇒ Object (readonly)
Returns the value of attribute needs_detail.
10 11 12 |
# File 'lib/va_profile/exceptions/builder.rb', line 10 def needs_detail @needs_detail end |
#needs_title ⇒ Object (readonly)
Returns the value of attribute needs_title.
10 11 12 |
# File 'lib/va_profile/exceptions/builder.rb', line 10 def needs_title @needs_title end |
#stats ⇒ Object (readonly)
Returns the value of attribute stats.
10 11 12 |
# File 'lib/va_profile/exceptions/builder.rb', line 10 def stats @stats end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
10 11 12 |
# File 'lib/va_profile/exceptions/builder.rb', line 10 def status @status end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
10 11 12 |
# File 'lib/va_profile/exceptions/builder.rb', line 10 def title @title end |
Instance Method Details
#construct_exceptions_from_csv ⇒ Object
Takes the content from VAProfile’s CSV of current error codes, and converts them into formatted exceptions. These exceptions temporarily live in tmp/test.yml, until a developer replaces the old VAProfile exceptions in config/locales/exceptions.en.yml with these updated ones.
A sample formatted exception in tmp/test.yml looks like this:
- VET360_ADDR101:
:<<: "*external_defaults"
title: Address Type Size
code: VET360_ADDR101
detail: Address type size must be between 0 and 35.
status: '400'
It also outputs to the console a breakdown of what was done, and what action needs to be taken by a developer. For example:
"Needs a title:"
["VET360_CORE108", "VET360_CORE301", "VET360_CORE503", ...]
"Needs detail:"
["VET360_CORE301"]
"Existing Codes: 94"
"New Codes: 74"
"Total Created: 168"
"Needs Title: 74"
"Needs Detail: 1"
47 48 49 50 51 52 |
# File 'lib/va_profile/exceptions/builder.rb', line 47 def construct_exceptions_from_csv build_formatted_exceptions include_custom_exceptions write_exceptions_to_yaml output_results_to_console end |