-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create Mobile appeal model #18197
Create Mobile appeal model #18197
Changes from all commits
b0b359b
9842723
1995058
650ec15
26e52ca
b70f523
ffaaf1c
1cd78f5
9cfd14e
2e1959e
37ee255
a0195c6
c80dae6
8f1f8a1
96bc3f1
15db5da
6351c44
a9a4b98
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# frozen_string_literal: true | ||
|
||
module Mobile | ||
module V0 | ||
module Adapters | ||
class Appeal | ||
def parse(appeal) | ||
Mobile::V0::Appeals::Appeal.new( | ||
id: appeal[:id], | ||
appealIds: appeal[:appealIds], | ||
active: appeal[:active], | ||
alerts: appeal[:alerts], | ||
aod: appeal[:aod], | ||
aoj: appeal[:aoj], | ||
description: appeal[:description], | ||
docket: appeal[:docket], | ||
events: appeal[:events].map(&:deep_symbolize_keys), | ||
evidence: appeal[:evidence], | ||
incompleteHistory: appeal[:incompleteHistory], | ||
issues: appeal[:issues].map(&:deep_symbolize_keys), | ||
location: appeal[:location], | ||
programArea: appeal[:programArea], | ||
status: appeal[:status].deep_symbolize_keys, | ||
type: appeal[:type], | ||
updated: appeal[:updated] | ||
) | ||
end | ||
end | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'common/models/resource' | ||
|
||
module Mobile | ||
module V0 | ||
module Appeals | ||
class Appeal < Common::Resource | ||
AOJ_TYPES = Types::String.enum( | ||
'vba', | ||
'vha', | ||
'nca', | ||
'other' | ||
) | ||
|
||
LOCATION_TYPES = Types::String.enum( | ||
'aoj', | ||
'bva' | ||
) | ||
|
||
PROGRAM_AREA_TYPES = Types::String.enum( | ||
'compensation', | ||
'pension', | ||
'insurance', | ||
'loan_guaranty', | ||
'education', | ||
'vre', | ||
'medical', | ||
'burial', | ||
'bva', | ||
'other', | ||
'multiple' | ||
) | ||
|
||
ALERT_TYPES = Types::String.enum( | ||
'form9_needed', | ||
'scheduled_hearing', | ||
'hearing_no_show', | ||
'held_for_evidence', | ||
'cavc_option', | ||
'ramp_eligible', | ||
'ramp_ineligible', | ||
'decision_soon', | ||
'blocked_by_vso', | ||
'scheduled_dro_hearing', | ||
'dro_hearing_no_show' | ||
) | ||
|
||
EVENT_TYPES = Types::String.enum( | ||
'claim_decision', | ||
'nod', | ||
'soc', | ||
'form9', | ||
'ssoc', | ||
'certified', | ||
'hearing_held', | ||
'hearing_no_show', | ||
'bva_decision', | ||
'field_grant', | ||
'withdrawn', | ||
'ftr', | ||
'ramp', | ||
'death', | ||
'merged', | ||
'record_designation', | ||
'reconsideration', | ||
'vacated', | ||
'other_close', | ||
'cavc_decision', | ||
'ramp_notice', | ||
'transcript', | ||
'remand_return', | ||
'dro_hearing_held', | ||
'dro_hearing_cancelled', | ||
'dro_hearing_no_show' | ||
) | ||
|
||
LAST_ACTION_TYPES = Types::String.enum( | ||
'field_grant', | ||
'withdrawn', | ||
'allowed', | ||
'denied', | ||
'remand', | ||
'cavc_remand' | ||
) | ||
|
||
STATUS_TYPES = Types::String.enum( | ||
'scheduled_hearing', | ||
'pending_hearing_scheduling', | ||
'on_docket', | ||
'pending_certification_ssoc', | ||
'pending_certification', | ||
'pending_form9', | ||
'pending_soc', | ||
'stayed', | ||
'at_vso', | ||
'bva_development', | ||
'decision_in_progress', | ||
'bva_decision', | ||
'field_grant', | ||
'withdrawn', | ||
'ftr', | ||
'ramp', | ||
'death', | ||
'reconsideration', | ||
'other_close', | ||
'remand_ssoc', | ||
'remand', | ||
'merged' | ||
) | ||
|
||
attribute :id, Types::String | ||
attribute :appealIds, Types::Array.of(Types::String) | ||
attribute :active, Types::Bool | ||
attribute :alerts, Types::Array do | ||
attribute :type, ALERT_TYPES | ||
attribute :details, Types::Hash | ||
end | ||
attribute :aod, Types::Bool.optional | ||
attribute :aoj, AOJ_TYPES | ||
attribute :description, Types::String | ||
attribute :docket, Docket.optional | ||
attribute :events, Types::Array do | ||
attribute :type, EVENT_TYPES | ||
attribute :date, Types::Date | ||
end | ||
attribute :evidence, Types::Array.of(Evidence).optional | ||
attribute :incompleteHistory, Types::Bool | ||
attribute :issues, Types::Array do | ||
attribute :active, Types::Bool | ||
attribute :lastAction, LAST_ACTION_TYPES.optional | ||
attribute :description, Types::String | ||
attribute :diagnosticCode, Types::String.optional | ||
attribute :date, Types::Date | ||
end | ||
attribute :location, LOCATION_TYPES | ||
attribute :programArea, PROGRAM_AREA_TYPES | ||
attribute :status do | ||
attribute :type, STATUS_TYPES | ||
attribute :details, Types::Hash | ||
end | ||
attribute :type, Types::String | ||
attribute :updated, Types::DateTime | ||
end | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'common/models/resource' | ||
|
||
module Mobile | ||
module V0 | ||
module Appeals | ||
class Docket < Common::Resource | ||
attribute :type, Types::String | ||
attribute :month, Types::Date | ||
attribute :switchDueDate, Types::Date | ||
attribute :eligibleToSwitch, Types::Bool | ||
end | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'common/models/resource' | ||
|
||
module Mobile | ||
module V0 | ||
module Appeals | ||
class Evidence < Common::Resource | ||
attribute :description, Types::String | ||
attribute :date, Types::Date | ||
end | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
type: object | ||
properties: | ||
data: | ||
date: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo |
||
type: string | ||
type: | ||
type: string | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know we've been making an effort to not use request specs so much but it felt called for in this case since I wanted to make sure the response was identical to before the model was used. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also, when the flipper is removed, this will go back to being a basic request spec There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO this is a good use of request specs. You're only testing the happy/bad paths with the flag on and off. I think those are the correct cases. And I think we should probably always do a single happy path test of "expect the response data to match this exact data" because schema matchers aren't adequate. If you only test the matchers, there are cases where all the data could be nil because you made a mistake in the adapter and the matcher would still pass. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't depend on instance state (maybe move it to another class?) - UtilityFunction