companies_house_hub 0.1.0 → 0.1.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c86759b60db04a511fc4032bba8893c5c038e1ece25fd619fc5bf36ba9d3c723
|
4
|
+
data.tar.gz: 0af0d49515a6ff50ef524bee5c09197413662b0a56c83200ed4ce35cbce58aba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3d8d79bb0ac051de83e906ed01b53ca917442ea05924eab841c9ec3156330d23f5f5b3091aec5b81ce09eafc4f089e5ba5cb876a60dc3f9f5f1bc6d42a0d9df
|
7
|
+
data.tar.gz: ea281426979ff2bf93bc6d2c1e312a7c3e84788d396f1a787b65c4b9b629ceb201709c51b5f3df62c9b1d9e8a10ae5cf38c286c5bf8b97253955f61373ff7e88
|
@@ -38,8 +38,9 @@ module CompaniesHouseHub
|
|
38
38
|
@action_date = json.dig(:action_date)
|
39
39
|
@date = json.dig(:date)
|
40
40
|
@type = json.dig(:type)
|
41
|
-
@barcode = json.dig(:barcode)
|
42
41
|
@links = json.dig(:links)
|
42
|
+
@transaction_id = json.dig(:transaction_id) # helps on barcode generation
|
43
|
+
@barcode = json.dig(:barcode) || generate_barcode
|
43
44
|
@description_values = json.dig(:description_values)
|
44
45
|
end
|
45
46
|
|
@@ -54,5 +55,16 @@ module CompaniesHouseHub
|
|
54
55
|
|
55
56
|
URI.join(DOCUMENT_URL, document_path).to_s
|
56
57
|
end
|
58
|
+
|
59
|
+
private
|
60
|
+
|
61
|
+
# Sometimes the barcode comes as nil for some reason so we generate one based on the url. If the
|
62
|
+
# URL is also not defined then we hope for the best and use other variables.
|
63
|
+
def generate_barcode
|
64
|
+
string = @links[:self] if @links
|
65
|
+
string ||= [@description, @type, @transaction_id].compact.join
|
66
|
+
|
67
|
+
Digest::SHA1.hexdigest(string)[0..6].upcase
|
68
|
+
end
|
57
69
|
end
|
58
70
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: companies_house_hub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ricardo Otero
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|