everypolitician-popolo 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +53 -0
- data/.rubocop_todo.yml +7 -0
- data/.travis.yml +3 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -0
- data/Rakefile +3 -0
- data/everypolitician-popolo.gemspec +1 -0
- data/lib/everypolitician/popolo.rb +2 -2
- data/lib/everypolitician/popolo/collection.rb +9 -9
- data/lib/everypolitician/popolo/entity.rb +1 -2
- data/lib/everypolitician/popolo/event.rb +1 -1
- data/lib/everypolitician/popolo/person.rb +9 -15
- data/lib/everypolitician/popolo/version.rb +1 -1
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02929dc6bc5bd531b724d07047844435bfd223ad
|
4
|
+
data.tar.gz: aa9c71d31ff43c43cd5edc4ea5b043b90f494213
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80c7c8dfa484a3c3f6e6533edb8099fbd5887bcf7562199c75035050cf508ec616f1c8d2a09e0030874275749b2dec51688330267760f688651a5b12407f766e
|
7
|
+
data.tar.gz: 243c3f25a16496072e70a326ace166fc91d73f50a8dc102cbe3239fd81cbdecf8251fb98b32163aed0f2ab96543e1c396ccddbdba6cf2ac2dd6945a5aca482d4
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
Style/AlignHash:
|
2
|
+
EnforcedHashRocketStyle: table
|
3
|
+
EnforcedColonStyle: table
|
4
|
+
|
5
|
+
Style/ClassAndModuleCamelCase:
|
6
|
+
Enabled: false
|
7
|
+
|
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
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2016-08-01 14:20:19 +0100 using RuboCop version 0.42.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,12 @@
|
|
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.5.0] - 2016-08-01
|
7
|
+
|
8
|
+
### Added
|
9
|
+
|
10
|
+
- Added `Person#link(type)`
|
11
|
+
|
6
12
|
## [0.4.0] - 2016-07-04
|
7
13
|
|
8
14
|
### Added
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -56,12 +56,12 @@ module Everypolitician
|
|
56
56
|
def legislative_periods
|
57
57
|
events.where(classification: 'legislative period').sort_by(&:start_date)
|
58
58
|
end
|
59
|
-
|
59
|
+
alias terms legislative_periods
|
60
60
|
|
61
61
|
def current_legislative_period
|
62
62
|
legislative_periods.last
|
63
63
|
end
|
64
|
-
|
64
|
+
alias current_term current_legislative_period
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
@@ -25,7 +25,7 @@ module Everypolitician
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def where(attributes = {})
|
28
|
-
|
28
|
+
select do |object|
|
29
29
|
attributes.all? { |k, v| object.send(k) == v }
|
30
30
|
end
|
31
31
|
end
|
@@ -35,21 +35,21 @@ module Everypolitician
|
|
35
35
|
# TODO: This feels pretty nasty, is there a better way of working out the
|
36
36
|
# class name?
|
37
37
|
def klass
|
38
|
-
case self.class.to_s.split(
|
39
|
-
when
|
38
|
+
case self.class.to_s.split('::').last
|
39
|
+
when 'People'
|
40
40
|
Person
|
41
|
-
when
|
41
|
+
when 'Organizations'
|
42
42
|
Organization
|
43
|
-
when
|
43
|
+
when 'Memberships'
|
44
44
|
Membership
|
45
|
-
when
|
45
|
+
when 'Events'
|
46
46
|
Event
|
47
|
-
when
|
47
|
+
when 'Posts'
|
48
48
|
Post
|
49
|
-
when
|
49
|
+
when 'Areas'
|
50
50
|
Area
|
51
51
|
else
|
52
|
-
raise "Unknown class: #{self.class
|
52
|
+
raise "Unknown class: #{self.class}"
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module Everypolitician
|
2
2
|
module Popolo
|
3
3
|
class Entity
|
4
|
-
|
5
4
|
attr_accessor :id
|
6
5
|
attr_reader :document
|
7
6
|
attr_reader :popolo
|
@@ -33,7 +32,7 @@ module Everypolitician
|
|
33
32
|
alias eql? ==
|
34
33
|
|
35
34
|
def identifier(scheme)
|
36
|
-
identifiers.find(->{{}}) { |i| i[:scheme] == scheme }[:identifier]
|
35
|
+
identifiers.find(-> { {} }) { |i| i[:scheme] == scheme }[:identifier]
|
37
36
|
end
|
38
37
|
end
|
39
38
|
end
|
@@ -11,6 +11,10 @@ module Everypolitician
|
|
11
11
|
document.fetch(:links, [])
|
12
12
|
end
|
13
13
|
|
14
|
+
def link(type)
|
15
|
+
links.find(-> { {} }) { |i| i[:note] == type }[:url]
|
16
|
+
end
|
17
|
+
|
14
18
|
def identifiers
|
15
19
|
document.fetch(:identifiers, [])
|
16
20
|
end
|
@@ -20,7 +24,7 @@ module Everypolitician
|
|
20
24
|
end
|
21
25
|
|
22
26
|
def contact(type)
|
23
|
-
contact_details.find(->{{}}) { |i| i[:type] == type }[:value]
|
27
|
+
contact_details.find(-> { {} }) { |i| i[:type] == type }[:value]
|
24
28
|
end
|
25
29
|
|
26
30
|
def phone
|
@@ -32,21 +36,11 @@ module Everypolitician
|
|
32
36
|
end
|
33
37
|
|
34
38
|
def twitter
|
35
|
-
|
36
|
-
if twitter_contact = self[:contact_details].find { |d| d[:type] == 'twitter' }
|
37
|
-
return twitter_contact[:value].strip
|
38
|
-
end
|
39
|
-
end
|
40
|
-
if key?(:links)
|
41
|
-
if twitter_link = self[:links].find { |d| d[:note][/twitter/i] }
|
42
|
-
return twitter_link[:url].strip
|
43
|
-
end
|
44
|
-
end
|
39
|
+
contact('twitter') || link('twitter')
|
45
40
|
end
|
46
41
|
|
47
42
|
def facebook
|
48
|
-
|
49
|
-
facebook_link[:url] if facebook_link
|
43
|
+
link('facebook')
|
50
44
|
end
|
51
45
|
|
52
46
|
def wikidata
|
@@ -59,9 +53,9 @@ module Everypolitician
|
|
59
53
|
|
60
54
|
def name_at(date)
|
61
55
|
return name unless key?(:other_names)
|
62
|
-
historic = other_names.
|
56
|
+
historic = other_names.select { |n| n.key?(:end_date) }
|
63
57
|
return name if historic.empty?
|
64
|
-
at_date = historic.
|
58
|
+
at_date = historic.select do |n|
|
65
59
|
n[:end_date] >= date && (n[:start_date] || '0000-00-00') <= date
|
66
60
|
end
|
67
61
|
return name if at_date.empty?
|
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.5.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-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0.10'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.42.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.42.0
|
69
83
|
description:
|
70
84
|
email:
|
71
85
|
- chrismytton@gmail.com
|
@@ -75,6 +89,8 @@ extra_rdoc_files: []
|
|
75
89
|
files:
|
76
90
|
- ".github/ISSUE_TEMPLATE.md"
|
77
91
|
- ".gitignore"
|
92
|
+
- ".rubocop.yml"
|
93
|
+
- ".rubocop_todo.yml"
|
78
94
|
- ".travis.yml"
|
79
95
|
- CHANGELOG.md
|
80
96
|
- Gemfile
|
@@ -119,4 +135,3 @@ signing_key:
|
|
119
135
|
specification_version: 4
|
120
136
|
summary: Makes it easy to work with EveryPolitician's Popolo output files from Ruby
|
121
137
|
test_files: []
|
122
|
-
has_rdoc:
|