et_ccd_client 0.3.1
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 +7 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.rubocop.yml +200 -0
- data/.rubocop_todo.yml +7 -0
- data/.ruby-version +1 -0
- data/.travis.yml +9 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +91 -0
- data/LICENSE.txt +21 -0
- data/README.md +95 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/et_ccd_client.gemspec +37 -0
- data/lib/et_ccd_client.rb +18 -0
- data/lib/et_ccd_client/client.rb +291 -0
- data/lib/et_ccd_client/common_rest_client.rb +27 -0
- data/lib/et_ccd_client/common_rest_client_with_login.rb +33 -0
- data/lib/et_ccd_client/config.rb +108 -0
- data/lib/et_ccd_client/exceptions.rb +2 -0
- data/lib/et_ccd_client/exceptions/base.rb +52 -0
- data/lib/et_ccd_client/exceptions/forbidden.rb +6 -0
- data/lib/et_ccd_client/exceptions/gateway_timeout.rb +6 -0
- data/lib/et_ccd_client/exceptions/internal_server_error.rb +6 -0
- data/lib/et_ccd_client/exceptions/not_found.rb +13 -0
- data/lib/et_ccd_client/exceptions/unauthorized.rb +6 -0
- data/lib/et_ccd_client/exceptions/unprocessable_entity.rb +18 -0
- data/lib/et_ccd_client/idam_client.rb +57 -0
- data/lib/et_ccd_client/null_logger.rb +100 -0
- data/lib/et_ccd_client/tidam_client.rb +64 -0
- data/lib/et_ccd_client/ui_client.rb +159 -0
- data/lib/et_ccd_client/ui_idam_client.rb +40 -0
- data/lib/et_ccd_client/ui_remote_config.rb +23 -0
- data/lib/et_ccd_client/uploaded_file.rb +36 -0
- data/lib/et_ccd_client/version.rb +3 -0
- metadata +251 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8ebbc707aa7e9d8494b95b0edc2fccadc0d8eeede960ba14667b61748460c82f
|
4
|
+
data.tar.gz: 1f4cb0b5b8bc1ad802ec1e0cc40f355a7de2485f05efd65ca0bc74da4c3e81a2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 96b6494ebfebeb8216301ae2e2b1f7b89c2ae81719636f1e287eaa9fe8c4e5973fa26a4a3995e0a2240f673f98b400f938bb7d4b660cc9941835e933118e02e6
|
7
|
+
data.tar.gz: 6ad953780cc779046731514478a7e4dbcf5779f5f4185389f7365e03b9d6d7f1da3906dde39dedfc76e7ef574e771c96cfb86618c6f716e4be29665d8feb05a1
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,200 @@
|
|
1
|
+
inherit_from:
|
2
|
+
- .rubocop_todo.yml
|
3
|
+
|
4
|
+
AllCops:
|
5
|
+
TargetRubyVersion: 2.5
|
6
|
+
# Exclude anything that isn't really part of our code.
|
7
|
+
# rails_helper is excluded because it's full of solecisms, but it's mostly
|
8
|
+
# generated code and copy-and-pasted snipets from READMEs.
|
9
|
+
Exclude:
|
10
|
+
- 'bin/**/*'
|
11
|
+
- '**/*.gemspec'
|
12
|
+
- '**/Rakefile'
|
13
|
+
- 'Gemfile'
|
14
|
+
|
15
|
+
# Allow long lines in specs, as it's almost impossible to fit RSpec's
|
16
|
+
# expectations into 80 characters.
|
17
|
+
Metrics/LineLength:
|
18
|
+
Max: 180
|
19
|
+
Exclude:
|
20
|
+
- 'spec/**/*'
|
21
|
+
- 'Gemfile'
|
22
|
+
Metrics/ModuleLength:
|
23
|
+
Max: 120
|
24
|
+
Metrics/AbcSize:
|
25
|
+
Exclude:
|
26
|
+
- 'spec/**/*'
|
27
|
+
|
28
|
+
# Allow expect {}.to blocks in specs
|
29
|
+
# but not in the code
|
30
|
+
Style/BlockDelimiters:
|
31
|
+
Enabled: true
|
32
|
+
Exclude:
|
33
|
+
- 'spec/**/*'
|
34
|
+
|
35
|
+
Style/AsciiComments:
|
36
|
+
Enabled: true
|
37
|
+
Exclude:
|
38
|
+
- 'spec/**/*'
|
39
|
+
Layout/TrailingBlankLines:
|
40
|
+
Enabled: true
|
41
|
+
# Don't worry about long methods in specs.
|
42
|
+
Metrics/MethodLength:
|
43
|
+
Max: 15
|
44
|
+
Exclude:
|
45
|
+
- 'spec/**/*'
|
46
|
+
|
47
|
+
# No need to check for describe class param in support files.
|
48
|
+
RSpec/DescribeClass:
|
49
|
+
Enabled: true
|
50
|
+
|
51
|
+
# private/protected/public
|
52
|
+
Layout/AccessModifierIndentation:
|
53
|
+
EnforcedStyle: indent
|
54
|
+
|
55
|
+
# Just indent parameters by two spaces. It's less volatile if methods change,
|
56
|
+
# and there's less busy work lining things up.
|
57
|
+
Layout/AlignParameters:
|
58
|
+
EnforcedStyle: with_fixed_indentation
|
59
|
+
|
60
|
+
Style/ClassAndModuleChildren:
|
61
|
+
EnforcedStyle: nested
|
62
|
+
|
63
|
+
Style/CollectionMethods:
|
64
|
+
PreferredMethods:
|
65
|
+
collect: 'map'
|
66
|
+
collect!: 'map!'
|
67
|
+
each_with_object: 'inject'
|
68
|
+
inject: 'inject'
|
69
|
+
reduce: 'inject'
|
70
|
+
detect: 'find'
|
71
|
+
find_all: 'select'
|
72
|
+
|
73
|
+
# Chain methods with trailing dots.
|
74
|
+
Layout/DotPosition:
|
75
|
+
EnforcedStyle: trailing
|
76
|
+
|
77
|
+
# No, we don't prefer each_with_object
|
78
|
+
Style/EachWithObject:
|
79
|
+
Enabled: false
|
80
|
+
|
81
|
+
# Prefer blank line after class/module start.
|
82
|
+
Layout/EmptyLinesAroundClassBody:
|
83
|
+
Enabled: false
|
84
|
+
|
85
|
+
Layout/EmptyLinesAroundModuleBody:
|
86
|
+
Enabled: false
|
87
|
+
|
88
|
+
Layout/EmptyLinesAroundBlockBody:
|
89
|
+
Enabled: false
|
90
|
+
|
91
|
+
# We have a mixture at the moment, so don't enforce anything.
|
92
|
+
Style/FormatString:
|
93
|
+
Enabled: false
|
94
|
+
|
95
|
+
# It's not really clearer to replace every if with a return if.
|
96
|
+
Style/GuardClause:
|
97
|
+
Enabled: false
|
98
|
+
|
99
|
+
# Groups of three is not always the right thing for numeric literals
|
100
|
+
Style/NumericLiterals:
|
101
|
+
Enabled: false
|
102
|
+
|
103
|
+
Style/FrozenStringLiteralComment:
|
104
|
+
Enabled: false
|
105
|
+
|
106
|
+
# Percent-formatting and hash interpolation both have their place. Don't
|
107
|
+
# enforce any particular one.
|
108
|
+
Style/StringLiterals:
|
109
|
+
Enabled: false
|
110
|
+
|
111
|
+
# I'm happy with raise, thanks.
|
112
|
+
Style/SignalException:
|
113
|
+
Enabled: false
|
114
|
+
|
115
|
+
# Let us use foo? methods
|
116
|
+
Style/TrivialAccessors:
|
117
|
+
AllowPredicates: true
|
118
|
+
|
119
|
+
Style/MixinUsage:
|
120
|
+
Enabled: true
|
121
|
+
Exclude:
|
122
|
+
- 'spec/**/*'
|
123
|
+
- 'features/**/*'
|
124
|
+
|
125
|
+
# Prefer sensible naming to comments everywhere.
|
126
|
+
Documentation:
|
127
|
+
Description: Document classes and non-namespace modules.
|
128
|
+
Enabled: false
|
129
|
+
|
130
|
+
# Would enforce do_y if x over if x / do y / end. As with GuardClause above,
|
131
|
+
# this enforces code organisation that doesn't necesarily make things clearer.
|
132
|
+
IfUnlessModifier:
|
133
|
+
Enabled: false
|
134
|
+
|
135
|
+
# Allow safe assignment in conditions.
|
136
|
+
Lint/AssignmentInCondition:
|
137
|
+
AllowSafeAssignment: false
|
138
|
+
|
139
|
+
# Just a preference to use %w[] over %w()
|
140
|
+
Style/PercentLiteralDelimiters:
|
141
|
+
PreferredDelimiters:
|
142
|
+
'%w': '[]'
|
143
|
+
'%W': '[]'
|
144
|
+
'%i': '[]'
|
145
|
+
|
146
|
+
# %w doesn't always make for clearer test data
|
147
|
+
Style/WordArray:
|
148
|
+
EnforcedStyle: brackets
|
149
|
+
|
150
|
+
Style/SymbolArray:
|
151
|
+
EnforcedStyle: brackets
|
152
|
+
|
153
|
+
RSpec/NestedGroups:
|
154
|
+
Max: 10
|
155
|
+
|
156
|
+
RSpec/ExpectActual:
|
157
|
+
Exclude:
|
158
|
+
- 'spec/routing/**/*'
|
159
|
+
|
160
|
+
Metrics/BlockLength:
|
161
|
+
Exclude:
|
162
|
+
- 'spec/**/*'
|
163
|
+
- 'test_common/**/*'
|
164
|
+
- 'config/**/*'
|
165
|
+
- 'lib/tasks/**/*'
|
166
|
+
|
167
|
+
Layout/EmptyLineAfterMagicComment:
|
168
|
+
Enabled: false
|
169
|
+
|
170
|
+
# ---------------
|
171
|
+
# HttpPositionalArguments is rails 5 only
|
172
|
+
# https://github.com/bbatsov/rubocop/issues/3629
|
173
|
+
# ---------------
|
174
|
+
Rails/HttpPositionalArguments:
|
175
|
+
Enabled: false
|
176
|
+
|
177
|
+
RSpec/MultipleExpectations:
|
178
|
+
Exclude:
|
179
|
+
- 'spec/features/**/*'
|
180
|
+
|
181
|
+
RSpec/ExampleLength:
|
182
|
+
Exclude:
|
183
|
+
- 'spec/**/*'
|
184
|
+
|
185
|
+
Style/NumericPredicate:
|
186
|
+
Exclude:
|
187
|
+
- 'spec/**/*'
|
188
|
+
|
189
|
+
Rails/OutputSafety:
|
190
|
+
Exclude:
|
191
|
+
- 'app/helpers/yaml_helper.rb'
|
192
|
+
Capybara/FeatureMethods:
|
193
|
+
Exclude:
|
194
|
+
- 'spec/features/**/*'
|
195
|
+
|
196
|
+
Naming/PredicateName:
|
197
|
+
Exclude:
|
198
|
+
- 'test_common/**/*'
|
199
|
+
|
200
|
+
require: rubocop-rspec
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2017-01-23 14:18:18 +0000 using RuboCop version 0.47.1.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.6.2
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
et_ccd_client (0.3.1)
|
5
|
+
addressable (~> 2.6)
|
6
|
+
connection_pool (~> 2.2, >= 2.2.2)
|
7
|
+
rest-client (~> 2.0, >= 2.0.2)
|
8
|
+
rotp (~> 6.0)
|
9
|
+
webmock (~> 3.6)
|
10
|
+
|
11
|
+
GEM
|
12
|
+
remote: https://rubygems.org/
|
13
|
+
specs:
|
14
|
+
addressable (2.7.0)
|
15
|
+
public_suffix (>= 2.0.2, < 5.0)
|
16
|
+
ast (2.4.0)
|
17
|
+
connection_pool (2.2.3)
|
18
|
+
crack (0.4.5)
|
19
|
+
rexml
|
20
|
+
diff-lcs (1.3)
|
21
|
+
domain_name (0.5.20190701)
|
22
|
+
unf (>= 0.0.5, < 1.0.0)
|
23
|
+
hashdiff (1.0.1)
|
24
|
+
http-accept (1.7.0)
|
25
|
+
http-cookie (1.0.3)
|
26
|
+
domain_name (~> 0.5)
|
27
|
+
jaro_winkler (1.5.3)
|
28
|
+
mime-types (3.3.1)
|
29
|
+
mime-types-data (~> 3.2015)
|
30
|
+
mime-types-data (3.2020.1104)
|
31
|
+
netrc (0.11.0)
|
32
|
+
parallel (1.17.0)
|
33
|
+
parser (2.6.3.0)
|
34
|
+
ast (~> 2.4.0)
|
35
|
+
public_suffix (4.0.6)
|
36
|
+
rack (2.0.7)
|
37
|
+
rainbow (3.0.0)
|
38
|
+
rake (10.5.0)
|
39
|
+
rest-client (2.1.0)
|
40
|
+
http-accept (>= 1.7.0, < 2.0)
|
41
|
+
http-cookie (>= 1.0.2, < 2.0)
|
42
|
+
mime-types (>= 1.16, < 4.0)
|
43
|
+
netrc (~> 0.8)
|
44
|
+
rexml (3.2.4)
|
45
|
+
rotp (6.2.0)
|
46
|
+
rspec (3.8.0)
|
47
|
+
rspec-core (~> 3.8.0)
|
48
|
+
rspec-expectations (~> 3.8.0)
|
49
|
+
rspec-mocks (~> 3.8.0)
|
50
|
+
rspec-core (3.8.0)
|
51
|
+
rspec-support (~> 3.8.0)
|
52
|
+
rspec-expectations (3.8.3)
|
53
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
54
|
+
rspec-support (~> 3.8.0)
|
55
|
+
rspec-mocks (3.8.0)
|
56
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
57
|
+
rspec-support (~> 3.8.0)
|
58
|
+
rspec-support (3.8.0)
|
59
|
+
rubocop (0.71.0)
|
60
|
+
jaro_winkler (~> 1.5.1)
|
61
|
+
parallel (~> 1.10)
|
62
|
+
parser (>= 2.6)
|
63
|
+
rainbow (>= 2.2.2, < 4.0)
|
64
|
+
ruby-progressbar (~> 1.7)
|
65
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
66
|
+
rubocop-rspec (1.33.0)
|
67
|
+
rubocop (>= 0.60.0)
|
68
|
+
ruby-progressbar (1.10.1)
|
69
|
+
unf (0.1.4)
|
70
|
+
unf_ext
|
71
|
+
unf_ext (0.0.7.7)
|
72
|
+
unicode-display_width (1.6.0)
|
73
|
+
webmock (3.11.1)
|
74
|
+
addressable (>= 2.3.6)
|
75
|
+
crack (>= 0.3.2)
|
76
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
77
|
+
|
78
|
+
PLATFORMS
|
79
|
+
ruby
|
80
|
+
|
81
|
+
DEPENDENCIES
|
82
|
+
bundler (~> 1.17)
|
83
|
+
et_ccd_client!
|
84
|
+
rack (~> 2.0, >= 2.0.7)
|
85
|
+
rake (~> 10.0)
|
86
|
+
rspec (~> 3.0)
|
87
|
+
rubocop (~> 0.71.0)
|
88
|
+
rubocop-rspec (~> 1.33)
|
89
|
+
|
90
|
+
BUNDLED WITH
|
91
|
+
1.17.3
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Gary Taylor
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
# EtCcdClient
|
2
|
+
|
3
|
+
The ET CCD Client is a ruby interface to the CCD API and the CCD UI API specifically for employment
|
4
|
+
tribunals.
|
5
|
+
|
6
|
+
Note that this is general purpose CCD stuff, but this gem cannot claim to be a full CCD client
|
7
|
+
as it only has methods specific to employment tribunal.
|
8
|
+
|
9
|
+
In general, the EtApiClient::Client is used for the main CCD API where the secret is known and the
|
10
|
+
EtApiClient::UiClient is used to access the UI (front end) API where a username and password is known (generally
|
11
|
+
in a test environment)
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
Add this line to your application's Gemfile:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem 'et_ccd_client'
|
19
|
+
```
|
20
|
+
|
21
|
+
And then execute:
|
22
|
+
|
23
|
+
$ bundle
|
24
|
+
|
25
|
+
Or install it yourself as:
|
26
|
+
|
27
|
+
$ gem install et_ccd_client
|
28
|
+
|
29
|
+
## Usage (Main CCD API)
|
30
|
+
|
31
|
+
```
|
32
|
+
|
33
|
+
client = EtApiClient::Client.new
|
34
|
+
client.login
|
35
|
+
|
36
|
+
client.caseworker_search_latest_by_reference('222000000100', case_type_id: 'EmpTrib_MVP_1.0_Manc')
|
37
|
+
|
38
|
+
```
|
39
|
+
|
40
|
+
## Usage (UI API)
|
41
|
+
|
42
|
+
```
|
43
|
+
client = EtApiClient::UiClient.new
|
44
|
+
client.login
|
45
|
+
|
46
|
+
client.search_latest_by_reference('222000000100', case_type_id: 'EmpTrib_MVP_1.0_Manc')
|
47
|
+
|
48
|
+
```
|
49
|
+
## Configuration
|
50
|
+
|
51
|
+
To configure the client, use a block like this :-
|
52
|
+
|
53
|
+
```
|
54
|
+
EtCcdClient.config do |c|
|
55
|
+
c.auth_base_url = <value>
|
56
|
+
c.idam_base_url = <value>
|
57
|
+
c.data_store_base_url = <value>
|
58
|
+
c.document_store_base_url = <value>
|
59
|
+
c.document_store_url_rewrite = <false OR 4 element array containing source_host, source_port, dest_host, dest_port for rewriting - used in docker environment only>
|
60
|
+
c.ecm_base_url = <value> (This is the ECM service known as docmosis but it is much more than that)
|
61
|
+
c.jurisdiction_id = <value>
|
62
|
+
c.microservice = <value>
|
63
|
+
c.microservice_secret = <value>
|
64
|
+
c.idam_ui_base_url = <value> (Only needed if using UI API)
|
65
|
+
c.idam_ui_redirect_url = <value> (Only needed if using UI API)
|
66
|
+
c.use_sidam = <value> (If true uses sidam - else tidam)
|
67
|
+
c.sidam_username = <value> (Only needed if use_sidam is true)
|
68
|
+
c.sidam_password = value (Only needed if use_sidam is true)
|
69
|
+
c.user_id = <value> (Only needed if use_sidam is false)
|
70
|
+
c.user_role = <value> (Only needed if use_sidam is false)
|
71
|
+
c.pool_size = <value> The size of the connection pool (do not set lower than number of sidekiq threads)
|
72
|
+
c.pool_timeout = <value) The time in seconds where we give up waiting for someone to release a client to the pool
|
73
|
+
c.logger = Rails.logger (or any instance of an active support logger if you dont have rails)
|
74
|
+
end
|
75
|
+
|
76
|
+
```
|
77
|
+
|
78
|
+
If you don't set any of these, the defaults should work with local ccd-docker
|
79
|
+
|
80
|
+
If you don't set the logger, no logging output will be sent.
|
81
|
+
If you share your rails logger or configure a new one, only debug output is set generally.
|
82
|
+
|
83
|
+
## Development
|
84
|
+
|
85
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
86
|
+
|
87
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
88
|
+
|
89
|
+
## Contributing
|
90
|
+
|
91
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/hmcts/et_ccd_client.
|
92
|
+
|
93
|
+
## License
|
94
|
+
|
95
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|