et_ccd_client 0.3.4 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f341d2dcaac700c1d7202cfc351e57f4f40bb0ccc79cb54faff299158b92a81f
4
- data.tar.gz: 4c1e8fccab6dc0e0e3f5518161015533b4bd9f67747c67e949d725403f0cc0e9
3
+ metadata.gz: 3887534b93061dc05c56fa3f37e96ed7621842f45cdb5686b790f5b045f3ff7e
4
+ data.tar.gz: db9104c77f54335d9b73ec4dfffa9927de1db06536e08c8be0ca7db9d91da1c8
5
5
  SHA512:
6
- metadata.gz: '068d689c2fe2b9bc67a0e2f0ed015270dcd52fbe916b641b93a231ac65ec75c88f4660092bc78a06128610e1c9e6ea13e3fac0b26cb8761a94a4f68072a8a3f9'
7
- data.tar.gz: d189b257e0f9e4a5c9c6be7eb436dfc7c5b8e5e5d5e960199dfcc375feb4041308a09baae3763ecfb1acd223b742212d64366b112295e308eefaf6777a10694e
6
+ metadata.gz: 268b097b27b7e8ea2466a9687e7c4d4227f821e8fd01b914684c4c3974394934ec753c0e40331b99825341228c7e6d6486091abe25f450f17f9dceac1bde4a11
7
+ data.tar.gz: db944199e3f7597b43900124a2df810c5bde86e1bb5d5b2f8e2ade33c066e23ea3d00d6efaca4d2c60fa551f3b50e35aabafc1c05c6fa632c5677fce09b5c813
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- et_ccd_client (0.3.4)
4
+ et_ccd_client (0.4.0)
5
5
  addressable (~> 2.6)
6
6
  connection_pool (~> 2.2, >= 2.2.2)
7
7
  rest-client (~> 2.0, >= 2.0.2)
@@ -11,10 +11,10 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- addressable (2.7.0)
15
- public_suffix (>= 2.0.2, < 5.0)
14
+ addressable (2.8.1)
15
+ public_suffix (>= 2.0.2, < 6.0)
16
16
  ast (2.4.0)
17
- connection_pool (2.2.5)
17
+ connection_pool (2.4.0)
18
18
  crack (0.4.5)
19
19
  rexml
20
20
  diff-lcs (1.3)
@@ -22,17 +22,17 @@ GEM
22
22
  unf (>= 0.0.5, < 1.0.0)
23
23
  hashdiff (1.0.1)
24
24
  http-accept (1.7.0)
25
- http-cookie (1.0.3)
25
+ http-cookie (1.0.5)
26
26
  domain_name (~> 0.5)
27
27
  jaro_winkler (1.5.3)
28
- mime-types (3.3.1)
28
+ mime-types (3.4.1)
29
29
  mime-types-data (~> 3.2015)
30
- mime-types-data (3.2021.0225)
30
+ mime-types-data (3.2023.0218.1)
31
31
  netrc (0.11.0)
32
32
  parallel (1.17.0)
33
33
  parser (2.6.3.0)
34
34
  ast (~> 2.4.0)
35
- public_suffix (4.0.6)
35
+ public_suffix (5.0.1)
36
36
  rack (2.0.7)
37
37
  rainbow (3.0.0)
38
38
  rake (10.5.0)
@@ -42,7 +42,7 @@ GEM
42
42
  mime-types (>= 1.16, < 4.0)
43
43
  netrc (~> 0.8)
44
44
  rexml (3.2.5)
45
- rotp (6.2.0)
45
+ rotp (6.2.2)
46
46
  rspec (3.8.0)
47
47
  rspec-core (~> 3.8.0)
48
48
  rspec-expectations (~> 3.8.0)
@@ -68,10 +68,10 @@ GEM
68
68
  ruby-progressbar (1.10.1)
69
69
  unf (0.1.4)
70
70
  unf_ext
71
- unf_ext (0.0.7.7)
71
+ unf_ext (0.0.8.2)
72
72
  unicode-display_width (1.6.0)
73
- webmock (3.12.2)
74
- addressable (>= 2.3.6)
73
+ webmock (3.18.1)
74
+ addressable (>= 2.8.0)
75
75
  crack (>= 0.3.2)
76
76
  hashdiff (>= 0.4.0, < 2.0.0)
77
77
 
@@ -23,7 +23,11 @@ module EtCcdClient
23
23
  end
24
24
 
25
25
  def create_case_url
26
- "#{data_store_base_url}/caseworkers/{uid}/jurisdictions/{jid}/case-types/{ctid}/cases"
26
+ "#{data_store_base_url}#{create_case_path}"
27
+ end
28
+
29
+ def create_case_path
30
+ "/caseworkers/{uid}/jurisdictions/{jid}/case-types/{ctid}/cases"
27
31
  end
28
32
 
29
33
  def cases_url
@@ -39,7 +43,11 @@ module EtCcdClient
39
43
  end
40
44
 
41
45
  def initiate_case_url
42
- "#{data_store_base_url}/caseworkers/{uid}/jurisdictions/{jid}/case-types/{ctid}/event-triggers/{etid}/token"
46
+ "#{data_store_base_url}#{initiate_case_path}"
47
+ end
48
+
49
+ def initiate_case_path
50
+ "/caseworkers/{uid}/jurisdictions/{jid}/case-types/{ctid}/event-triggers/{etid}/token"
43
51
  end
44
52
 
45
53
  def initiate_document_upload_url
@@ -146,6 +146,34 @@ module EtCcdClient
146
146
  end
147
147
  end
148
148
 
149
+ # Initiate the case ready for creation
150
+ # @param [String] case_type_id
151
+ #
152
+ # @return [Hash] The json response
153
+ def caseworker_start_case_creation(case_type_id:, extra_headers: {})
154
+ logger.tagged('EtCcdClient::Client') do
155
+ path = initiate_case_path(case_type_id, config.initiate_claim_event_id)
156
+ url = "#{config.gateway_api_url}/aggregated#{path}"
157
+
158
+ get_request(url, log_subject: 'Start case creation', extra_headers: { content_type: 'application/json', accept: 'application/json' }, cookies: { accessToken: ui_idam_client.user_token })
159
+ end
160
+ end
161
+
162
+ # @param [Hash] data
163
+ # @param [String] case_type_id
164
+ #
165
+ # @return [Hash] The json response
166
+ def caseworker_case_create(data, case_type_id:, extra_headers: {})
167
+ logger.tagged('EtCcdClient::Client') do
168
+ tpl = Addressable::Template.new(config.create_case_path)
169
+ path = tpl.expand(uid: ui_idam_client.user_details['id'], jid: config.jurisdiction_id, ctid: case_type_id).to_s
170
+ url = "#{config.gateway_api_url}/aggregated#{path}"
171
+ post_request(url, data, log_subject: 'Case worker create case', extra_headers: { content_type: 'application/json', accept: 'application/json' }, cookies: { accessToken: ui_idam_client.user_token })
172
+ end
173
+ end
174
+
175
+
176
+
149
177
 
150
178
  private
151
179
 
@@ -155,5 +183,10 @@ module EtCcdClient
155
183
  source_host, source_port, dest_host, dest_port = config.document_store_url_rewrite
156
184
  JSON.parse(JSON.generate(json).gsub(/(https?):\/\/#{Regexp.quote dest_host}:#{Regexp.quote dest_port}/, "\\1://#{source_host}:#{source_port}"))
157
185
  end
186
+
187
+ def initiate_case_path(case_type_id, event_id)
188
+ tpl = Addressable::Template.new(config.initiate_case_path)
189
+ tpl.expand(uid: ui_idam_client.user_details['id'], jid: config.jurisdiction_id, ctid: case_type_id, etid: event_id).to_s
190
+ end
158
191
  end
159
192
  end
@@ -1,3 +1,3 @@
1
1
  module EtCcdClient
2
- VERSION = "0.3.4".freeze
2
+ VERSION = "0.4.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: et_ccd_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.4.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: 2021-05-13 00:00:00.000000000 Z
11
+ date: 2023-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -244,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
244
244
  - !ruby/object:Gem::Version
245
245
  version: '0'
246
246
  requirements: []
247
- rubygems_version: 3.1.4
247
+ rubygems_version: 3.1.6
248
248
  signing_key:
249
249
  specification_version: 4
250
250
  summary: A client to communicate with the employment tribunals CCD system