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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e58a517d9f96338f427bcfbb1c44708a0c884465
4
- data.tar.gz: e627c42f76ebcb8c7f4f67dc5f4111d321dbfc92
3
+ metadata.gz: b44b9cc3b62c1163535fa0ee46bc143994f8ad32
4
+ data.tar.gz: ee852be65977e67cbd1ce13780e6fc8434a1d1a2
5
5
  SHA512:
6
- metadata.gz: b12f06c40c84cc8306d3cedffefb28b2282e7b275d1fe032d409a30f94130d9e260d264172e12d9d07664d8b23e8c076df909b67542d9d0e71c44bdb90edc2bd
7
- data.tar.gz: 145f7062965b4e230b84b5d001aa4950e9871d113deedc280aeef6c8a71f096973da26e91d1fc3889cde2ad5bfef035430ff7b921dbd1a58e58f258911513d6f
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 data around the web. It currently provides an API for free postal code to electoral district lookups, using the following sources:
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
- GovKit-CA follows from [Participatory Politics Foundation](http://www.participatorypolitics.org/)'s [GovKit](https://github.com/opengovernment/govkit) gem. GovKit-CA is not affiliated with the Participatory Politics Foundation or GovKit.
20
-
21
- # Installation
22
-
23
- gem install govkit-ca
43
+ ```ruby
44
+ require 'govkit-ca'
24
45
 
25
- # Examples
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
- >> require 'govkit-ca'
28
-
29
- >> GovKit::CA::PostalCode.find_electoral_districts_by_postal_code('A1A1A1')
30
- => [10007]
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
- # Bugs? Questions?
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
- GovKit-CA interoperates with [Participatory Politics Foundation](http://www.participatorypolitics.org/)'s [GovKit](https://github.com/opengovernment/govkit). Please join the [GovKit Google Group](http://groups.google.com/group/govkit), especially if you'd like to talk about a new feature and get announcements.
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-2013 Open North Inc., released under the MIT license
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.5.0')
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
@@ -1,5 +1,5 @@
1
1
  module GovKit
2
2
  module CA
3
- VERSION = "0.0.8"
3
+ VERSION = "0.0.9"
4
4
  end
5
5
  end
@@ -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 lat/lon values")
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 lat/lon values")
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.8
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-03-27 00:00:00.000000000 Z
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.5.0
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.5.0
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: '0'
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: '0'
96
+ version: 10.1.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: coveralls
99
99
  requirement: !ruby/object:Gem::Requirement