laa-fee-calculator-client 0.1.3 → 0.2.0
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/README.md +11 -3
- data/laa-fee-calculator-client.gemspec +1 -1
- data/lib/laa/fee_calculator/client.rb +1 -0
- data/lib/laa/fee_calculator/has_manyable.rb +10 -1
- data/lib/laa/fee_calculator/version.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3da85f79e91ae96f2fba3ff03befa81ae2341d56559d5de095fadef63af6d118
|
4
|
+
data.tar.gz: dd17564a3375b73ea9fc5a8c846f2a41eb27db1ca821df9be10cf2fab9b6e138
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 429ff6ad54a273c293102978e6f041e672ad6b9c883338ae2be5eb0ad0d57023bfa5eb200bd0301f8b8a9f63590b8ee181f014054d353736fb6da76558cfaf0f
|
7
|
+
data.tar.gz: b44b780ab5cb138df048aa012d66001d9cf9f7253cef1cfd59d8d4181d73683b5d24e0ff6f23dd08fa7dd0ae59cdafd2a9179757fa29f0d90329844658acb2f3
|
data/README.md
CHANGED
@@ -96,6 +96,7 @@ fee_scheme.offence_classes
|
|
96
96
|
fee_scheme.fee_types
|
97
97
|
fee_scheme.modifier_types
|
98
98
|
fee_scheme.units
|
99
|
+
fee_scheme.prices # defaults to first page (of 100)
|
99
100
|
|
100
101
|
# filtered
|
101
102
|
# by id
|
@@ -104,6 +105,11 @@ fee_scheme.modifier_types(1)
|
|
104
105
|
|
105
106
|
# by options
|
106
107
|
fee_scheme.modifier_types(fee_type_code: 'AGFS_APPEAL_CON')
|
108
|
+
fee_scheme.prices(scenario: 5, advocate_type: 'QC')
|
109
|
+
|
110
|
+
# searching (as opposed to query parameters filtering above)
|
111
|
+
# by attribute values
|
112
|
+
fee_scheme.scenarios.find_by(code: 'AS000002')
|
107
113
|
```
|
108
114
|
|
109
115
|
###### Calculate
|
@@ -164,11 +170,13 @@ Bug reports and pull requests are welcome on GitHub at [ministryofjustice/laa-fe
|
|
164
170
|
|
165
171
|
2. Run `bin/ruby_version_test` to test against ruby versions (2.4+ supported at present)
|
166
172
|
|
167
|
-
3. Update the
|
173
|
+
3. Update the VERSION in `lib/laa/fee_calculator/version` using [semantic versioning](https://guides.rubygems.org/patterns/#semantic-versioning).
|
174
|
+
|
175
|
+
4. Update the VERSION_RELEASED in `lib/laa/fee_calculator/version` to the date you intend to publish/release the version.
|
168
176
|
|
169
|
-
|
177
|
+
5. PR the change, code-review, merge.
|
170
178
|
|
171
|
-
|
179
|
+
6. Pull master and run rake task below to publish
|
172
180
|
|
173
181
|
```bash
|
174
182
|
$ rake release
|
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.version = LAA::FeeCalculator::VERSION
|
10
10
|
spec.authors = ['Joel Sugarman', 'Ministry of Justice']
|
11
11
|
spec.email = ['joel.sugarman@digital.justice.gov.uk', 'tools@digital.justice.gov.uk']
|
12
|
-
spec.date =
|
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."
|
15
15
|
spec.homepage = 'https://github.com/ministryofjustice/laa-fee-calculator-client'
|
@@ -8,6 +8,14 @@ module LAA
|
|
8
8
|
end
|
9
9
|
|
10
10
|
module ClassMethods
|
11
|
+
module Searchable
|
12
|
+
def find_by(**options)
|
13
|
+
find do |ostruct|
|
14
|
+
options.map { |k, v| ostruct[k].eql?(v) }.all?
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
11
19
|
def has_many(association)
|
12
20
|
define_method("#{association}_uri".to_sym) do |scheme_pk = nil, id = nil|
|
13
21
|
uri = scheme_pk.nil? ? "#{association.to_s.tr('_', '-')}/" : "fee-schemes/#{scheme_pk}/#{association.to_s.tr('_', '-')}/"
|
@@ -24,7 +32,8 @@ module LAA
|
|
24
32
|
|
25
33
|
ostruct = JSON.parse(json, object_class: OpenStruct)
|
26
34
|
return ostruct unless ostruct.respond_to?(:results)
|
27
|
-
|
35
|
+
|
36
|
+
ostruct.results.extend Searchable
|
28
37
|
end
|
29
38
|
end
|
30
39
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: laa-fee-calculator-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Sugarman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-09-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: addressable
|