govuk-registers-api-client 1.2.2 → 2.0.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: 7f7255531beb62757b687bca64cdb1feac0cf5690721d8d077ec1c9ed28efc29
4
- data.tar.gz: 34102fd731138280dedfa840fec231e6c1e97c655fe8305abc61a0a60f272c57
3
+ metadata.gz: 3c79b43538961d0c037891bc4eaa67e0da7bf69050a2cd7c2a1336dff51b0c2a
4
+ data.tar.gz: 61e8dd48b0039c5c056a84a36d533c2b0a524f009123cbc350e48f8c92af10b4
5
5
  SHA512:
6
- metadata.gz: 9b86d0ac3f0eb441fdca95db5db5719d33c97bdaee45449b502f836b8f9c973a74f3880e60d31a2284fa48142b7282d5acbdd788435acb8f86496d88dc96b410
7
- data.tar.gz: fd3685dc4850cf98236494a3fecf0574b15a2948bf9dec18ac957511fe33070000e40c3f4f5f26cdbffbadf44fa3b0467bb303f29ffdee25d9178123cf286739
6
+ metadata.gz: ac33158386fee446b0ff90467a32aea323966da03f04e03393b017b9f1eb7adeadb54316a493ccd240e74a0c7eb07c41d0e4c27912215d6045f7c1cfa09efc94
7
+ data.tar.gz: 3986be8a39634b281f86aa256d40dcc7917cbb30899fdd47e3c515983b62382429a8856fc71b84bef9cbda9c6e4a2d1324c121ed0d0d8137e16d75d962eab4eb
data/.version CHANGED
@@ -1 +1 @@
1
- 1.2.2
1
+ 2.0.0
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: govuk-registers-api-client 1.2.2 ruby lib
2
+ # stub: govuk-registers-api-client 2.0.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "govuk-registers-api-client".freeze
@@ -8,7 +8,6 @@ Gem::Specification.new do |s|
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
10
10
  s.authors = ["GOV.UK Registers Team (Government Digital Service)".freeze]
11
- s.date = "2017-11-06"
12
11
  s.email = "registers ~@nospam@~ digital.cabinet-office.gov.uk".freeze
13
12
  s.extra_rdoc_files = ["README.md".freeze]
14
13
  s.files = `git ls-files -z`.split("\x0").reject do |f|
@@ -22,7 +21,7 @@ Gem::Specification.new do |s|
22
21
 
23
22
  if s.respond_to? :specification_version then
24
23
  s.specification_version = 4
25
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.2') then
24
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('2.0.0') then
26
25
  s.add_runtime_dependency(%q<rest-client>.freeze, ["~> 2"])
27
26
  else
28
27
  s.add_dependency(%q<rest-client>.freeze, ["~> 2"])
@@ -26,12 +26,6 @@ module DataStore
26
26
  def get_latest_entry_number(entry_type)
27
27
  end
28
28
 
29
- def get_root_hash
30
- end
31
-
32
- def set_root_hash(root_hash)
33
- end
34
-
35
29
  def after_load
36
30
  end
37
31
  end
@@ -86,14 +86,6 @@ module RegistersClient
86
86
  entry.nil? ? 0 : entry.entry_number
87
87
  end
88
88
 
89
- def get_root_hash
90
- @data[:root_hash]
91
- end
92
-
93
- def set_root_hash(root_hash)
94
- @data[:root_hash] = root_hash
95
- end
96
-
97
89
  def after_load
98
90
  end
99
91
 
@@ -1,7 +1,5 @@
1
1
  require 'rest-client'
2
2
  require 'json'
3
- require 'exceptions/invalid_register_error'
4
- require 'exceptions/invalid_hash_value_error'
5
3
 
6
4
  module RegistersClient
7
5
  class RegisterClient
@@ -77,19 +75,9 @@ module RegistersClient
77
75
  RecordCollection.new(get_records.select { |record| record.item.has_end_date }, @page_size)
78
76
  end
79
77
 
80
- def get_root_hash
81
- root_hash = @data_store.get_root_hash
82
- if !is_valid_hash_value(root_hash)
83
- raise InvalidHashValueError
84
- end
85
- return root_hash
86
- end
87
-
88
78
  def refresh_data
89
79
  user_entry_number = @data_store.get_latest_entry_number(:user)
90
80
  rsf = download_rsf(user_entry_number)
91
-
92
- validate_register_integrity(rsf, user_entry_number)
93
81
  update_data_from_rsf(rsf, user_entry_number, @data_store)
94
82
  end
95
83
 
@@ -118,20 +106,6 @@ module RegistersClient
118
106
  records_with_history
119
107
  end
120
108
 
121
- def get_register_proof
122
- @register_proof = JSON.parse(register_http_request('proof/register/merkle:sha-256'))
123
- end
124
-
125
- def validate_register_integrity(rsf, current_entry_number)
126
- rsf_lines = rsf.split("\n")
127
- expected_root_hash = rsf_lines[0].split("\t")[1]
128
- local_root_hash = @data_store.get_root_hash
129
-
130
- if (local_root_hash != expected_root_hash)
131
- raise InvalidRegisterError, 'Register has been reloaded with different data - root hashes do not match'
132
- end
133
- end
134
-
135
109
  def download_rsf(start_entry_number)
136
110
  register_http_request("download-rsf/#{start_entry_number}")
137
111
  end
@@ -161,9 +135,6 @@ module RegistersClient
161
135
  data_store.append_entry(entry)
162
136
  end
163
137
  end
164
- elsif command == 'assert-root-hash'
165
- root_hash = line.split("\t")[1]
166
- data_store.set_root_hash(root_hash)
167
138
  end
168
139
  end
169
140
 
@@ -182,9 +153,5 @@ module RegistersClient
182
153
 
183
154
  RestClient.get(@register_url.merge(path).to_s, headers)
184
155
  end
185
-
186
- def is_valid_hash_value(hash_value)
187
- (/sha-256:+\h{64}/) === hash_value
188
- end
189
156
  end
190
157
  end
@@ -2,7 +2,7 @@ require 'register_client'
2
2
  require 'in_memory_data_store'
3
3
 
4
4
  module RegistersClient
5
- VERSION = '1.2.2'
5
+ VERSION = '2.0.0'
6
6
  class RegisterClientManager
7
7
  def initialize(config_options = {})
8
8
  @config_options = defaults.merge(config_options)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk-registers-api-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Registers Team (Government Digital Service)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-06 00:00:00.000000000 Z
11
+ date: 2019-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -46,8 +46,6 @@ files:
46
46
  - lib/data_store.rb
47
47
  - lib/entry.rb
48
48
  - lib/entry_collection.rb
49
- - lib/exceptions/invalid_hash_value_error.rb
50
- - lib/exceptions/invalid_register_error.rb
51
49
  - lib/in_memory_data_store.rb
52
50
  - lib/item.rb
53
51
  - lib/item_collection.rb
@@ -77,8 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
75
  - !ruby/object:Gem::Version
78
76
  version: '0'
79
77
  requirements: []
80
- rubyforge_project:
81
- rubygems_version: 2.7.7
78
+ rubygems_version: 3.0.3
82
79
  signing_key:
83
80
  specification_version: 4
84
81
  summary: Client library for GOV.UK Registers
@@ -1,5 +0,0 @@
1
- class InvalidHashValueError < StandardError
2
- def initialize(msg='Value must be a sha-256 hash string prefixed with "sha-256:"')
3
- super
4
- end
5
- end
@@ -1,2 +0,0 @@
1
- class InvalidRegisterError < StandardError
2
- end