et_fake_ccd 0.1.26 → 0.1.27

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: c6f2fd89e2499a1468f03a04dcaed58328476419cf8289a21a7d7db33d45460c
4
- data.tar.gz: 6da56fd3b19c379f043e5a9e513dac764b30d86d222327a2fe519513dce70165
3
+ metadata.gz: 232ea5fdd8a52f3eef798c32422769d34c4fb9b30296f97db08e3a613247b36c
4
+ data.tar.gz: b35dc423cb11a892e16554f7350d889425214cd3cfba2cdf5f04c3bd8f6ca52a
5
5
  SHA512:
6
- metadata.gz: 40a43f31402d58598ce9913a52cf5ae78706645e7f8d018f553a23a5519f1124e7654373c4860c38ed63df9c40d40787d251da553e710f5c3af7f60eab0c8c12
7
- data.tar.gz: ceda02b9369c5e69a47cc70c7f0460156e3128263ddaf093a31fffc545d200256fc4b476d4d38053b06d790d27105c782fe7d1cdca1468ce735124c7c0b2d151
6
+ metadata.gz: d7a91c2c046f74cdb9b2e7623f32594cc4e430a8b61341042c86522e5fe35eebedff62cde1c36b6c0514496d01172b4394621ad6ac7aceb4babd68e63c0e55f9
7
+ data.tar.gz: ed4cef33fefb8923ba3276440a596ca4122d8983407b2ed9513c29ed5d013b8d5cad28e92613f7329aa3c364f6d775692db088d021ef5f369ed5ae25029c5f4e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- et_fake_ccd (0.1.26)
4
+ et_fake_ccd (0.1.27)
5
5
  activemodel (~> 5.2, >= 5.2.3)
6
6
  puma (~> 3.12)
7
7
  roda (~> 3.21)
@@ -18,22 +18,6 @@ module EtFakeCcd
18
18
 
19
19
  private
20
20
 
21
- def initialize(*)
22
- super
23
- data['data']['ethosCaseReference'] = next_case_reference if data.dig('data', 'ethosCaseReference').nil? || data.dig('data', 'ethosCaseReference') == ''
24
- end
25
-
26
- def sequence_for_office(office_code)
27
- @sequences ||= {}
28
- @sequences[office_code] ||= 0
29
- @sequences[office_code] += 1
30
- end
31
-
32
- def next_case_reference
33
- office = data.dig('data', 'feeGroupReference')[0,2].to_i
34
- "#{office}#{sequence_for_office(office).to_s.rjust(5, '0')}/#{Time.now.year}"
35
- end
36
-
37
21
  def validate_data
38
22
  validate_claimant_type
39
23
  validate_primary_claimant
@@ -46,6 +46,9 @@ module EtFakeCcd
46
46
 
47
47
  def store(json, jid:, ctid:)
48
48
  self.id = id + 1
49
+ unless ctid =~ /Multiples/
50
+ json['data']['ethosCaseReference'] = next_case_reference(json.dig('data', 'feeGroupReference')[0,2].to_i) if json.dig('data', 'ethosCaseReference').nil? || json.dig('data', 'ethosCaseReference') == ''
51
+ end
49
52
  data[jid] ||= {}
50
53
  data[jid][ctid] ||= {}
51
54
  data[jid][ctid][id.to_s] = json
@@ -74,6 +77,16 @@ module EtFakeCcd
74
77
 
75
78
  attr_accessor :data, :id
76
79
 
80
+ def sequence_for_office(office_code)
81
+ @sequences ||= {}
82
+ @sequences[office_code] ||= 0
83
+ @sequences[office_code] += 1
84
+ end
85
+
86
+ def next_case_reference(office)
87
+ "#{office}#{sequence_for_office(office).to_s.rjust(5, '0')}/#{Time.now.year}"
88
+ end
89
+
77
90
  def filter(list, filters:)
78
91
  return list if filters.nil? || filters.empty?
79
92
 
@@ -1,3 +1,3 @@
1
1
  module EtFakeCcd
2
- VERSION = "0.1.26"
2
+ VERSION = "0.1.27"
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: 0.1.26
4
+ version: 0.1.27
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-09-05 00:00:00.000000000 Z
11
+ date: 2019-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: roda