companies_house_client 0.0.1 → 0.0.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
  SHA1:
3
- metadata.gz: 50896e2d1da28f734cbd6c8a6cbae9859ab196db
4
- data.tar.gz: b8f80f042bf138cdc979bef786fff4b10d1f7352
3
+ metadata.gz: ae7a9bca2c3c65f19f0a56ca47dac8ff16353d46
4
+ data.tar.gz: 7df0a18bab9de3e4ca353e40484efcc721a1cb02
5
5
  SHA512:
6
- metadata.gz: 92d4f8a1d54a754e296d156891a5048c386ee3236687b59273b6f223635de0164e4227c876a8579bdd0540426eedc3f9d2133a938b5225bd08d6ba39d56b6b49
7
- data.tar.gz: 303c9aa305fd9bdd6d8092cf717a686882e9534353fd242a2497ea9e098221c0c581b29a1ba6477dc96a835569a178d095511b56b92866120b1efc1a20d43641
6
+ metadata.gz: f2ea9b2e997ef34c5e887c7b136f1452e89d614475f5649e3a51a5f5ad038b73fb030e039fe05055e11974f081238801e7fee72ffb42f723f6b21a60a014256b
7
+ data.tar.gz: 84eb103022d3f9b55e8444cf8ab32a4f2d5f77c1e70782b31fb8fa16aefe91d5f71e341153f726d789fbf8f7d4710bc009beb8c1f4834a87fe3b7862f71d7cb9
data/README.md CHANGED
@@ -61,10 +61,25 @@ c = CompaniesHouseClient::Company.find("company number")
61
61
  c.officers #returns a collection of Officer objects.
62
62
  ```
63
63
 
64
+ If you just want a list of officers for a given company, you can save a request to the /company endpoint like this:
65
+
66
+ ```
67
+ CompaniesHouseClient::Officer.all(company_id: "company number") #will return a collection directly from the officers endpoint
68
+ ```
69
+
70
+ ### Filing History
71
+ You can get a list of the company's filing history entries like this:
72
+
73
+ ```
74
+ c = CompaniesHouseClient::Company.find("company number")
75
+ c.filing_histories #returns a collection of FilingHistory objects - note plural on the relation name
76
+ ```
64
77
 
65
78
  ## To do
66
79
 
67
- * We should be able to get a history of accounts.
80
+ * There are Appointments and Charges endpoints set up, and they're documented in the API docs, but they return a 404 for all companies. No idea why.
81
+ * Some tests would be nice.
82
+ * There an issue with the [Her](https://github.com/remiprev/her) where it expects the child resource to have a reference to a parent, which this API doesn't. So you get `(<unknown path, missing `company_id`>)` in the responses for child objects. There is probably a solution.
68
83
 
69
84
  # Licence
70
85
  This gem is MIT licenced. Have fun!
@@ -44,6 +44,7 @@ module CompaniesHouseClient
44
44
 
45
45
  # Parse collections
46
46
  c.use CompaniesHouseClient::CollectionParser
47
+ # c.use Her::Middleware::DefaultParseJSON
47
48
 
48
49
  # Adapter
49
50
  c.use Faraday::Adapter::NetHttp
@@ -12,7 +12,9 @@ module CompaniesHouseClient
12
12
  def on_complete(env)
13
13
  json = MultiJson.load(env[:body], symbolize_keys: true)
14
14
  env[:body] = {
15
- data: json.has_key?(:items) ? json[:items] : json
15
+ data: json.has_key?(:items) ? json[:items] : json,
16
+ errors: json[:errors],
17
+ metadata: json.except(:items)
16
18
  }
17
19
  end
18
20
  end
@@ -0,0 +1,6 @@
1
+ module CompaniesHouseClient
2
+ class Appointment < Base
3
+ belongs_to :company, path: "/company/:id"
4
+ collection_path "/company/:company_id/appointments"
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module CompaniesHouseClient
2
+ class Appointment < Base
3
+ belongs_to :company, path: "/company/:id"
4
+ collection_path "/company/:company_id/charges"
5
+ end
6
+ end
@@ -1,6 +1,10 @@
1
1
  module CompaniesHouseClient
2
2
  class Company < Base
3
- has_many :officers
3
+ has_one :registered_office_address, path: "/registered-office-address"
4
+ has_many :officers, path: "/officers"
5
+ has_many :filing_histories, path: "/filing-history"
6
+ has_many :appointments, path: "/appointments"
7
+ has_many :charges, path: "/charges"
4
8
  collection_path "/company"
5
9
  primary_key :company_number
6
10
 
@@ -0,0 +1,7 @@
1
+ module CompaniesHouseClient
2
+ class FilingHistory < Base
3
+ belongs_to :company, path: "/company/:id"
4
+ primary_key :transaction_id
5
+ collection_path "/company/:company_id/filing-history"
6
+ end
7
+ end
@@ -1,5 +1,6 @@
1
1
  module CompaniesHouseClient
2
2
  class Officer < Base
3
- belongs_to :company
3
+ belongs_to :company, path: "/company/:id"
4
+ collection_path "/company/:company_id/officers"
4
5
  end
5
6
  end
@@ -0,0 +1,6 @@
1
+ module CompaniesHouseClient
2
+ class RegisteredOfficeAddress < Base
3
+ belongs_to :company, path: "/company/:id"
4
+ collection_path "/company/:company_id/registered-office-address"
5
+ end
6
+ end
@@ -1,3 +1,3 @@
1
1
  module CompaniesHouseClient
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: companies_house_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ed Jones
@@ -85,8 +85,12 @@ files:
85
85
  - lib/companies_house_client/base.rb
86
86
  - lib/companies_house_client/ca_path.rb
87
87
  - lib/companies_house_client/collection_parser.rb
88
+ - lib/companies_house_client/models/appointment.rb
89
+ - lib/companies_house_client/models/charge.rb
88
90
  - lib/companies_house_client/models/company.rb
91
+ - lib/companies_house_client/models/filing_history.rb
89
92
  - lib/companies_house_client/models/officer.rb
93
+ - lib/companies_house_client/models/registered_office_address.rb
90
94
  - lib/companies_house_client/version.rb
91
95
  homepage: https://github.com/errorstudio/companies_house_client
92
96
  licenses: