companies_house_hub 0.1.8 → 0.1.9
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: 29c2c6ef2a7320dce0f29392bc87d82a6458c67eeb8637ecc4e3abf3b493e223
|
4
|
+
data.tar.gz: 961885964947c2a58fc6ed08342af17cd0c113873f2484b4150580496573c71e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d319f8a46e9d1187a34b5f69b04098b6de552013a549501598018f060f970faa10fd6cbc0098ec161f43cebe25f45e4bf7de099df75371b890b1f1b98ad6d98e
|
7
|
+
data.tar.gz: bee69f4ce39a230a3a66399cbd4ef53787ebe2d77c1b0823d6d1c2e51c002f0e553b2471497f25dce7cce3ab11398c18524cbe7f8b6999ddb55667c35e363d66
|
data/bin/console
CHANGED
@@ -20,11 +20,13 @@ module CompaniesHouseHub
|
|
20
20
|
|
21
21
|
result = get(format_url(FIND_PATH, company_number: company_number), options)
|
22
22
|
|
23
|
-
|
23
|
+
items = result.body.dig(:items) || []
|
24
|
+
|
25
|
+
return [] unless items.any?
|
24
26
|
|
25
27
|
# Get all items and create a new history. If the description is 'legacy' then we can safely
|
26
28
|
# ignore that document.
|
27
|
-
filing_histories =
|
29
|
+
filing_histories = items.map do |filing_json|
|
28
30
|
next if filing_json.dig(:description) == LEGACY_DOC_DESCRIPTION
|
29
31
|
|
30
32
|
new(filing_json, company_number)
|
@@ -15,11 +15,20 @@ module CompaniesHouseHub
|
|
15
15
|
|
16
16
|
result = get(format_url(FIND_PATH, company_number: company_number), options)
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
# For some companies, for some reason, this endpoint returns an error, like this:
|
19
|
+
# {
|
20
|
+
# "errors": [
|
21
|
+
# {
|
22
|
+
# "error": "company-psc-not-found",
|
23
|
+
# "type": "ch:service"
|
24
|
+
# }
|
25
|
+
# ]
|
26
|
+
# }
|
27
|
+
items = result.body.dig(:items) || []
|
28
|
+
|
29
|
+
return [] unless items.any?
|
30
|
+
|
31
|
+
items.map { |person_json| new(person_json) }
|
23
32
|
end
|
24
33
|
|
25
34
|
def initialize(json = {})
|