glimr-api-client 0.1.11 → 0.1.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b660ea3d34bcf9f237a01cb8e3f6d8c480e70af6
4
- data.tar.gz: 95f00b2723dfae4ae96bbba8a6e89e8c92ab9d6d
3
+ metadata.gz: 6cbd60fb640a1ffbeae5e9bb2b4e886a9013095a
4
+ data.tar.gz: 932ef88b4ea067de7969970e9ba2f71142a8c339
5
5
  SHA512:
6
- metadata.gz: 32ffc15aa4ec65672fbfee9437e8a266b67a46b9551d76109e5c8fd02fe231dea71958a9ff2a4090491adfb18d254a4448efc54a05954e743a679639ec91562e
7
- data.tar.gz: 12e813eb6878271af81521e7f656c6d54eb6996354d81befd04b40d275a8b8b7a2890209cbca1056e0749825579d279b7a720ecd48fdac9261cc72cca975dc66
6
+ metadata.gz: 22d04e89360d24aa9a537ef7a8bbe26772b31f915fc3b794935932316e14b90fdb77f2ef565571a1a503a1f4b7373485cce689134a81f3936bfae4ad82b7a043
7
+ data.tar.gz: 033de5166aaf1c4f2bb39ad393a40e9e2799bca4edde1ef1c0f0c08915c7aeaa4c4df3b722017e56b1a4338c8ef2080bb9a71520621c4d0c30d0d2fe62f2eb2e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- glimr-api-client (0.1.11)
4
+ glimr-api-client (0.1.13)
5
5
  excon (~> 0.51)
6
6
 
7
7
  GEM
@@ -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 (!endpoint.eql?('/paymenttaken') && resp.status.equal?(404))
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
- @title ||= response_body.fetch(:caseTitle)
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).blank?
12
+ errors << required if request_body.fetch(required).nil?
13
13
  end
14
- raise RequestError, errors unless errors.blank?
14
+ raise RequestError, errors unless errors.empty?
15
15
  end
16
16
 
17
17
  def endpoint
@@ -1,3 +1,3 @@
1
1
  module GlimrApiClient
2
- VERSION = '0.1.11'
2
+ VERSION = '0.1.13'
3
3
  end
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.11
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-01 00:00:00.000000000 Z
11
+ date: 2016-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler