et_fake_ccd 0.1.20 → 0.1.22

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: 83a716d870b84dcc8039c74488b683e9420ee619b64b9e4a8bbb1f8cdda9c206
4
- data.tar.gz: 79d6631125e177edb274ba065a6283bf3ac3757741294716d94c25361ff6f2a5
3
+ metadata.gz: bfcdbc556e045cf1e68ea27f1ecc6800a0172d2923a6073aa12208dd17f1ea00
4
+ data.tar.gz: '09b240fa45926b68e093bf2a75a7fc36252f5d8e68565a0590e6b774005b09c2'
5
5
  SHA512:
6
- metadata.gz: 98399082f7d8b83f7e5e9f451b3ce1fc5098b2f1123c8081c9df5ce79e2ae57fe6e2da6973d3d4b99c234fd1c852086799b6463c4e469e0909ccec5db3872e8d
7
- data.tar.gz: 7986d4fc6bc424632948331c17b2db36cb52a139a0af8a2a242bbe5b2bbbace19332289584a00e9f92a280a8920e6afdb8e6ff343e0eac62243a2f88604e5413
6
+ metadata.gz: 909986f0e95303bae35ec99a5e50b43c6f97c44142237f23b25e000ff00ef5c2e438f8e3f05a9bf145fc6042a366dcd0ceac644c5726c9b8413b4ab96691c028
7
+ data.tar.gz: 85fa142b6dd22ada2c4553b3092d261da6ca8cf96331620104713a07f477f7a7fd85caa21713e2d50fbec52548a975260b70c832bac8c59daac427d7b594ee60
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- et_fake_ccd (0.1.20)
4
+ et_fake_ccd (0.1.22)
5
5
  activemodel (~> 5.2, >= 5.2.3)
6
6
  puma (~> 3.12)
7
7
  roda (~> 3.21)
@@ -6,17 +6,28 @@ module EtFakeCcd
6
6
  include ActiveModel::Attributes
7
7
 
8
8
  SCHEMA_FILE = File.absolute_path(File.join('..', 'case_create.json'), __dir__)
9
+ ELMOS_BIRTHDAY = Time.new(2019,9,1).to_f
9
10
 
10
11
  attribute :data
11
12
 
12
13
  def self.from_json(json)
13
- new data: json
14
+ modified_json = json.dup
15
+ modified_json['data']['ethosCaseReference'] = nextCaseReference
16
+ new data: modified_json
14
17
  end
15
18
 
16
19
  validate :validate_data
17
20
 
18
21
  private
19
22
 
23
+ def assign_ethos_reference_number
24
+ data['ethosCaseReference'] = nextCaseReference
25
+ end
26
+
27
+ def nextCaseReference
28
+ format('%7.4f', Time.now.to_f - ELMOS_BIRTHDAY)[-12..-1].gsub(/\./, '/')
29
+ end
30
+
20
31
  def validate_data
21
32
  validate_claimant_type
22
33
  validate_primary_claimant
@@ -71,7 +71,7 @@ module EtFakeCcd
71
71
  r.halt 400, unknown_event_error_for(r)
72
72
  end
73
73
  if command.valid?
74
- id = ::EtFakeCcd::DataStoreService.store_case_data(json, jid: jid, ctid: ctid)
74
+ id = ::EtFakeCcd::DataStoreService.store_case_data(command.data, jid: jid, ctid: ctid)
75
75
  case_created_response(id, uid, jid, ctid)
76
76
  else
77
77
  r.halt 422, render_error_for(command, r)
@@ -1,3 +1,3 @@
1
1
  module EtFakeCcd
2
- VERSION = "0.1.20"
2
+ VERSION = "0.1.22"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: et_fake_ccd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.20
4
+ version: 0.1.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gary Taylor