et_fake_ccd 1.1.11 → 2.1.0

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
  SHA256:
3
- metadata.gz: b6b76b52626389f3c3c2464fc36fcb8b904050170d9f05b0c542d134529c0320
4
- data.tar.gz: e25bb026fe7f1a46ee375d347b3e5a343b811a814a28c3ec80e8d7a28be93e53
3
+ metadata.gz: d16faad33fb9a19045a8fe5f0cc0103da22427fd4dd2d83c34f7d524e0f7358d
4
+ data.tar.gz: 9eb55aeef02871275783a05faa0bdf4eede33c74647611e5e26dfee3688a94b8
5
5
  SHA512:
6
- metadata.gz: 85dcd2c3d8a28f8eb4f68e4b4377d6d058c2bb214aa02ebf65e2d4a3ddad72aeeb7c8756750cf8b9bad2cd98291fd122655341000b96ac5009db5c2dd5941a79
7
- data.tar.gz: 4c948532068fb056693bcecb237d38a7915d149bb5c312791016c13880b1f70be711f56ca66e3e236b538122f1e3d380f75c757c58d6512548e5ae83ffc9217a
6
+ metadata.gz: ddce934372a9565fc97fced8ff2471c57fd3d2a7ac7d3ab317148ded2a9abda425dc1c2740af6d280dfcc85e5e2f8070d9dde55a1c053daf11f96649b98dae9f
7
+ data.tar.gz: 126d52b773b5a4860e951c0887c83880705f8bd19069e71cfa61aaa94adfbf97f30369e8bfbaaf50da2396ba2eb5672e98a1dd1ad6067c25bedd54fd88eaac22
data/Gemfile.lock CHANGED
@@ -1,12 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- et_fake_ccd (1.1.11)
5
- activemodel (~> 6.1)
4
+ et_fake_ccd (2.1.0)
5
+ activemodel (~> 7.0)
6
6
  iodine (~> 0.7)
7
- json-schema (~> 2.5)
7
+ json-schema (~> 3.0)
8
8
  roda (~> 3.21)
9
- roda-enhanced_logger (~> 0.4.0)
9
+ roda-enhanced_logger (~> 0.5.0)
10
10
  rotp (~> 6.2)
11
11
  thor (~> 1.0)
12
12
  tilt (~> 2.0, >= 2.0.9)
@@ -14,56 +14,54 @@ PATH
14
14
  GEM
15
15
  remote: https://rubygems.org/
16
16
  specs:
17
- activemodel (6.1.4.4)
18
- activesupport (= 6.1.4.4)
19
- activesupport (6.1.4.4)
17
+ activemodel (7.0.4.3)
18
+ activesupport (= 7.0.4.3)
19
+ activesupport (7.0.4.3)
20
20
  concurrent-ruby (~> 1.0, >= 1.0.2)
21
21
  i18n (>= 1.6, < 2)
22
22
  minitest (>= 5.1)
23
23
  tzinfo (~> 2.0)
24
- zeitwerk (~> 2.3)
25
- addressable (2.8.0)
26
- public_suffix (>= 2.0.2, < 5.0)
27
- concurrent-ruby (1.1.9)
28
- diff-lcs (1.4.4)
29
- i18n (1.8.11)
24
+ addressable (2.8.1)
25
+ public_suffix (>= 2.0.2, < 6.0)
26
+ concurrent-ruby (1.2.2)
27
+ diff-lcs (1.5.0)
28
+ i18n (1.12.0)
30
29
  concurrent-ruby (~> 1.0)
31
- iodine (0.7.45)
32
- json-schema (2.8.1)
33
- addressable (>= 2.4)
34
- minitest (5.15.0)
30
+ iodine (0.7.54)
31
+ json-schema (3.0.0)
32
+ addressable (>= 2.8)
33
+ minitest (5.18.0)
35
34
  pastel (0.8.0)
36
35
  tty-color (~> 0.5)
37
- public_suffix (4.0.6)
38
- rack (2.2.3)
36
+ public_suffix (5.0.1)
37
+ rack (3.0.7)
39
38
  rake (13.0.6)
40
- roda (3.51.0)
39
+ roda (3.66.0)
41
40
  rack
