cro 1.0.3 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README.md +26 -9
  2. data/VERSION +1 -1
  3. data/cro.gemspec +2 -2
  4. data/lib/cro/api.rb +7 -5
  5. metadata +4 -4
data/README.md CHANGED
@@ -15,13 +15,20 @@ Configure your API details:
15
15
  CRO::Config.email = "Your email address"
16
16
  CRO::Config.api_key = "Your API key"
17
17
 
18
+ ## Search for a company
19
+
18
20
  You can then search on companies with
19
21
 
20
- CRO::API.new.search("Company Name")
22
+ CRO::API.new.search("Company Name", search_type)
23
+
24
+ The different search_types are:
25
+ 1 = Exact match (will give very few results usually)
26
+ 2 = Starts with this phrase (default)
27
+ 3 = Contains this phrase (slowest, but more results)
21
28
 
22
29
  This will then return an array of results which you can access for example:
23
30
 
24
- @results = CRO::API.new.search("Starbucks")
31
+ @results = CRO::API.new.search("Starbucks", 3)
25
32
  @results.each do |result|
26
33
  puts result["company_name"]
27
34
  end
@@ -30,7 +37,9 @@ This will then return an array of results which you can access for example:
30
37
  # STARBUCKS COFFEE COMPANY (IRELAND) LIMITED
31
38
  # STARBUCKS COFFEE CORPORATION LIMITED
32
39
  # STARBUCKS COFFEE SHOPS LIMITED
33
-
40
+
41
+ ## Search for a company's official submissions
42
+
34
43
  You can also search on company submissions for offical documents. The company type is defined as "c" for company or "b" for business with the CRO.
35
44
 
36
45
  CRO::API.new.submissions("company_number", "company_type")
@@ -43,15 +52,23 @@ An example of which:
43
52
  puts submission["sub_type_desc"]
44
53
  end
45
54
 
46
- # Results
47
- # B10 CHANGE IN DIRECTOR OR SECRETARY
48
- # B5 RETURN OF ALLOTMENTS
49
- # G2- OR INCREASE IN NOMINAL SHARE
50
- # G2- OR INCREASE IN NOMINAL SHARE
51
- # G2- OR INCREASE IN NOMINAL SHARE
55
+ -> B10 CHANGE IN DIRECTOR OR SECRETARY
56
+ -> B5 RETURN OF ALLOTMENTS
57
+ -> G2- OR INCREASE IN NOMINAL SHARE
58
+ -> G2- OR INCREASE IN NOMINAL SHARE
59
+ -> G2- OR INCREASE IN NOMINAL SHARE
52
60
 
53
61
  These all currently return json results from the response.
54
62
 
63
+ ## View a submission in detail
64
+
65
+ You can view more details about any one submission with:
66
+
67
+ @submission = CRO::API.new.get_submission("6191121", "2")
68
+ puts @submission["scan_date"]
69
+
70
+ -> "2008-11-01T08:54:43Z"
71
+
55
72
  ## Contributing to cro
56
73
 
57
74
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.3
1
+ 1.1.3
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "cro"
8
- s.version = "1.0.3"
8
+ s.version = "1.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Brian Kenny"]
12
- s.date = "2012-05-01"
12
+ s.date = "2012-05-02"
13
13
  s.description = "A ruby gem that allows you to easily integrate with the Irish Companies Registration Offices API."
14
14
  s.email = "brian@minicorp.ie"
15
15
  s.extra_rdoc_files = [
@@ -5,14 +5,16 @@ module CRO
5
5
  @auth = {:username => "#{CRO::Config.email}", :password => "#{CRO::Config.api_key}"}
6
6
  end
7
7
 
8
- def search(company_name)
9
- @results = HTTParty.get(URI.escape(@@uri + "/companies?company_name=#{company_name}&searchType=3&format=json"), :basic_auth => @auth)
10
- return @results
8
+ def search(company_name, search_type)
9
+ HTTParty.get(URI.escape(@@uri + "/companies?company_name=#{company_name}&searchType=#{search_type}&company_bus_ind=E&format=json"), :basic_auth => @auth)
11
10
  end
12
11
 
13
12
  def submissions(company_num, company_type)
14
- @results = HTTParty.get(@@uri + "/submissions?company_bus_ind=" + company_type + "&company_num=" + company_num + "&format=json", :basic_auth => @auth)
15
- return @results
13
+ HTTParty.get(@@uri + "/submissions?company_bus_ind=" + company_type + "&company_num=" + company_num + "&format=json", :basic_auth => @auth)
14
+ end
15
+
16
+ def get_submission(sub_num, doc_num)
17
+ HTTParty.get(@@uri + "/submission/" + sub_num + "/" + doc_num + "?format=json&htmlEnc=1", :basic_auth => @auth)
16
18
  end
17
19
  end
18
20
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cro
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 0
8
+ - 1
9
9
  - 3
10
- version: 1.0.3
10
+ version: 1.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brian Kenny
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-05-01 00:00:00 Z
18
+ date: 2012-05-02 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  version_requirements: &id001 !ruby/object:Gem::Requirement