laa-fee-calculator-client 0.2.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +56 -0
- data/README.md +12 -6
- data/bin/ruby_version_test +1 -1
- data/laa-fee-calculator-client.gemspec +13 -12
- data/lib/laa/fee_calculator.rb +1 -0
- data/lib/laa/fee_calculator/configuration.rb +3 -3
- data/lib/laa/fee_calculator/connection.rb +2 -1
- data/lib/laa/fee_calculator/errors.rb +1 -1
- data/lib/laa/fee_calculator/raise_error.rb +1 -1
- data/lib/laa/fee_calculator/version.rb +2 -2
- metadata +35 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28b49b8d4fa382b63ac223bc73b4fa26df867a8bdde1ccdc8a66095d496c64c1
|
4
|
+
data.tar.gz: 879657507b8a62e44507fe92b718134b839001507effcad82256844ffb108bd9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f11e00097f4679e9c843109c3f5a3170bc875f3e3d08248443db4645d139997523530415857e64552290eef575885d7925fa3a5c46d24d727a7139cc953a03b0
|
7
|
+
data.tar.gz: 6a4ddefcf31efee1a15fbd2855a87f0e4a810d4169025a84905199dbddc913545a3997e053b6bba5f24e6bb92e0718293ac7b1f968cb987c289a352688579382
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
Add latest change log entries at top using template:
|
4
|
+
|
5
|
+
```
|
6
|
+
## Version <version>
|
7
|
+
### Added
|
8
|
+
-
|
9
|
+
### Fixed
|
10
|
+
-
|
11
|
+
### Modified
|
12
|
+
-
|
13
|
+
### Removed
|
14
|
+
-
|
15
|
+
|
16
|
+
```
|
17
|
+
## Version 1.2.0
|
18
|
+
|
19
|
+
### Modified
|
20
|
+
- updated Faraday dependency
|
21
|
+
- updated development dependencies - rubocop, bundler
|
22
|
+
### Added
|
23
|
+
- support/testing for ruby 2.7.0
|
24
|
+
### Removed
|
25
|
+
- removed support for ruby 2.5
|
26
|
+
- removed testing against ruby versions less than 2.6
|
27
|
+
|
28
|
+
## Version 1.1.0
|
29
|
+
|
30
|
+
### Modified
|
31
|
+
- updated Faraday dependency
|
32
|
+
- Fixed deprecation warning resulting from `Faraday::Error::ClientError` being deprecated in favour of `Faraday::ClientError`
|
33
|
+
- updated development dependencies - rubocop, bundler
|
34
|
+
|
35
|
+
## Version 1.0.0
|
36
|
+
|
37
|
+
#### Note
|
38
|
+
The [API itself](https://laa-fee-calculator.service.justice.gov.uk/api/v1/docs) has changed datacenter and domain name. This version defaults to using the newly hosted API. The old API will no longer receive updates and should be considered deprecated. It will be removed entirely once traffic to it is near zero - please raise an [issue](https://github.com/ministryofjustice/laa-fee-calculator-client/issues) if this is problematic.
|
39
|
+
|
40
|
+
### Added
|
41
|
+
- support/testing for ruby 2.6.0, 2.6.2 and 2.6.3
|
42
|
+
### Removed
|
43
|
+
- removed support for ruby 2.4
|
44
|
+
- removed testing against ruby versions less than 2.5.5
|
45
|
+
### Modified
|
46
|
+
- default host to [https://laa-fee-calculator.service.justice.gov.uk/api/v1](https://laa-fee-calculator.service.justice.gov.uk/api/v1)
|
47
|
+
|
48
|
+
## Version 1.0.0.rc1
|
49
|
+
### Added
|
50
|
+
- support/testing for ruby 2.6.0, 2.6.2 and 2.6.3
|
51
|
+
### Removed
|
52
|
+
- removed support for ruby 2.4
|
53
|
+
- removed support/testing against ruby versions less than 2.5.5
|
54
|
+
### Modified
|
55
|
+
- default host to [https://laa-fee-calculator.service.justice.gov.uk/api/v1](https://laa-fee-calculator.service.justice.gov.uk/api/v1)
|
56
|
+
|
data/README.md
CHANGED
@@ -12,7 +12,7 @@ endpoints, providing a simple interface for querying data, in particular, the pr
|
|
12
12
|
Add this line to your application's Gemfile:
|
13
13
|
|
14
14
|
```ruby
|
15
|
-
gem 'laa-fee-calculator-client', '~>
|
15
|
+
gem 'laa-fee-calculator-client', '~> 1.2.0'
|
16
16
|
```
|
17
17
|
|
18
18
|
And then execute:
|
@@ -137,6 +137,8 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
137
137
|
|
138
138
|
The test suite makes extensive use of the [VCR](https://github.com/vcr/vcr) gem to stub requests to the external API. Any examples within a `describe` block with a `:vcr` tag will automatically use (or generate) VCR cassettes via an `around` block - see `spec_helper.rb`. All cassettes are stored in the `spec/vcr` directory and automatically named after the spec that produced them. Only new episodes/requests are created.
|
139
139
|
|
140
|
+
Note: VCR is configured to require a re-recording of cassettes once a year by default and will cause spec failures if this is not done. This can be disabled - see `spec_helper.rb` `re_record_interval`.
|
141
|
+
|
140
142
|
To recreate all cassettes:
|
141
143
|
|
142
144
|
- run the [laa-fee-calculator](https://github.com/ministryofjustice/laa-fee-calculator) API locally
|
@@ -153,13 +155,15 @@ $ VCR_OFF=true rspec
|
|
153
155
|
You can also test against a hosted API by modifying the following in the `spec_helper.rb`
|
154
156
|
|
155
157
|
```ruby
|
156
|
-
# run tests against
|
158
|
+
# run tests against the default remote host
|
157
159
|
LAA::FeeCalculator.configure do |config|
|
158
|
-
config.host = LAA::FeeCalculator::Configuration::
|
160
|
+
config.host = LAA::FeeCalculator::Configuration::LAA_FEE_CALCULATOR_API_V1
|
159
161
|
end
|
160
162
|
|
161
163
|
```
|
162
164
|
|
165
|
+
Note:
|
166
|
+
|
163
167
|
## Contributing
|
164
168
|
|
165
169
|
Bug reports and pull requests are welcome on GitHub at [ministryofjustice/laa-fee-calculator-client](https://github.com/ministryofjustice/laa-fee-calculator-client)
|
@@ -168,15 +172,17 @@ Bug reports and pull requests are welcome on GitHub at [ministryofjustice/laa-fe
|
|
168
172
|
|
169
173
|
1. Make required changes, run specs (rerecord vcr cassettes if necessary)
|
170
174
|
|
171
|
-
2. Run `bin/ruby_version_test` to test against ruby versions (2.
|
175
|
+
2. Run `bin/ruby_version_test` to test against ruby versions (2.6+ supported at present)
|
172
176
|
|
173
177
|
3. Update the VERSION in `lib/laa/fee_calculator/version` using [semantic versioning](https://guides.rubygems.org/patterns/#semantic-versioning).
|
174
178
|
|
175
179
|
4. Update the VERSION_RELEASED in `lib/laa/fee_calculator/version` to the date you intend to publish/release the version.
|
176
180
|
|
177
|
-
5.
|
181
|
+
5. Update the `CHANGELOG.md` - format/documentation standards specified at top of file.
|
182
|
+
|
183
|
+
6. PR the change, code-review, merge.
|
178
184
|
|
179
|
-
|
185
|
+
7. Pull master and run rake task below to publish
|
180
186
|
|
181
187
|
```bash
|
182
188
|
$ rake release
|
data/bin/ruby_version_test
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
set -e
|
4
4
|
|
5
|
-
rubies=("ruby-2.
|
5
|
+
rubies=("ruby-2.6.0" "ruby-2.6.1" "ruby-2.6.2" "ruby-2.6.3" "ruby-2.6.4" "ruby-2.6.5" "ruby-2.6.6" "ruby-2.7.0" "ruby-2.7.1" "ruby-2.7.2")
|
6
6
|
for i in "${rubies[@]}"
|
7
7
|
do
|
8
8
|
echo "====================================================="
|
@@ -7,8 +7,8 @@ require 'laa/fee_calculator/version'
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
8
|
spec.name = 'laa-fee-calculator-client'
|
9
9
|
spec.version = LAA::FeeCalculator::VERSION
|
10
|
-
spec.authors = ['
|
11
|
-
spec.email = ['joel.sugarman@digital.justice.gov.uk', 'tools@digital.justice.gov.uk']
|
10
|
+
spec.authors = ['Katharine Ahern', 'Ministry of Justice']
|
11
|
+
spec.email = ['katharine.ahern@digital.justice.gov.uk', 'joel.sugarman@digital.justice.gov.uk', 'tools@digital.justice.gov.uk']
|
12
12
|
spec.date = LAA::FeeCalculator::VERSION_RELEASED
|
13
13
|
spec.summary = 'Ruby client for the Legal Aid Agency fee calculator API'
|
14
14
|
spec.description = "Ruby client for the Ministry of Justices LAA fee calculator API. A simple interface for transparent calling of the API endpoints to query data and return calculated fee amounts."
|
@@ -24,17 +24,18 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.require_paths = ['lib']
|
25
25
|
|
26
26
|
# see bin/ruby_version_test
|
27
|
-
spec.required_ruby_version = '>= 2.
|
27
|
+
spec.required_ruby_version = '>= 2.6.0'
|
28
28
|
|
29
29
|
spec.add_runtime_dependency 'addressable', '~> 2.3', '>= 2.3.7'
|
30
|
-
spec.add_runtime_dependency 'faraday', '
|
30
|
+
spec.add_runtime_dependency 'faraday', '>= 0.9.2', '< 1.4.0'
|
31
31
|
|
32
|
-
spec.add_development_dependency
|
33
|
-
spec.add_development_dependency
|
34
|
-
spec.add_development_dependency
|
35
|
-
spec.add_development_dependency
|
36
|
-
spec.add_development_dependency
|
37
|
-
spec.add_development_dependency
|
38
|
-
spec.add_development_dependency
|
39
|
-
spec.add_development_dependency
|
32
|
+
spec.add_development_dependency 'awesome_print'
|
33
|
+
spec.add_development_dependency 'bundler', '~> 2.2.8'
|
34
|
+
spec.add_development_dependency 'pry-byebug'
|
35
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
36
|
+
spec.add_development_dependency 'rb-readline'
|
37
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
38
|
+
spec.add_development_dependency 'rubocop', '~> 0.78'
|
39
|
+
spec.add_development_dependency 'vcr'
|
40
|
+
spec.add_development_dependency 'webmock'
|
40
41
|
end
|
data/lib/laa/fee_calculator.rb
CHANGED
@@ -3,14 +3,14 @@
|
|
3
3
|
module LAA
|
4
4
|
module FeeCalculator
|
5
5
|
class Configuration
|
6
|
-
LAA_FEE_CALCULATOR_API_V1 = 'https://laa-fee-calculator
|
6
|
+
LAA_FEE_CALCULATOR_API_V1 = 'https://laa-fee-calculator.service.justice.gov.uk/api/v1'
|
7
7
|
HEADERS = { 'Accept' => 'application/json', 'User-Agent' => USER_AGENT }.freeze
|
8
8
|
|
9
9
|
attr_accessor :host, :headers
|
10
10
|
|
11
11
|
def initialize
|
12
|
-
@host
|
13
|
-
@headers
|
12
|
+
@host = host || LAA_FEE_CALCULATOR_API_V1
|
13
|
+
@headers = headers || HEADERS
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
@@ -10,12 +10,13 @@ module LAA
|
|
10
10
|
extend Forwardable
|
11
11
|
|
12
12
|
attr_reader :conn
|
13
|
+
|
13
14
|
def_delegators :conn, :port, :headers, :url_prefix, :options, :ssl, :get
|
14
15
|
|
15
16
|
def initialize
|
16
17
|
@conn = Faraday.new(url: LAA::FeeCalculator.configuration.host, headers: default_headers) do |conn|
|
17
18
|
conn.use LAA::FeeCalculator::RaiseError
|
18
|
-
conn.
|
19
|
+
conn.adapter :net_http
|
19
20
|
end
|
20
21
|
end
|
21
22
|
|
@@ -6,7 +6,7 @@ module LAA
|
|
6
6
|
|
7
7
|
# raised for failed response status between 400 and 599 and not handled
|
8
8
|
# by classes below
|
9
|
-
class ClientError < Faraday::
|
9
|
+
class ClientError < Faraday::ClientError
|
10
10
|
# overide the e.message attribute
|
11
11
|
# e.g. raise LAA::FeeCalculator::ResponseError.new(response)
|
12
12
|
# => #<LAA::FeeCalculator::ResponseError: "`case_date` should be in the format YYYY-MM-DD">
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: laa-fee-calculator-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Katharine Ahern
|
8
8
|
- Ministry of Justice
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-02-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: addressable
|
@@ -35,16 +35,22 @@ dependencies:
|
|
35
35
|
name: faraday
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.9.2
|
41
|
+
- - "<"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.4.0
|
41
44
|
type: :runtime
|
42
45
|
prerelease: false
|
43
46
|
version_requirements: !ruby/object:Gem::Requirement
|
44
47
|
requirements:
|
45
|
-
- - "
|
48
|
+
- - ">="
|
46
49
|
- !ruby/object:Gem::Version
|
47
50
|
version: 0.9.2
|
51
|
+
- - "<"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 1.4.0
|
48
54
|
- !ruby/object:Gem::Dependency
|
49
55
|
name: awesome_print
|
50
56
|
requirement: !ruby/object:Gem::Requirement
|
@@ -65,14 +71,14 @@ dependencies:
|
|
65
71
|
requirements:
|
66
72
|
- - "~>"
|
67
73
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
74
|
+
version: 2.2.8
|
69
75
|
type: :development
|
70
76
|
prerelease: false
|
71
77
|
version_requirements: !ruby/object:Gem::Requirement
|
72
78
|
requirements:
|
73
79
|
- - "~>"
|
74
80
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
81
|
+
version: 2.2.8
|
76
82
|
- !ruby/object:Gem::Dependency
|
77
83
|
name: pry-byebug
|
78
84
|
requirement: !ruby/object:Gem::Requirement
|
@@ -93,14 +99,28 @@ dependencies:
|
|
93
99
|
requirements:
|
94
100
|
- - "~>"
|
95
101
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
102
|
+
version: '13.0'
|
97
103
|
type: :development
|
98
104
|
prerelease: false
|
99
105
|
version_requirements: !ruby/object:Gem::Requirement
|
100
106
|
requirements:
|
101
107
|
- - "~>"
|
102
108
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
109
|
+
version: '13.0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: rb-readline
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
type: :development
|
118
|
+
prerelease: false
|
119
|
+
version_requirements: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
104
124
|
- !ruby/object:Gem::Dependency
|
105
125
|
name: rspec
|
106
126
|
requirement: !ruby/object:Gem::Requirement
|
@@ -121,14 +141,14 @@ dependencies:
|
|
121
141
|
requirements:
|
122
142
|
- - "~>"
|
123
143
|
- !ruby/object:Gem::Version
|
124
|
-
version: '0.
|
144
|
+
version: '0.78'
|
125
145
|
type: :development
|
126
146
|
prerelease: false
|
127
147
|
version_requirements: !ruby/object:Gem::Requirement
|
128
148
|
requirements:
|
129
149
|
- - "~>"
|
130
150
|
- !ruby/object:Gem::Version
|
131
|
-
version: '0.
|
151
|
+
version: '0.78'
|
132
152
|
- !ruby/object:Gem::Dependency
|
133
153
|
name: vcr
|
134
154
|
requirement: !ruby/object:Gem::Requirement
|
@@ -161,6 +181,7 @@ description: Ruby client for the Ministry of Justices LAA fee calculator API. A
|
|
161
181
|
interface for transparent calling of the API endpoints to query data and return
|
162
182
|
calculated fee amounts.
|
163
183
|
email:
|
184
|
+
- katharine.ahern@digital.justice.gov.uk
|
164
185
|
- joel.sugarman@digital.justice.gov.uk
|
165
186
|
- tools@digital.justice.gov.uk
|
166
187
|
executables: []
|
@@ -169,6 +190,7 @@ extra_rdoc_files:
|
|
169
190
|
- LICENSE
|
170
191
|
- README.md
|
171
192
|
files:
|
193
|
+
- CHANGELOG.md
|
172
194
|
- Gemfile
|
173
195
|
- LICENSE
|
174
196
|
- README.md
|
@@ -200,15 +222,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
200
222
|
requirements:
|
201
223
|
- - ">="
|
202
224
|
- !ruby/object:Gem::Version
|
203
|
-
version: 2.
|
225
|
+
version: 2.6.0
|
204
226
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
205
227
|
requirements:
|
206
228
|
- - ">="
|
207
229
|
- !ruby/object:Gem::Version
|
208
230
|
version: '0'
|
209
231
|
requirements: []
|
210
|
-
|
211
|
-
rubygems_version: 2.7.6
|
232
|
+
rubygems_version: 3.1.4
|
212
233
|
signing_key:
|
213
234
|
specification_version: 4
|
214
235
|
summary: Ruby client for the Legal Aid Agency fee calculator API
|