Class: GlimrApiClient::FindCase
- Defined in:
- lib/glimr_api_client/find_case.rb
Overview
TODO: rename so it follow api spec
Defined Under Namespace
Classes: InvalidCaseNumber, NotFound
Constant Summary collapse
- TRIBUNAL_JURISDICTION_ID =
8
Instance Attribute Summary
Attributes inherited from Base
Attributes included from Api
Class Method Summary collapse
-
.find(case_reference, confirmation_code) ⇒ Object
TODO: Case should use ‘#call(params)` directly, like everything else.
Instance Method Summary collapse
- #call ⇒ Object
-
#fees ⇒ Object
We only care about outstanding fee liabilities, wrt what we are asking the taxpayer to pay.
-
#initialize(case_reference, confirmation_code) ⇒ FindCase
constructor
A new instance of FindCase.
-
#title ⇒ Object
Case title is returned with each fee liability, rather than as a top-level attribute of the case.
Methods inherited from Base
Methods included from Api
Constructor Details
#initialize(case_reference, confirmation_code) ⇒ FindCase
Returns a new instance of FindCase.
14 15 16 17 |
# File 'lib/glimr_api_client/find_case.rb', line 14 def initialize(case_reference, confirmation_code) @case_reference = case_reference @confirmation_code = confirmation_code end |
Class Method Details
.find(case_reference, confirmation_code) ⇒ Object
TODO: Case should use ‘#call(params)` directly, like everything else.
10 11 12 |
# File 'lib/glimr_api_client/find_case.rb', line 10 def self.find(case_reference, confirmation_code) new(case_reference, confirmation_code).call end |
Instance Method Details
#call ⇒ Object
19 20 21 22 |
# File 'lib/glimr_api_client/find_case.rb', line 19 def call post self end |
#fees ⇒ Object
We only care about outstanding fee liabilities, wrt what we are asking the taxpayer to pay
37 38 39 |
# File 'lib/glimr_api_client/find_case.rb', line 37 def fees unpaid_fees end |
#title ⇒ Object
Case title is returned with each fee liability, rather than as a top-level attribute of the case. If there are any unpaid fee liabilities, we want to take the title from the first of these (because that is the most relevant title)
28 29 30 31 32 33 |
# File 'lib/glimr_api_client/find_case.rb', line 28 def title @title ||= begin fee = unpaid_fees.any? ? unpaid_fees.first : all_fees.first fee.nil? ? 'Missing Title' : fee.case_title end end |