Module: StandardSingpass::Myinfo::Noa
- Extended by:
- T::Sig
- Defined in:
- lib/standard_singpass/myinfo/noa.rb
Overview
Normalises Notice-of-Assessment data from PersonDataParser into a
single list, regardless of which NOA scope the Singpass app was approved
for.
Singpass approves NOA access at one of two widths, and the width is a property of the app registration, not of the request:
noa → Notice of Assessment, latest year only
noahistory → Notice of Assessment, last 2 years
PersonDataParser mirrors that faithfully, emitting :noa (one record)
or :noa_history (an array, one entry per assessment year). The two
records have an identical shape — year_of_assessment, amount,
employment, trade, rent, interest, tax_category — so every
consumer that renders NOA data ends up writing the same "array or wrap
the single record" branch. That branch is scope-grant knowledge, not
host policy, so it belongs here.
The -basic scopes (noa-basic / noahistory-basic) are the same
split at a narrower field set (year_of_assessment and amount only),
handled by .basic_history.
The wider grant is preferred when both keys are present: a 2-year history is a superset of the latest year, so returning it loses nothing.
Keys are looked up as both Symbol and String because parser output is symbol-keyed when fresh but string-keyed once it has round-tripped through JSON or a database column — which is where most hosts read it back from.
Class Method Summary collapse
Class Method Details
.basic_history(parsed) ⇒ Object
47 48 49 |
# File 'lib/standard_singpass/myinfo/noa.rb', line 47 def self.basic_history(parsed) normalize(parsed, history_key: :noa_history_basic, single_key: :noa_basic) end |
.history(parsed) ⇒ Object
41 42 43 |
# File 'lib/standard_singpass/myinfo/noa.rb', line 41 def self.history(parsed) normalize(parsed, history_key: :noa_history, single_key: :noa) end |