companies_house_hub 0.0.4 → 0.0.5

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: 9ea6132366d0ddd6973acf012b8d48612d3070a8e15d131d21e1a0911e3141b2
4
- data.tar.gz: fe4243c4a4a59fde93e00521cb701b211bbb5ada3daf524722469013808c63bb
3
+ metadata.gz: 427a9269943a75cb51ba365014cd273596f76179ef1d6a9fa69d50f73723c298
4
+ data.tar.gz: 287f7117eb64f50d6f9843866c194fd9cc08d9ca6935d26e8b09db6e11bb5505
5
5
  SHA512:
6
- metadata.gz: 515164f0720bdfc7f5363508f2b14e9e5c504d5acd12f9b2fe798721e2a7fec1e63d4ae676bb421640eef6b8065af1a52115dc505f750c6364969289ff633091
7
- data.tar.gz: 321b69386d473106007b0293de743ea124d80ba61fb310ac5fbe57d396f99daec54a798ff1d06083d3a06cd85ba48dca4c3295594aa588f63b3db59d9756279c
6
+ metadata.gz: e0a8808076471fa6f45ade50cca926b76c4e28cfbc978cb176d9a1d21abca0fdc906cd1ab7cd6d7538c672f425441a45a2a95e2322c5394c9789c9ed3c0e459d
7
+ data.tar.gz: b9519c438bea48f79f18205422761f9f33649343c27cfc090aeae1c799a17cb94a1aefb9578f1a35328cdb15ced7a986eba1f670f053ecc791d4c5ec61627582
@@ -35,4 +35,6 @@ Gem::Specification.new do |spec|
35
35
  spec.add_development_dependency 'rubocop', '~> 0.54.0'
36
36
  spec.add_development_dependency 'rubocop-rspec'
37
37
  spec.add_development_dependency 'simplecov'
38
+ spec.add_development_dependency 'vcr'
39
+ spec.add_development_dependency 'webmock'
38
40
  end
@@ -11,6 +11,9 @@ module CompaniesHouseHub
11
11
 
12
12
  attr_reader :number, :name, :created_at, :address
13
13
 
14
+ alias company_number number
15
+ alias company_name name
16
+
14
17
  def self.search(name, per_page:, start:)
15
18
  options = { q: name, items_per_page: per_page, start_index: start }
16
19
 
@@ -24,17 +27,19 @@ module CompaniesHouseHub
24
27
 
25
28
  result = get(url, params)
26
29
 
30
+ return unless result.success?
31
+
27
32
  new(result.body)
28
33
  end
29
34
 
30
35
  def initialize(json = {})
31
- @number = json.fetch(:company_number)
32
- @has_been_liquidated = json.fetch(:has_been_liquidated)
33
- @jurisdiction = json.fetch(:jurisdiction)
34
- @name = json.fetch(:company_name)
35
- @created_at = json.fetch(:date_of_creation)
36
- @address = Address.new(json.fetch(:registered_office_address))
37
- @status = json.fetch(:company_status)
36
+ @number = json.dig(:company_number)
37
+ @has_been_liquidated = json.dig(:has_been_liquidated)
38
+ @jurisdiction = json.dig(:jurisdiction)
39
+ @name = json.dig(:company_name)
40
+ @created_at = json.dig(:date_of_creation)
41
+ @address = Address.new(json.dig(:registered_office_address))
42
+ @status = json.dig(:company_status)
38
43
  end
39
44
 
40
45
  def filing_histories
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CompaniesHouseHub
4
- VERSION = '0.0.4'
4
+ VERSION = '0.0.5'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: companies_house_hub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricardo Otero
@@ -150,6 +150,34 @@ dependencies:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: vcr
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: webmock
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
153
181
  description: A REST client for the UK Companies House API, including authentication
154
182
  email:
155
183
  - oterosantos@gmail.com