everypolitician-popolo 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE.md +11 -0
- data/CHANGELOG.md +13 -0
- data/lib/everypolitician/popolo.rb +16 -6
- data/lib/everypolitician/popolo/collection.rb +4 -2
- data/lib/everypolitician/popolo/entity.rb +7 -2
- data/lib/everypolitician/popolo/event.rb +3 -1
- data/lib/everypolitician/popolo/membership.rb +4 -0
- data/lib/everypolitician/popolo/organization.rb +6 -1
- data/lib/everypolitician/popolo/person.rb +5 -6
- data/lib/everypolitician/popolo/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06d7ef4f90694c7c3bb3dd1b0c3c3d625ddb3b2b
|
4
|
+
data.tar.gz: 522b022a34eba1f04a62cf095fc13c4d32c73d49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90aeb9436dd7897f98cf8c79932d68d3b78482de94e56d3fc23b49df30a6172e43582b0bf0b5c34ed92b606fd240f798d97764de2c066ee87346b04f8c0729e1
|
7
|
+
data.tar.gz: a202df2c86a1eaf3d5005c010c87a8361904a5c75b3c4a36b2b9927d960970f0f0195dcb6301e74e356ae6cef50a032a60bdd824e738b11df2269f14c6850c31
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,19 @@
|
|
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.4.0] - 2016-07-04
|
7
|
+
|
8
|
+
### Added
|
9
|
+
|
10
|
+
- Added `Organization#wikidata`
|
11
|
+
|
12
|
+
## [0.3.2] - 2016-06-06
|
13
|
+
|
14
|
+
### Fixed
|
15
|
+
|
16
|
+
- Added missing attribute definition for `Event#start_date` and
|
17
|
+
`Event#end_date`
|
18
|
+
|
6
19
|
## [0.3.1] - 2016-05-04
|
7
20
|
|
8
21
|
### Fixed
|
@@ -30,28 +30,38 @@ module Everypolitician
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def persons
|
33
|
-
People.new(popolo[:persons])
|
33
|
+
People.new(popolo[:persons], self)
|
34
34
|
end
|
35
35
|
|
36
36
|
def organizations
|
37
|
-
Organizations.new(popolo[:organizations])
|
37
|
+
Organizations.new(popolo[:organizations], self)
|
38
38
|
end
|
39
39
|
|
40
40
|
def areas
|
41
|
-
Areas.new(popolo[:areas])
|
41
|
+
Areas.new(popolo[:areas], self)
|
42
42
|
end
|
43
43
|
|
44
44
|
def events
|
45
|
-
Events.new(popolo[:events])
|
45
|
+
Events.new(popolo[:events], self)
|
46
46
|
end
|
47
47
|
|
48
48
|
def posts
|
49
|
-
Posts.new(popolo[:posts])
|
49
|
+
Posts.new(popolo[:posts], self)
|
50
50
|
end
|
51
51
|
|
52
52
|
def memberships
|
53
|
-
Memberships.new(popolo[:memberships])
|
53
|
+
Memberships.new(popolo[:memberships], self)
|
54
54
|
end
|
55
|
+
|
56
|
+
def legislative_periods
|
57
|
+
events.where(classification: 'legislative period').sort_by(&:start_date)
|
58
|
+
end
|
59
|
+
alias_method :terms, :legislative_periods
|
60
|
+
|
61
|
+
def current_legislative_period
|
62
|
+
legislative_periods.last
|
63
|
+
end
|
64
|
+
alias_method :current_term, :current_legislative_period
|
55
65
|
end
|
56
66
|
end
|
57
67
|
end
|
@@ -4,9 +4,11 @@ module Everypolitician
|
|
4
4
|
include Enumerable
|
5
5
|
|
6
6
|
attr_reader :documents
|
7
|
+
attr_reader :popolo
|
7
8
|
|
8
|
-
def initialize(documents)
|
9
|
-
@documents = documents ? documents.map { |p| klass.new(p) } : []
|
9
|
+
def initialize(documents, popolo = nil)
|
10
|
+
@documents = documents ? documents.map { |p| klass.new(p, popolo) } : []
|
11
|
+
@popolo = popolo
|
10
12
|
end
|
11
13
|
|
12
14
|
def each(&block)
|
@@ -4,9 +4,11 @@ module Everypolitician
|
|
4
4
|
|
5
5
|
attr_accessor :id
|
6
6
|
attr_reader :document
|
7
|
+
attr_reader :popolo
|
7
8
|
|
8
|
-
def initialize(document)
|
9
|
+
def initialize(document, popolo = nil)
|
9
10
|
@document = document
|
11
|
+
@popolo = popolo
|
10
12
|
|
11
13
|
document.each do |key, value|
|
12
14
|
if respond_to?("#{key}=")
|
@@ -26,10 +28,13 @@ module Everypolitician
|
|
26
28
|
end
|
27
29
|
|
28
30
|
def ==(other)
|
29
|
-
id == other.id
|
31
|
+
self.class == other.class && id == other.id
|
30
32
|
end
|
31
33
|
alias eql? ==
|
32
34
|
|
35
|
+
def identifier(scheme)
|
36
|
+
identifiers.find(->{{}}) { |i| i[:scheme] == scheme }[:identifier]
|
37
|
+
end
|
33
38
|
end
|
34
39
|
end
|
35
40
|
end
|
@@ -5,7 +5,7 @@ module Everypolitician
|
|
5
5
|
class Person < Entity
|
6
6
|
class Error < StandardError; end
|
7
7
|
|
8
|
-
attr_accessor :name, :email, :image, :gender, :birth_date, :death_date
|
8
|
+
attr_accessor :name, :email, :image, :gender, :birth_date, :death_date, :honorific_prefix, :honorific_suffix
|
9
9
|
|
10
10
|
def links
|
11
11
|
document.fetch(:links, [])
|
@@ -19,11 +19,6 @@ module Everypolitician
|
|
19
19
|
document.fetch(:contact_details, [])
|
20
20
|
end
|
21
21
|
|
22
|
-
|
23
|
-
def identifier(scheme)
|
24
|
-
identifiers.find(->{{}}) { |i| i[:scheme] == scheme }[:identifier]
|
25
|
-
end
|
26
|
-
|
27
22
|
def contact(type)
|
28
23
|
contact_details.find(->{{}}) { |i| i[:type] == type }[:value]
|
29
24
|
end
|
@@ -73,6 +68,10 @@ module Everypolitician
|
|
73
68
|
fail Error, "Too many names at #{date}: #{at_date}" if at_date.count > 1
|
74
69
|
at_date.first[:name]
|
75
70
|
end
|
71
|
+
|
72
|
+
def memberships
|
73
|
+
popolo.memberships.where(person_id: id)
|
74
|
+
end
|
76
75
|
end
|
77
76
|
end
|
78
77
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: everypolitician-popolo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.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-
|
11
|
+
date: 2016-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -73,6 +73,7 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
+
- ".github/ISSUE_TEMPLATE.md"
|
76
77
|
- ".gitignore"
|
77
78
|
- ".travis.yml"
|
78
79
|
- CHANGELOG.md
|
@@ -118,3 +119,4 @@ signing_key:
|
|
118
119
|
specification_version: 4
|
119
120
|
summary: Makes it easy to work with EveryPolitician's Popolo output files from Ruby
|
120
121
|
test_files: []
|
122
|
+
has_rdoc:
|