glimr-api-client 0.1.11 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/glimr_api_client/api.rb +2 -2
- data/lib/glimr_api_client/case.rb +15 -2
- data/lib/glimr_api_client/update.rb +2 -2
- data/lib/glimr_api_client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6cbd60fb640a1ffbeae5e9bb2b4e886a9013095a
|
4
|
+
data.tar.gz: 932ef88b4ea067de7969970e9ba2f71142a8c339
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22d04e89360d24aa9a537ef7a8bbe26772b31f915fc3b794935932316e14b90fdb77f2ef565571a1a503a1f4b7373485cce689134a81f3936bfae4ad82b7a043
|
7
|
+
data.tar.gz: 033de5166aaf1c4f2bb39ad393a40e9e2799bca4edde1ef1c0f0c08915c7aeaa4c4df3b722017e56b1a4338c8ef2080bb9a71520621c4d0c30d0d2fe62f2eb2e
|
data/Gemfile.lock
CHANGED
data/lib/glimr_api_client/api.rb
CHANGED
@@ -4,7 +4,6 @@ module GlimrApiClient
|
|
4
4
|
module Api
|
5
5
|
def post
|
6
6
|
client("#{api_url}#{endpoint}").post(body: request_body.to_json).tap { |resp|
|
7
|
-
# Only timeouts and network issues raise errors.
|
8
7
|
handle_response_errors(resp)
|
9
8
|
@body = resp.body
|
10
9
|
}
|
@@ -26,8 +25,9 @@ module GlimrApiClient
|
|
26
25
|
'https://glimr-api.taxtribunals.dsd.io/Live_API/api/tdsapi')
|
27
26
|
end
|
28
27
|
|
28
|
+
# Only timeouts and network issues raise errors.
|
29
29
|
def handle_response_errors(resp)
|
30
|
-
if
|
30
|
+
if resp.status.equal?(404) && endpoint.eql?('/requestpayablecasefees')
|
31
31
|
raise CaseNotFound, resp.status
|
32
32
|
elsif (400..599).cover?(resp.status)
|
33
33
|
re_raise_error(endpoint, resp.status)
|
@@ -19,7 +19,19 @@ module GlimrApiClient
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def title
|
22
|
-
|
22
|
+
# This should be;
|
23
|
+
#
|
24
|
+
# @title ||= response_body.fetch(:caseTitle)
|
25
|
+
#
|
26
|
+
# But, a change in the Glimr API means that the title is
|
27
|
+
# currently being returned with each fee liability. So,
|
28
|
+
# for the time being, we will fetch it from there.
|
29
|
+
# I'm leaving the "Missing Title" text so that nobody forgets
|
30
|
+
# that this needs to be fixed, preferably by changing the
|
31
|
+
# Glimr RequestPayableCaseFees API call back to returning
|
32
|
+
# caseTitle at the top-level of the response data.
|
33
|
+
|
34
|
+
@title ||= fees.any? ? fees.first.case_title : "Missing Title"
|
23
35
|
end
|
24
36
|
|
25
37
|
def fees
|
@@ -27,7 +39,8 @@ module GlimrApiClient
|
|
27
39
|
OpenStruct.new(
|
28
40
|
glimr_id: Integer(fee.fetch(:feeLiabilityId)),
|
29
41
|
description: fee.fetch(:onlineFeeTypeDescription),
|
30
|
-
amount: Integer(fee.fetch(:payableWithUnclearedInPence))
|
42
|
+
amount: Integer(fee.fetch(:payableWithUnclearedInPence)),
|
43
|
+
case_title: fee.fetch(:caseTitle)
|
31
44
|
)
|
32
45
|
end
|
33
46
|
end
|
@@ -9,9 +9,9 @@ module GlimrApiClient
|
|
9
9
|
def check_request!
|
10
10
|
errors = []
|
11
11
|
[:feeLiabilityId, :paymentReference, :govpayReference, :paidAmountInPence].each do |required|
|
12
|
-
errors << required if request_body.fetch(required).
|
12
|
+
errors << required if request_body.fetch(required).nil?
|
13
13
|
end
|
14
|
-
raise RequestError, errors unless errors.
|
14
|
+
raise RequestError, errors unless errors.empty?
|
15
15
|
end
|
16
16
|
|
17
17
|
def endpoint
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimr-api-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Todd Tyree
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|