parliament-grom-decorators 0.11.0 → 0.12.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: a4b9f642131000e5c44ff97be87ac2fa068e1641
4
- data.tar.gz: 206b67cc16c8e79a53059500bce8e5ef12dadf91
3
+ metadata.gz: d73636fa57db22ed08f0fae8f8a1f1e6a0e1cdcb
4
+ data.tar.gz: 5bb160d1e8df59991fab0d00e645da9fc40f76e4
5
5
  SHA512:
6
- metadata.gz: 6317ace33c917e06f3506f7009b2f2fd9837fb627753e2f1361092383be4af0cef3e5bcf57814a3aa1f52aa5990501ce4930cd969c8425ee2073b5286de92af5
7
- data.tar.gz: 5dc523676e9bb74d6824102377b4b59d22576c5331a488f92da18f438f277223b7f30b34a1a5adb9f33c4de8de326a164c9adb8da516b6f2d3588789ad7aaca3
6
+ metadata.gz: 25ba62c53dadb7d21dab1507445f2f95c318d2ddb3b82faad91edc42c6e15a643a30bfdb4e91e951551cbaf28134cf8afcb0d3899211919bc8361ad429eacfc1
7
+ data.tar.gz: 6dc3ca5525ae9d264e9a6563454763fd29a8e568ae369cb86bad02995369f1dea5b55057f6bb66ed69f58aa543f469dc39a8ced0c61e07cb43269246a09126b9
@@ -162,6 +162,20 @@ module Parliament
162
162
  @statuses = statuses
163
163
  end
164
164
 
165
+ # Check whether #statuses includes 'Current MP'.
166
+ #
167
+ # @return [Boolean] a boolean depending on whether or not the result of #statuses includes 'Current MP'.
168
+ def current_mp?
169
+ statuses[:house_membership_status].include?('Current MP')
170
+ end
171
+
172
+ # Check whether #statuses includes 'Member of the House of Lords'.
173
+ #
174
+ # @return [Boolean] a boolean depending on whether or not the result of #statuses includes 'Member of the House of Lords'.
175
+ def current_lord?
176
+ statuses[:house_membership_status].include?('Member of the House of Lords')
177
+ end
178
+
165
179
  # Alias D79B0BAC513C4A9A87C9D5AFF1FC632F with fallback.
166
180
  #
167
181
  # @return [String, String] the full title of the Grom::Node or an empty string.
@@ -197,11 +211,25 @@ module Parliament
197
211
  respond_to?(:governmentIncumbency) ? governmentIncumbency : []
198
212
  end
199
213
 
200
- # Alias personHasPersonWebLink with fallback.
214
+ # Alias personHasPersonalWebLink with fallback.
215
+ #
216
+ # @return [Array|String, nil] all the personal weblinks of the Grom::Node or an nil.
217
+ def personal_weblinks
218
+ respond_to?(:personHasPersonalWebLink) && (current_mp? || current_lord?) ? personHasPersonalWebLink : nil
219
+ end
220
+
221
+ # Alias personHasTwitterWebLink with fallback.
222
+ #
223
+ # @return [Array|String, nil] all the Twitter weblinks of the Grom::Node or an nil.
224
+ def twitter_weblinks
225
+ respond_to?(:personHasTwitterWebLink) && (current_mp? || current_lord?) ? personHasTwitterWebLink : nil
226
+ end
227
+
228
+ # Alias personHasFacebookWebLink with fallback.
201
229
  #
202
- # @return [Array|String, nil] all the weblinks of the Grom::Node or an nil.
203
- def weblinks
204
- respond_to?(:personHasPersonWebLink) ? personHasPersonWebLink : nil
230
+ # @return [Array|String, nil] all the Facebook weblinks of the Grom::Node or an nil.
231
+ def facebook_weblinks
232
+ respond_to?(:personHasFacebookWebLink) && (current_mp? || current_lord?) ? personHasFacebookWebLink : nil
205
233
  end
206
234
 
207
235
  private
@@ -1,7 +1,7 @@
1
1
  module Parliament
2
2
  module Grom
3
3
  module Decorator
4
- VERSION = '0.11.0'.freeze
4
+ VERSION = '0.12.0'.freeze
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parliament-grom-decorators
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rebecca Appleyard
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-18 00:00:00.000000000 Z
11
+ date: 2017-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler