everypolitician 0.13.0 → 0.16.0

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: 049d21610458ca4158fbc452bf99fe57b88443ff
4
- data.tar.gz: a4c2bc68a937231ac8a6758f0a46ec1a32e4c7b5
3
+ metadata.gz: 4bedfe572ee426991d485dae5e4cdb560bf420b7
4
+ data.tar.gz: f16cfb29ea82d545d87dabee7f416f8630926448
5
5
  SHA512:
6
- metadata.gz: ba198093b9ac78b87a542c8d601634b8619732d64c16bf51f831498287e501832b72065f2d05ff162e3bd611c99e57662772d7fb98347d0fd8398bfa72d762c2
7
- data.tar.gz: fe87ab19b2fc7bdafb30e38a7ebc120c402902a47ab85d75026c49a3501f140a10a1d5c9e04ef955fa4e3e62dddb6fcdba35ab611f305f302ec0bef08e50d313
6
+ metadata.gz: de85e589d4962fae623a3b135ce987558adfbdb429448a9ff56acd280cc9835887ef99d4cdc05c2099fc6178ff56233673a69f45d5c97dd1e0e233b427f6d602
7
+ data.tar.gz: 571923c0257d6d574363129378c9ba26dbfe7965e16727d7730c2de8c617187d463fa1308264cd35eac2453822366a5bdd93427ed946ee85323348f6e7a8e331
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2016-08-15 19:54:18 +0100 using RuboCop version 0.42.0.
3
+ # on 2016-08-22 12:52:01 +0100 using RuboCop version 0.42.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -13,7 +13,7 @@ Metrics/AbcSize:
13
13
  # Offense count: 1
14
14
  # Configuration parameters: CountComments.
15
15
  Metrics/ClassLength:
16
- Max: 152
16
+ Max: 105
17
17
 
18
18
  # Offense count: 20
19
19
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
data/CHANGELOG.md CHANGED
@@ -5,6 +5,29 @@ This project adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
6
  ## Unreleased
7
7
 
8
+
9
+
10
+ ## [0.16.0] - 2016-08-22
11
+
12
+ ### Added
13
+
14
+ - Added `csv_url` to Legislature class. Returns full url of `names.csv` file. For example: `https://cdn.rawgit.com/everypolitician/everypolitician-data/ba976cf/data/UK/Commons/names.csv`
15
+
16
+ ## [0.15.0] - 2016-08-23
17
+
18
+ ### Fixed
19
+
20
+ - Calling `start_date` or `end_date` on a Legislature which doesn’t have
21
+ one now returns `nil` rather than raising an Exception.
22
+
23
+
24
+ ## [0.14.0] - 2016-08-22
25
+
26
+ ### Added
27
+
28
+ - A Legislature now has `[]` defined, for symmetry with Country and
29
+ LegislativePeriod
30
+
8
31
  ## [0.13.0] - 2016-08-18
9
32
 
10
33
  ### Added
@@ -82,7 +105,7 @@ a string with the time in seconds.
82
105
 
83
106
  - We no longer use ruby metaprogramming to define the methods on `Country` and `Legislature`, they are now explicitly defined as properties and methods.
84
107
  - `Legislature#popolo_url` now uses the `Legislature#sha` method rather than `master` in the raw url.
85
- - `countries.json` is only loaded once, when it's first accessed. If you want to force a refetch then you can call `Everypolitician.countries = nil`.
108
+ - `countries.json` is only loaded once, when its first accessed. If you want to force a refetch then you can call `Everypolitician.countries = nil`.
86
109
 
87
110
  ## [0.4.0] - 2016-01-26
88
111
 
@@ -124,3 +147,6 @@ a string with the time in seconds.
124
147
  [0.11.0]: https://github.com/everypolitician/everypolitician-ruby/compare/v0.10.0...v0.11.0
125
148
  [0.12.0]: https://github.com/everypolitician/everypolitician-ruby/compare/v0.11.0...v0.12.0
126
149
  [0.13.0]: https://github.com/everypolitician/everypolitician-ruby/compare/v0.12.0...v0.13.0
150
+ [0.14.0]: https://github.com/everypolitician/everypolitician-ruby/compare/v0.13.0...v0.14.0
151
+ [0.15.0]: https://github.com/everypolitician/everypolitician-ruby/compare/v0.14.0...v0.15.0
152
+ [0.16.0]: https://https://github.com/everypolitician/everypolitician-ruby/compare/v0.15.0...v0.16.0
@@ -132,6 +132,10 @@ module Everypolitician
132
132
  @country = country
133
133
  end
134
134
 
135
+ def [](key)
136
+ raw_data[key]
137
+ end
138
+
135
139
  def popolo
136
140
  @popolo ||= Everypolitician::Popolo.parse(open(popolo_url).read)
137
141
  end
@@ -154,6 +158,11 @@ module Everypolitician
154
158
  def lastmod
155
159
  Time.at(lastmod_str.to_i).gmtime
156
160
  end
161
+
162
+ def csv_url
163
+ @csv_url ||= 'https://cdn.rawgit.com/everypolitician' \
164
+ "/everypolitician-data/#{@sha}/#{raw_data[:names]}"
165
+ end
157
166
  end
158
167
 
159
168
  class LegislativePeriod
@@ -197,6 +206,7 @@ module Everypolitician
197
206
  private
198
207
 
199
208
  def parse_partial_date(date)
209
+ return if date.to_s.empty?
200
210
  Date.new(*date.split('-').map(&:to_i))
201
211
  end
202
212
  end
@@ -1,3 +1,3 @@
1
1
  module Everypolitician
2
- VERSION = '0.13.0'.freeze
2
+ VERSION = '0.16.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: everypolitician
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Mytton
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-18 00:00:00.000000000 Z
11
+ date: 2016-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: everypolitician-popolo