et_fake_ccd 0.1.10 → 0.1.11
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 481c48f7451a85cca8aad9076072c5799f2681e2bd250f0d52ac3200018eb970
|
|
4
|
+
data.tar.gz: a20837c982a4a2ef44bcb6ed7f71bc6ee13c57918b81281e2140b1ca34397613
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5763ad0180368ed47a0f957790e2de18ab9bf66e8b0662896d94eea2dc1f4f13a20d22b1e46adc5fa033270c00fb68c71b8286979fb85b63d4b98e90ad19314d
|
|
7
|
+
data.tar.gz: c686f75d92663b1a7476abc47bf00a00dc689f4ff73a07fd9df6b3f4a0e17b0b08627fae9000b7cf3f96ac3649c62746c409fdccf4404ae37dcfc4693d1d4de9
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
et_fake_ccd (0.1.
|
|
4
|
+
et_fake_ccd (0.1.11)
|
|
5
5
|
activemodel (~> 5.2, >= 5.2.3)
|
|
6
6
|
roda (~> 3.21)
|
|
7
7
|
rotp (~> 5.1)
|
|
@@ -28,7 +28,7 @@ GEM
|
|
|
28
28
|
public_suffix (3.1.1)
|
|
29
29
|
rack (2.0.7)
|
|
30
30
|
rake (10.5.0)
|
|
31
|
-
roda (3.
|
|
31
|
+
roda (3.22.0)
|
|
32
32
|
rack
|
|
33
33
|
rotp (5.1.0)
|
|
34
34
|
addressable (~> 2.5)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require 'active_model'
|
|
2
|
+
module EtFakeCcd
|
|
3
|
+
module Command
|
|
4
|
+
class CreateBulkActionCaseCommand
|
|
5
|
+
include ActiveModel::Model
|
|
6
|
+
include ActiveModel::Attributes
|
|
7
|
+
|
|
8
|
+
attribute :data
|
|
9
|
+
|
|
10
|
+
def self.from_json(json)
|
|
11
|
+
new data: json
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
data/lib/et_fake_ccd/commands.rb
CHANGED
|
@@ -18,6 +18,15 @@ module EtFakeCcd
|
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
|
+
r.is "caseworkers", String, "jurisdictions", String, "case-types", String, "event-triggers", "createBulkAction", "token" do |uid, jid, ctid|
|
|
22
|
+
r.get do
|
|
23
|
+
if EtFakeCcd::AuthService.validate_service_token(r.headers['ServiceAuthorization'].gsub(/\ABearer /, '')) && EtFakeCcd::AuthService.validate_user_token(r.headers['Authorization'].gsub(/\ABearer /, ''))
|
|
24
|
+
initiate_bulk_case(uid, jid, ctid)
|
|
25
|
+
else
|
|
26
|
+
r.halt 403, forbidden_error_for(r)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
21
30
|
r.is "caseworkers", String, "jurisdictions", String, "case-types", String, "cases" do |uid, jid, ctid|
|
|
22
31
|
r.post do
|
|
23
32
|
if !EtFakeCcd::AuthService.validate_service_token(r.headers['ServiceAuthorization'].gsub(/\ABearer /, '')) || !EtFakeCcd::AuthService.validate_user_token(r.headers['Authorization'].gsub(/\ABearer /, ''))
|
|
@@ -25,7 +34,12 @@ module EtFakeCcd
|
|
|
25
34
|
break
|
|
26
35
|
end
|
|
27
36
|
json = JSON.parse(r.body.read)
|
|
28
|
-
command =
|
|
37
|
+
command = case json.dig('event', 'id')
|
|
38
|
+
when 'initiateCase' then ::EtFakeCcd::Command::CreateCaseCommand.from_json json
|
|
39
|
+
when 'createBulkAction' then ::EtFakeCcd::Command::CreateBulkActionCaseCommand.from_json json
|
|
40
|
+
else
|
|
41
|
+
r.halt 400, unknown_event_error_for(r)
|
|
42
|
+
end
|
|
29
43
|
if command.valid?
|
|
30
44
|
id = ::EtFakeCcd::DataStoreService.store_case_data(json, jid: jid, ctid: ctid)
|
|
31
45
|
case_created_response(id, uid, jid, ctid)
|
|
@@ -75,6 +89,31 @@ module EtFakeCcd
|
|
|
75
89
|
JSON.generate(j)
|
|
76
90
|
end
|
|
77
91
|
|
|
92
|
+
def initiate_bulk_case(uid, jid, ctid)
|
|
93
|
+
j = {
|
|
94
|
+
"token": "eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJvZDRwZ3NhbDQwcTdndHI0Y2F1bmVmZGU5aSIsInN1YiI6IjIyIiwiaWF0IjoxNTYxOTY2NzM1LCJldmVudC1pZCI6ImluaXRpYXRlQ2FzZSIsImNhc2UtdHlwZS1pZCI6IkVtcFRyaWJfTVZQXzEuMF9NYW5jIiwianVyaXNkaWN0aW9uLWlkIjoiRU1QTE9ZTUVOVCIsImNhc2UtdmVyc2lvbiI6ImJmMjFhOWU4ZmJjNWEzODQ2ZmIwNWI0ZmEwODU5ZTA5MTdiMjIwMmYifQ.u-OfexKFu52uvSgTNVHJ5kUQ9KTZGClRIRnGXRPSmGY",
|
|
95
|
+
"case_details": {
|
|
96
|
+
"id": nil,
|
|
97
|
+
"jurisdiction": jid,
|
|
98
|
+
"state": nil,
|
|
99
|
+
"case_type_id": ctid,
|
|
100
|
+
"created_date": nil,
|
|
101
|
+
"last_modified": nil,
|
|
102
|
+
"security_classification": nil,
|
|
103
|
+
"case_data": {},
|
|
104
|
+
"data_classification": {},
|
|
105
|
+
"after_submit_callback_response": nil,
|
|
106
|
+
"callback_response_status_code": nil,
|
|
107
|
+
"callback_response_status": nil,
|
|
108
|
+
"delete_draft_response_status_code": nil,
|
|
109
|
+
"delete_draft_response_status": nil,
|
|
110
|
+
"security_classifications": {}
|
|
111
|
+
},
|
|
112
|
+
"event_id": "createBulkAction"
|
|
113
|
+
}
|
|
114
|
+
JSON.generate(j)
|
|
115
|
+
end
|
|
116
|
+
|
|
78
117
|
def case_created_response(id, uid, jid, ctid)
|
|
79
118
|
j = case_hash(ctid, id, jid)
|
|
80
119
|
JSON.generate(j)
|
|
@@ -112,6 +151,11 @@ module EtFakeCcd
|
|
|
112
151
|
JSON.generate(j)
|
|
113
152
|
end
|
|
114
153
|
|
|
154
|
+
def unknown_event_error_for(r)
|
|
155
|
+
j = {"timestamp":"2019-07-01T07:46:35.405+0000","status":400,"error":"Unknown event","message":"Unknown event","path": r.path}
|
|
156
|
+
JSON.generate(j)
|
|
157
|
+
end
|
|
158
|
+
|
|
115
159
|
def render_error_for(command, request)
|
|
116
160
|
j = {
|
|
117
161
|
"exception": "uk.gov.hmcts.ccd.endpoint.exceptions.CaseValidationException",
|
data/lib/et_fake_ccd/version.rb
CHANGED
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: 0.1.
|
|
4
|
+
version: 0.1.11
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Gary Taylor
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-07-
|
|
11
|
+
date: 2019-07-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: roda
|
|
@@ -158,6 +158,7 @@ files:
|
|
|
158
158
|
- lib/et_fake_ccd/auth_service.rb
|
|
159
159
|
- lib/et_fake_ccd/cli.rb
|
|
160
160
|
- lib/et_fake_ccd/cli/root.rb
|
|
161
|
+
- lib/et_fake_ccd/command/create_bulk_action_case_command.rb
|
|
161
162
|
- lib/et_fake_ccd/command/create_case_command.rb
|
|
162
163
|
- lib/et_fake_ccd/command/lease_command.rb
|
|
163
164
|
- lib/et_fake_ccd/command/login_user_command.rb
|