defra_ruby_mocks 5.4.1 → 5.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: efb2290f30c28bbc86c9b910aac27b675c2fc2e571d648d7b1464d6f60844396
4
- data.tar.gz: c3205f6fcf14ba5efecbbfde5ff1afc46b66fefa3aa65a78b23487396dbe70d5
3
+ metadata.gz: 18bac40cf18bbb2391ffc978e078f7f16be7ae7c870e2e327fc66ad65883c3ac
4
+ data.tar.gz: f67d7402285f994f1bae0f40dd403e8637e3ba6d53f9f2e4ec4e61521184d3e9
5
5
  SHA512:
6
- metadata.gz: 3ff3b5611d9409b0efb13621ef5afa071b52bf625c6d4b4534b2190c61d01a1752446ee426910134e01cf3a981515dbc4e3ad898c93077f0243803ebb67b4a31
7
- data.tar.gz: 4b06c4bc2fa793e68a01b2cfc4746e2a09e4576a4a0d8e7aabc57f6fa44f2d917c69f60eaf91f3bbb54d803b8bae171223c7a6e3abc76fdadbc264635f6112de
6
+ metadata.gz: 20079bce0c8a0718e308469b2c2f1ce8b577cc66e045e56bbd63c9acd8f67cbc6909a1e950d832f16381cf1f7847fbab44a5e6b30cd21e0ffd5adc16998bb45b
7
+ data.tar.gz: 3747fbddf8b2ec2ecc41e25ea694551e7cb683f848bd38e2d54f33e429a7774ae21d6c2209fc6595044ce911389fc2fc54b8abb08eabb7897dcf7dd6e52ba622
data/README.md CHANGED
@@ -127,6 +127,12 @@ Additionally, an `"active"` LLP company can be retrieved by using the following
127
127
  - `XX999999`
128
128
  - `YY999999`
129
129
 
130
+ #### Registered Societies
131
+
132
+ Registered Societies do not have a `company_status` field.
133
+
134
+ Any company number with the prefix `IP` or `SP` will be treated as a Registered Society and not return a company_status.
135
+
130
136
  The list of possible statuses was taken from
131
137
 
132
138
  - [Companies House API](https://developer.companieshouse.gov.uk/api/docs/company/company_number/companyProfile-resource.html)
@@ -9,12 +9,16 @@ module DefraRubyMocks
9
9
  # Examples we need to validate are
10
10
  # 10997904, 09764739
11
11
  # SC534714, CE000958
12
- # IP00141R, IP27702R, SP02252R
12
+ # IP00141R, IP27702R, SP02252R (Registered Societies)
13
13
  # https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/426891/uniformResourceIdentifiersCustomerGuide.pdf
14
14
  VALID_COMPANIES_HOUSE_REGISTRATION_NUMBER_REGEX = /\A(\d{8,8}$)|([a-zA-Z]{2}\d{6}$)|([a-zA-Z]{2}\d{5}[a-zA-Z]{1}$)\z/i
15
15
 
16
16
  NOT_FOUND = "99999999"
17
17
 
18
+ # Registered Societies do not have a company_status field.
19
+ # IP = England/Wales, SP = Scotland
20
+ REGISTERED_SOCIETY_PREFIXES = %w[IP SP].freeze
21
+
18
22
  def self.special_company_numbers
19
23
  {
20
24
  "05868270" => "dissolved",
@@ -37,8 +41,9 @@ module DefraRubyMocks
37
41
  raise NotFoundError unless valid_company_number?(company_number)
38
42
  raise NotFoundError if company_number == NOT_FOUND
39
43
 
40
- @company_status = specials[company_number] || "active"
41
- @company_type = llps.include?(company_number) ? "llp" : "ltd"
44
+ @company_number = company_number
45
+ @company_status = registered_society? ? nil : (specials[company_number] || "active")
46
+ @company_type = determine_type
42
47
 
43
48
  self
44
49
  end
@@ -51,6 +56,17 @@ module DefraRubyMocks
51
56
  company_number.match?(VALID_COMPANIES_HOUSE_REGISTRATION_NUMBER_REGEX)
52
57
  end
53
58
 
59
+ def registered_society?
60
+ REGISTERED_SOCIETY_PREFIXES.any? { |prefix| @company_number.upcase.start_with?(prefix) }
61
+ end
62
+
63
+ def determine_type
64
+ return "registered-society-non-jurisdictional" if registered_society?
65
+ return "llp" if llps.include?(@company_number)
66
+
67
+ "ltd"
68
+ end
69
+
54
70
  def specials
55
71
  self.class.special_company_numbers
56
72
  end
@@ -1,4 +1,4 @@
1
- // https://developer-specs.company-information.service.gov.uk/companies-house-public-data-api/resources/officerlist
1
+ <%# https://developer-specs.company-information.service.gov.uk/companies-house-public-data-api/resources/officerlist %>
2
2
  {
3
3
  "items": [
4
4
  {
@@ -1,7 +1,9 @@
1
- // https://developer-specs.company-information.service.gov.uk/companies-house-public-data-api/resources/companyprofile
1
+ <%# https://developer-specs.company-information.service.gov.uk/companies-house-public-data-api/resources/companyprofile %>
2
2
  {
3
3
  "company_name": "Acme Industries",
4
+ <% if @company_status %>
4
5
  "company_status": "<%= @company_status %>",
6
+ <% end %>
5
7
  "type": "<%= @company_type %>",
6
8
  "registered_office_address": {
7
9
  "address_line_1": "10 Downing St",
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DefraRubyMocks
4
- VERSION = "5.4.1"
4
+ VERSION = "5.4.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: defra_ruby_mocks
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.4.1
4
+ version: 5.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Defra
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2026-08-25 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rails
@@ -128,7 +127,6 @@ licenses:
128
127
  - The Open Government Licence (OGL) Version 3
129
128
  metadata:
130
129
  rubygems_mfa_required: 'true'
131
- post_install_message:
132
130
  rdoc_options: []
133
131
  require_paths:
134
132
  - lib
@@ -143,8 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
141
  - !ruby/object:Gem::Version
144
142
  version: '0'
145
143
  requirements: []
146
- rubygems_version: 3.4.10
147
- signing_key:
144
+ rubygems_version: 3.6.9
148
145
  specification_version: 4
149
146
  summary: Defra Ruby on Rails external API mocking engine
150
147
  test_files: []