everypolitician-popolo 0.5.0 → 0.6.1

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: 02929dc6bc5bd531b724d07047844435bfd223ad
4
- data.tar.gz: aa9c71d31ff43c43cd5edc4ea5b043b90f494213
3
+ metadata.gz: 262682eaaa9963c7749cd96f5a5134fab88e815f
4
+ data.tar.gz: 3d90b328a132fba3ea0a3d2100f5a00e585dd1b1
5
5
  SHA512:
6
- metadata.gz: 80c7c8dfa484a3c3f6e6533edb8099fbd5887bcf7562199c75035050cf508ec616f1c8d2a09e0030874275749b2dec51688330267760f688651a5b12407f766e
7
- data.tar.gz: 243c3f25a16496072e70a326ace166fc91d73f50a8dc102cbe3239fd81cbdecf8251fb98b32163aed0f2ab96543e1c396ccddbdba6cf2ac2dd6945a5aca482d4
6
+ metadata.gz: 29f9a20d955a4281608a4482fc8374c5dee19d75c0b040f6f7a46aeaa70715c1104000b6c074655394c48717226bffd755396d873a6a56bd946f146649fd5786
7
+ data.tar.gz: 593e9de9b997aa687a2e3967918938ed49a30b2964953e772b3fd7dd0369d0caf4462f8c0765a769c6e21f8d6e4ec0bed0e75328276f1dcb2dc2e6bc9d574dc9
data/.rubocop.yml CHANGED
@@ -1,53 +1,5 @@
1
- Style/AlignHash:
2
- EnforcedHashRocketStyle: table
3
- EnforcedColonStyle: table
1
+ inherit_from:
2
+ - https://raw.githubusercontent.com/everypolitician/everypolitician-data/master/.rubocop_base.yml
3
+ - .rubocop_todo.yml
4
4
 
5
- Style/ClassAndModuleCamelCase:
6
- Enabled: false
7
5
 
8
- Style/CollectionMethods:
9
- Enabled: true
10
-
11
- Style/Documentation:
12
- Enabled: false
13
-
14
- Style/FormatString:
15
- EnforcedStyle: percent
16
-
17
- Style/HashSyntax:
18
- EnforcedStyle: ruby19_no_mixed_keys
19
-
20
- Style/RescueModifier:
21
- Enabled: false
22
-
23
- Style/SignalException:
24
- Enabled: false
25
-
26
- Style/SymbolArray:
27
- Enabled: true
28
-
29
- Style/TrailingCommaInLiteral:
30
- EnforcedStyleForMultiline: consistent_comma
31
-
32
-
33
- Metrics/ClassLength:
34
- Max: 250
35
-
36
- Metrics/MethodLength:
37
- Max: 20
38
-
39
- Metrics/LineLength:
40
- Max: 150
41
-
42
- Metrics/AbcSize:
43
- Max: 50
44
-
45
- Metrics/CyclomaticComplexity:
46
- Max: 7
47
-
48
- Metrics/PerceivedComplexity:
49
- Max: 8
50
-
51
-
52
- # Temporarily! (2016-08-01)
53
- inherit_from: .rubocop_todo.yml
data/.rubocop_todo.yml CHANGED
@@ -1,7 +1,31 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2016-08-01 14:20:19 +0100 using RuboCop version 0.42.0.
3
+ # on 2016-08-08 18:05:16 +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
7
7
  # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ Metrics/AbcSize:
11
+ Max: 21
12
+
13
+ # Offense count: 1
14
+ # Configuration parameters: CountComments.
15
+ Metrics/ClassLength:
16
+ Max: 164
17
+
18
+ # Offense count: 2
19
+ Metrics/CyclomaticComplexity:
20
+ Max: 7
21
+
22
+ # Offense count: 42
23
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
24
+ # URISchemes: http, https
25
+ Metrics/LineLength:
26
+ Max: 148
27
+
28
+ # Offense count: 3
29
+ # Configuration parameters: CountComments.
30
+ Metrics/MethodLength:
31
+ Max: 19
data/CHANGELOG.md CHANGED
@@ -3,6 +3,24 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
+ ## [0.6.1] - 2016-09-12
7
+
8
+ ### Fixes
9
+
10
+ - Version 0.6.0 was accidentally tagged at the wrong (broken) point in history,
11
+ which included a broken fix for removing the `id` prefix from entities
12
+ ([#48](https://github.com/everypolitician/everypolitician-popolo/pull/48)),
13
+ but not the pull request reverting that change
14
+ ([#49](https://github.com/everypolitician/everypolitician-popolo/pull/49)).
15
+ 0.6.0 has been yanked from RubyGems and we recommend using version 0.6.1.
16
+
17
+ ## [0.6.0] (yanked from RubyGems.org) - 2016-09-03
18
+
19
+ ### Fixed
20
+
21
+ - `Entitiy#identifiers` will now return an empty list if no identifiers
22
+ exist, rather than blowing up.
23
+
6
24
  ## [0.5.0] - 2016-08-01
7
25
 
8
26
  ### Added
@@ -52,4 +70,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
52
70
 
53
71
  [0.2.0]: https://github.com/everypolitician/everypolitician-popolo/compare/v0.1.0...v0.2.0
54
72
  [0.3.0]: https://github.com/everypolitician/everypolitician-popolo/compare/v0.2.0...v0.3.0
55
- [0.3.0]: https://github.com/everypolitician/everypolitician-popolo/compare/v0.3.0...v0.3.1
73
+ [0.3.1]: https://github.com/everypolitician/everypolitician-popolo/compare/v0.3.0...v0.3.1
74
+ [0.3.2]: https://github.com/everypolitician/everypolitician-popolo/compare/v0.3.1...v0.3.2
75
+ [0.4.0]: https://github.com/everypolitician/everypolitician-popolo/compare/v0.3.0...v0.4.0
76
+ [0.5.0]: https://github.com/everypolitician/everypolitician-popolo/compare/v0.4.0...v0.5.0
77
+ [0.6.0]: https://github.com/everypolitician/everypolitician-popolo/compare/v0.5.0...v0.6.0
data/Gemfile CHANGED
@@ -2,4 +2,3 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in everypolitician-popolo.gemspec
4
4
  gemspec
5
-
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Everypolitician::Popolo
2
2
 
3
- [EveryPolitician](http://everypolitician.org) provides its data in [Popolo](http://www.popoloproject.com/) format. If you want to interact with this data from Ruby then this library should make that task simpler.
3
+ [EveryPolitician](http://everypolitician.org) provides its data in [Popolo](http://www.popoloproject.com/) format. If you want to interact with this data from Ruby then this library makes that task simpler.
4
4
 
5
5
  ## Installation
6
6
 
@@ -20,7 +20,9 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
- You'll need to download a Popolo file from [EveryPolitician](http://everypolitician.org/). The following example uses [Åland Lagting](https://github.com/everypolitician/everypolitician-data/raw/master/data/Aland/Lagting/ep-popolo-v1.0.json) (which is the legislature of the Åland islands,
23
+ You can download a Popolo file manually from [EveryPolitician](http://everypolitician.org/)
24
+ (although there's [another library](#see-also-everypolitician-ruby)
25
+ if you want to automate that). The following example uses [Åland Lagting](https://github.com/everypolitician/everypolitician-data/raw/master/data/Aland/Lagting/ep-popolo-v1.0.json) (which is the legislature of the Åland islands,
24
26
  available as JSON data from the
25
27
  [EveryPolitician page for Åland](http://everypolitician.org/aland/)).
26
28
 
@@ -53,7 +55,7 @@ person.wikidata # => "Q4934081"
53
55
  You can also find individual records or collections based on their attributes:
54
56
 
55
57
  ```ruby
56
- popolo.persons.find_by(name: "Aaltonen Carina", wikidata: "Q4934081")
58
+ popolo.persons.find_by(name: "Aaltonen Carina")
57
59
  # => #<Everypolitician::Popolo::Person:0x0000000237dfc8
58
60
  # @document={:id=>"0c705344-23aa-4fa2-9391-af41c1c775b7",
59
61
  # :identifiers=>[{:identifier=>"Q4934081", :scheme=>"wikidata"}],
@@ -72,6 +74,27 @@ popolo.organizations.where(classification: "party")
72
74
  # ]
73
75
  ```
74
76
 
77
+ ### See also: everypolitician-ruby
78
+
79
+ In the example above, the Popolo data comes from a downloaded file
80
+ (`ep-popolo-v1.0.json`), which is the kind of file you can get from the
81
+ [EveryPolitician website](http://everypolitician.org).
82
+ But your Ruby application can also interact directly with the EveryPolitician
83
+ data using the
84
+ [everypolitician-ruby gem](http://github.com/everypolitician/everypolitician-ruby),
85
+ so you don't need to handle JSON files at all. The data the gem returns is in
86
+ `Everypolitician::Popolo` format.
87
+
88
+ ```ruby
89
+ require 'everypolitician'
90
+
91
+ australia = Everypolitician::Index.new.country('Australia')
92
+ australia.code # => "AU"
93
+ senate = australia.legislature('Senate')
94
+ senate.persons.find_by(name: "Aden Ridgeway")
95
+ ```
96
+
97
+
75
98
  ## Development
76
99
 
77
100
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -31,6 +31,10 @@ module Everypolitician
31
31
  end
32
32
  alias eql? ==
33
33
 
34
+ def identifiers
35
+ document.fetch(:identifiers, [])
36
+ end
37
+
34
38
  def identifier(scheme)
35
39
  identifiers.find(-> { {} }) { |i| i[:scheme] == scheme }[:identifier]
36
40
  end
@@ -15,10 +15,6 @@ module Everypolitician
15
15
  links.find(-> { {} }) { |i| i[:note] == type }[:url]
16
16
  end
17
17
 
18
- def identifiers
19
- document.fetch(:identifiers, [])
20
- end
21
-
22
18
  def contact_details
23
19
  document.fetch(:contact_details, [])
24
20
  end
@@ -1,5 +1,5 @@
1
1
  module Everypolitician
2
2
  module Popolo
3
- VERSION = '0.5.0'.freeze
3
+ VERSION = '0.6.1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: everypolitician-popolo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Mytton