govkit-ca 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +40 -26
- data/govkit-ca.gemspec +2 -2
- data/lib/gov_kit-ca/version.rb +1 -1
- data/spec/represent_spec.rb +2 -2
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b44b9cc3b62c1163535fa0ee46bc143994f8ad32
|
4
|
+
data.tar.gz: ee852be65977e67cbd1ce13780e6fc8434a1d1a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7044e9f6a297689a7b42b1a4b67804b3b004f322a3d8ccee565f6fd21c2bcc83b656f5de7f02d401f8db798604f674338bcdcdc46be714b90ac0657d3a4e5fa9
|
7
|
+
data.tar.gz: 82c9e33e38c479cde9d90d6c66359c325e5acdca7431d87c1e76ef6a10f6c2c8e3bc607344362780286cdeefe28d156e161d8f766450e11112e58c7b193c4d1b
|
data/README.md
CHANGED
@@ -5,7 +5,31 @@
|
|
5
5
|
[![Coverage Status](https://coveralls.io/repos/opennorth/govkit-ca/badge.png?branch=master)](https://coveralls.io/r/opennorth/govkit-ca)
|
6
6
|
[![Code Climate](https://codeclimate.com/github/opennorth/govkit-ca.png)](https://codeclimate.com/github/opennorth/govkit-ca)
|
7
7
|
|
8
|
-
GovKit-CA is a Ruby gem that provides easy access to Canadian civic
|
8
|
+
GovKit-CA is a Ruby gem that provides easy access to Canadian civic information around the web.
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
gem install govkit-ca
|
13
|
+
|
14
|
+
## Represent API
|
15
|
+
|
16
|
+
GovKit-CA provides a Represent API client.
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
require 'govkit-ca'
|
20
|
+
client = GovKit::CA::Represent.new
|
21
|
+
client.postcodes('A1A1A1')
|
22
|
+
client.representative_sets(limit: 0)
|
23
|
+
client.representatives(representative_set: 'toronto-city-council')
|
24
|
+
client.boundary_sets(limit: 0)
|
25
|
+
client.boundaries(boundary_set: 'toronto-wards')
|
26
|
+
```
|
27
|
+
|
28
|
+
Read the full documentation on [RubyDoc.info](http://rubydoc.info/gems/govkit-ca/GovKit/CA/Represent).
|
29
|
+
|
30
|
+
## Postal code to electoral district lookup
|
31
|
+
|
32
|
+
GovKit-CA provides an API for free postal code to electoral district lookups, using the following sources:
|
9
33
|
|
10
34
|
* [elections.ca](http://elections.ca/)
|
11
35
|
* [cbc.ca](http://www.cbc.ca/)
|
@@ -16,38 +40,28 @@ GovKit-CA is a Ruby gem that provides easy access to Canadian civic data around
|
|
16
40
|
* [parl.gc.ca](http://www.parl.gc.ca/)
|
17
41
|
* [conservative.ca](http://www.conservative.ca/)
|
18
42
|
|
19
|
-
|
20
|
-
|
21
|
-
# Installation
|
22
|
-
|
23
|
-
gem install govkit-ca
|
43
|
+
```ruby
|
44
|
+
require 'govkit-ca'
|
24
45
|
|
25
|
-
#
|
46
|
+
GovKit::CA::PostalCode.find_electoral_districts_by_postal_code('A1A1A1') # [10007]
|
47
|
+
GovKit::CA::PostalCode.find_electoral_districts_by_postal_code('K0A1K0') # [35012, 35025, 35040, 35052, 35063, 35064, 35087]
|
48
|
+
GovKit::CA::PostalCode.find_electoral_districts_by_postal_code('H0H0H0') # raises GovKit::CA::ResourceNotFound
|
26
49
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
>> GovKit::CA::PostalCode.find_electoral_districts_by_postal_code('K0A1K0')
|
32
|
-
=> [35012, 35025, 35040, 35052, 35063, 35064, 35087]
|
33
|
-
>> GovKit::CA::PostalCode.find_electoral_districts_by_postal_code('H0H0H0')
|
34
|
-
=> GovKit::CA::ResourceNotFound
|
35
|
-
|
36
|
-
>> GovKit::CA::PostalCode.find_province_by_postal_code('A1A1A1')
|
37
|
-
=> "Newfoundland and Labrador"
|
38
|
-
>> GovKit::CA::PostalCode.find_province_by_postal_code('K0A1K0')
|
39
|
-
=> "Ontario"
|
40
|
-
>> GovKit::CA::PostalCode.find_province_by_postal_code('H0H0H0')
|
41
|
-
=> "Quebec"
|
50
|
+
GovKit::CA::PostalCode.find_province_by_postal_code('A1A1A1') # "Newfoundland and Labrador"
|
51
|
+
GovKit::CA::PostalCode.find_province_by_postal_code('K0A1K0') # "Ontario"
|
52
|
+
GovKit::CA::PostalCode.find_province_by_postal_code('H0H0H0') # "Quebec"
|
53
|
+
```
|
42
54
|
|
43
55
|
Postal codes may contain lowercase letters. Spaces and non-alphanumeric characters are removed before processing.
|
44
56
|
|
45
|
-
GovKit-CA will raise GovKit::CA::ResourceNotFound if the electoral districts within a postal code cannot be determined, and GovKit::CA::InvalidRequest if a postal code is not properly formatted.
|
57
|
+
GovKit-CA will raise `GovKit::CA::ResourceNotFound` if the electoral districts within a postal code cannot be determined, and `GovKit::CA::InvalidRequest` if a postal code is not properly formatted.
|
58
|
+
|
59
|
+
## Acknowledgements
|
46
60
|
|
47
|
-
|
61
|
+
GovKit-CA interoperates with the [Participatory Politics Foundation](http://www.participatorypolitics.org/)'s [GovKit](https://github.com/opengovernment/govkit). GovKit-CA is not affiliated with the Participatory Politics Foundation or GovKit.
|
48
62
|
|
49
|
-
|
63
|
+
## Bugs? Questions?
|
50
64
|
|
51
65
|
This gem's main repository is on GitHub: [http://github.com/opennorth/govkit-ca](http://github.com/opennorth/govkit-ca), where your contributions, forks, bug reports, feature requests, and feedback are greatly welcomed.
|
52
66
|
|
53
|
-
Copyright (c) 2011
|
67
|
+
Copyright (c) 2011 Open North Inc., released under the MIT license
|
data/govkit-ca.gemspec
CHANGED
@@ -21,10 +21,10 @@ Gem::Specification.new do |s|
|
|
21
21
|
|
22
22
|
s.add_runtime_dependency('faraday')
|
23
23
|
s.add_runtime_dependency('httparty', '~> 0.10.0')
|
24
|
-
s.add_runtime_dependency('nokogiri', '~> 1.
|
24
|
+
s.add_runtime_dependency('nokogiri', '~> 1.6.0')
|
25
25
|
s.add_development_dependency('json')
|
26
26
|
s.add_development_dependency('rspec', '~> 2.6.0')
|
27
|
-
s.add_development_dependency('rake')
|
27
|
+
s.add_development_dependency('rake', '~> 10.1.0')
|
28
28
|
s.add_development_dependency('coveralls')
|
29
29
|
s.add_development_dependency('mime-types', '~> 1.16')
|
30
30
|
end
|
data/lib/gov_kit-ca/version.rb
CHANGED
data/spec/represent_spec.rb
CHANGED
@@ -167,7 +167,7 @@ describe GovKit::CA::Represent do
|
|
167
167
|
end
|
168
168
|
|
169
169
|
it 'should raise an error if the point is invalid' do
|
170
|
-
expect{api.boundaries(:contains => '0,0,0')}.to raise_error(GovKit::CA::InvalidRequest, "400 http://represent.opennorth.ca/boundaries/?contains=0,0,0 Invalid
|
170
|
+
expect{api.boundaries(:contains => '0,0,0')}.to raise_error(GovKit::CA::InvalidRequest, "400 http://represent.opennorth.ca/boundaries/?contains=0,0,0 Invalid latitude,longitude '0,0,0' provided.")
|
171
171
|
end
|
172
172
|
|
173
173
|
it 'should raise an error if the boundary set does not exist' do
|
@@ -269,7 +269,7 @@ describe GovKit::CA::Represent do
|
|
269
269
|
end
|
270
270
|
|
271
271
|
it 'should raise an error if the point is invalid' do
|
272
|
-
expect{api.representatives(:point => '0,0,0')}.to raise_error(GovKit::CA::InvalidRequest, "400 http://represent.opennorth.ca/representatives/?point=0,0,0 Invalid
|
272
|
+
expect{api.representatives(:point => '0,0,0')}.to raise_error(GovKit::CA::InvalidRequest, "400 http://represent.opennorth.ca/representatives/?point=0,0,0 Invalid latitude,longitude '0,0,0' provided.")
|
273
273
|
end
|
274
274
|
|
275
275
|
it 'should not raise an error if the representative set does not exist' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govkit-ca
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Open North
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.6.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.6.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: json
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,16 +84,16 @@ dependencies:
|
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 10.1.0
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 10.1.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: coveralls
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|