42
- roda-enhanced_logger (0.4.0)
41
+ roda-enhanced_logger (0.5.0)
43
42
  roda (>= 3.19.0)
44
43
  tty-logger (>= 0.3, < 1.0)
45
- rotp (6.2.0)
46
- rspec (3.10.0)
47
- rspec-core (~> 3.10.0)
48
- rspec-expectations (~> 3.10.0)
49
- rspec-mocks (~> 3.10.0)
50
- rspec-core (3.10.1)
51
- rspec-support (~> 3.10.0)
52
- rspec-expectations (3.10.1)
44
+ rotp (6.2.2)
45
+ rspec (3.12.0)
46
+ rspec-core (~> 3.12.0)
47
+ rspec-expectations (~> 3.12.0)
48
+ rspec-mocks (~> 3.12.0)
49
+ rspec-core (3.12.0)
50
+ rspec-support (~> 3.12.0)
51
+ rspec-expectations (3.12.1)
53
52
  diff-lcs (>= 1.2.0, < 2.0)
54
- rspec-support (~> 3.10.0)
55
- rspec-mocks (3.10.2)
53
+ rspec-support (~> 3.12.0)
54
+ rspec-mocks (3.12.1)
56
55
  diff-lcs (>= 1.2.0, < 2.0)
57
- rspec-support (~> 3.10.0)
58
- rspec-support (3.10.3)
56
+ rspec-support (~> 3.12.0)
57
+ rspec-support (3.12.0)
59
58
  thor (1.2.1)
60
- tilt (2.0.10)
59
+ tilt (2.1.0)
61
60
  tty-color (0.6.0)
62
61
  tty-logger (0.6.0)
63
62
  pastel (~> 0.8)
64
- tzinfo (2.0.4)
63
+ tzinfo (2.0.6)
65
64
  concurrent-ruby (~> 1.0)
66
- zeitwerk (2.5.3)
67
65
 
68
66
  PLATFORMS
69
67
  ruby
data/et_fake_ccd.gemspec CHANGED
@@ -24,14 +24,14 @@ Gem::Specification.new do |spec|
24
24
  spec.require_paths = ["lib"]
25
25
 
26
26
  spec.add_dependency 'roda', '~> 3.21'
27
- spec.add_dependency 'roda-enhanced_logger', '~> 0.4.0'
27
+ spec.add_dependency 'roda-enhanced_logger', '~> 0.5.0'
28
28
 
29
29
  spec.add_dependency 'thor', '~> 1.0'
30
- spec.add_dependency 'activemodel', '~> 6.1'
30
+ spec.add_dependency 'activemodel', '~> 7.0'
31
31
  spec.add_dependency 'rotp', '~> 6.2'
32
32
  spec.add_dependency 'tilt', '~> 2.0', '>= 2.0.9'
33
33
  spec.add_dependency 'iodine', '~> 0.7'
34
- spec.add_dependency 'json-schema', '~> 2.5'
34
+ spec.add_dependency 'json-schema', '~> 3.0'
35
35
 
36
36
  spec.add_development_dependency "bundler", "~> 2.0"
37
37
  spec.add_development_dependency "rake", "~> 13.0"
@@ -25,6 +25,29 @@ module EtFakeCcd
25
25
  list = DataStoreService.list(jid: jid, ctid: ctid, filters: filters, page: page, sort_direction: sort_direction, page_size: 25)
26
26
  cases_response(list, uid, jid, ctid)
27
27
  end
28
+
29
+ r.post do
30
+ json = JSON.parse(r.body.read)
31
+
32
+ command = case json.dig('event', 'id')
33
+ when 'initiateCase' then ::EtFakeCcd::Command::CreateCaseCommand.from_json json
34
+ when 'createMultiple' then ::EtFakeCcd::Command::CreateMultipleCaseCommand.from_json json
35
+ else
36
+ r.halt 400, unknown_event_error_for(r)
37
+ end
38
+ if command.valid?
39
+ id = ::EtFakeCcd::DataStoreService.store_case_data(command.data, jid: jid, ctid: ctid)
40
+ case_created_response(id, uid, jid, ctid)
41
+ else
42
+ r.halt 422, render_error_for(command, r)
43
+ end
44
+
45
+ end
46
+ end
47
+ r.is "caseworkers", String, "jurisdictions", String, "case-types", String, "event-triggers", "initiateCase", "token" do |uid, jid, ctid|
48
+ r.get do
49
+ initiate_case(uid, jid, ctid)
50
+ end
28
51
  end
29
52
  end
30
53
  r.on "data" do
@@ -109,6 +132,59 @@ module EtFakeCcd
109
132
  }
110
133
  JSON.generate j
111
134
  end
135
+
136
+ def initiate_case(uid, jid, ctid)
137
+ j = {
138
+ "token": "eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJvZDRwZ3NhbDQwcTdndHI0Y2F1bmVmZGU5aSIsInN1YiI6IjIyIiwiaWF0IjoxNTYxOTY2NzM1LCJldmVudC1pZCI6ImluaXRpYXRlQ2FzZSIsImNhc2UtdHlwZS1pZCI6IkVtcFRyaWJfTVZQXzEuMF9NYW5jIiwianVyaXNkaWN0aW9uLWlkIjoiRU1QTE9ZTUVOVCIsImNhc2UtdmVyc2lvbiI6ImJmMjFhOWU4ZmJjNWEzODQ2ZmIwNWI0ZmEwODU5ZTA5MTdiMjIwMmYifQ.u-OfexKFu52uvSgTNVHJ5kUQ9KTZGClRIRnGXRPSmGY",
139
+ "case_details": {
140
+ "id": nil,
141
+ "jurisdiction": jid,
142
+ "state": nil,
143
+ "case_type_id": ctid,
144
+ "created_date": nil,
145
+ "last_modified": nil,
146
+ "security_classification": nil,
147
+ "case_data": {},
148
+ "data_classification": {},
149
+ "after_submit_callback_response": nil,
150
+ "callback_response_status_code": nil,
151
+ "callback_response_status": nil,
152
+ "delete_draft_response_status_code": nil,
153
+ "delete_draft_response_status": nil,
154
+ "security_classifications": {}
155
+ },
156
+ "event_id": "initiateCase"
157
+ }
158
+ JSON.generate(j)
159
+ end
160
+
161
+ def case_created_response(id, uid, jid, ctid)
162
+ j = case_hash(ctid, id, jid)
163
+ JSON.generate(j)
164
+ end
165
+
166
+ def render_error_for(command, request)
167
+ j = {
168
+ "exception": "uk.gov.hmcts.ccd.endpoint.exceptions.CaseValidationException",
169
+ "timestamp": "2019-07-01T16:02:28.045",
170
+ "status": 422,
171
+ "error": "Unprocessable Entity",
172
+ "message": "Case data validation failed",
173
+ "path": request.path,
174
+ "details": {
175
+ "field_errors": command.errors.details[:data].map {|e| e[:field_error]}
176
+ },
177
+ "callbackErrors": nil,
178
+ "callbackWarnings": nil
179
+ }
180
+
181
+ JSON.generate(j)
182
+ end
183
+
184
+ def unknown_event_error_for(r)
185
+ j = {"timestamp":"2019-07-01T07:46:35.405+0000","status":400,"error":"Unknown event","message":"Unknown event","path": r.path}
186
+ JSON.generate(j)
187
+ end
112
188
  end
113
189
  end
114
190
  end
@@ -1,3 +1,3 @@
1
1
  module EtFakeCcd
2
- VERSION = "1.1.11"
2
+ VERSION = "2.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: et_fake_ccd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.11
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gary Taylor
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-10 00:00:00.000000000 Z
11
+ date: 2023-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: roda
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.4.0
33
+ version: 0.5.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.4.0
40
+ version: 0.5.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: thor
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '6.1'
61
+ version: '7.0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '6.1'
68
+ version: '7.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rotp
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -120,14 +120,14 @@ dependencies:
120
120
  requirements:
121
121
  - - "~>"
122
122
  - !ruby/object:Gem::Version
123
- version: '2.5'
123
+ version: '3.0'
124
124
  type: :runtime
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
128
  - - "~>"
129
129
  - !ruby/object:Gem::Version
130
- version: '2.5'
130
+ version: '3.0'
131
131
  - !ruby/object:Gem::Dependency
132
132
  name: bundler
133
133
  requirement: !ruby/object:Gem::Requirement