parliament-grom-decorators 0.14.1 → 0.15.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: 8016c3fd81e976f660aca8ae46415d673a1367c9
4
- data.tar.gz: 9a893cbfd3daaa6c479478a2b37342bcfbb3a8a2
3
+ metadata.gz: be3dacd4062e4dc9326e431d22aa3b65d0b9cef8
4
+ data.tar.gz: '0977acde11f0814aa880a882fff9f2440e6599da'
5
5
  SHA512:
6
- metadata.gz: d90ef92696d1fd0fa2723352f2340ebd586741e963a33f60e4dbae2ff7700aeed91311f42209ae029b85dfd9f9ff4056d83bb3c2137c611cddd10fccde3e43b8
7
- data.tar.gz: f0f3713c2360d4e152dad5e46478605916b975ecc71a5f93cadacc510a4dad41cc405b82512ff8aa1280f269976d0ea1f16dc2799bb7caa28022e93073e8c366
6
+ metadata.gz: f373ef8afe3937f03c196810f8f076b9d1510652ca4b84958fb0afd12738cb4fd6cc4b4a0d87a59d19e161ff964ba0df7c7259d81a86d0e439d330b8ee2fbb8f
7
+ data.tar.gz: 95c9c06819db6c5db6b7c4e3fd84204c2b8322b0e8bae46bcf149ba64a12cf02f0d3637cc369e0eddfe75354276968ea35ad54850bf423116f38908febb07eb3
@@ -0,0 +1,17 @@
1
+ module Parliament
2
+ module Grom
3
+ module Decorator
4
+ # Decorator namespace for Grom::Node instances with type: http://example.com/content/ArticleType
5
+ # ArticleType Grom::Node is a Contentful object associated with a web article (a WebArticle has an Audience node)
6
+ # ArticleType Grom::Node is not modelled in the data service, hence type 'http://example..' and not 'https://id.parliament.uk/schema'
7
+ module ArticleType
8
+ # Alias name with fallback.
9
+ #
10
+ # @return [String, String] the title of the Grom::Node or an empty string.
11
+ def article_type_name
12
+ respond_to?(:name) ? name : ''
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module Parliament
2
+ module Grom
3
+ module Decorator
4
+ # Decorator namespace for Grom::Node instances with type: http://example.com/content/Audience
5
+ # Audience Grom::Node is a Contentful object associated with a web article (a WebArticle has an Audience node)
6
+ # Audience Grom::Node is not modelled in the data service, hence type 'http://example..' and not 'https://id.parliament.uk/schema'
7
+ module Audience
8
+ # Alias name with fallback.
9
+ #
10
+ # @return [String, String] the title of the Grom::Node or an empty string.
11
+ def audience_name
12
+ respond_to?(:name) ? name : ''
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,7 +1,7 @@
1
1
  module Parliament
2
2
  module Grom
3
3
  module Decorator
4
- VERSION = '0.14.1'.freeze
4
+ VERSION = '0.15.0'.freeze
5
5
  end
6
6
  end
7
7
  end
@@ -0,0 +1,71 @@
1
+ module Parliament
2
+ module Grom
3
+ module Decorator
4
+ # Decorator namespace for Grom::Node instances with type: https://id.parliament.uk/schema/ConstituencyArea
5
+ module WebArticle
6
+ # Alias title with fallback.
7
+ #
8
+ # @return [String, String] the title of the Grom::Node or an empty string.
9
+ def article_title
10
+ respond_to?(:title) ? title : ''
11
+ end
12
+
13
+ # Alias summary with fallback.
14
+ #
15
+ # @return [String, String] the summary of the Grom::Node or an empty string.
16
+ def article_summary
17
+ respond_to?(:summary) ? summary : ''
18
+ end
19
+
20
+ # Alias body with fallback.
21
+ #
22
+ # @return [String, String] the body of the Grom::Node or an empty string.
23
+ def article_body
24
+ respond_to?(:body) ? body : ''
25
+ end
26
+
27
+ # Alias collection with fallback.
28
+ #
29
+ # @return [Array, Array] array of collection Grom::Node or an empty array.
30
+ def collections
31
+ respond_to?(:collection) ? collection : []
32
+ end
33
+
34
+ # Alias articleType with fallback.
35
+ #
36
+ # @return [Array, Array] array of collection Grom::Node or an empty array.
37
+ def types
38
+ respond_to?(:articleType) ? articleType : []
39
+ end
40
+
41
+ # Alias audience with fallback.
42
+ #
43
+ # @return [Array, Array] array of collection Grom::Node or an empty array.
44
+ def audiences
45
+ respond_to?(:audience) ? audience : []
46
+ end
47
+
48
+ # Alias topic with fallback.
49
+ #
50
+ # @return [Array, Array] array of collection Grom::Node or an empty array.
51
+ def topics
52
+ respond_to?(:topic) ? topic : []
53
+ end
54
+
55
+ # Alias publisher with fallback.
56
+ #
57
+ # @return [Array, Array] array of collection Grom::Node or an empty array.
58
+ def publishers
59
+ respond_to?(:publisher) ? topic : []
60
+ end
61
+
62
+ # Alias relatedArticle with fallback.
63
+ #
64
+ # @return [Array, Array] array of article Grom::Nodes or an empty array.
65
+ def related_articles
66
+ respond_to?(:relatedArticle) ? relatedArticle : []
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -23,6 +23,9 @@ require 'parliament/grom/decorator/government_incumbency'
23
23
  require 'parliament/grom/decorator/government_position'
24
24
  require 'parliament/grom/decorator/opposition_incumbency'
25
25
  require 'parliament/grom/decorator/opposition_position'
26
+ require 'parliament/grom/decorator/web_article'
27
+ require 'parliament/grom/decorator/audience'
28
+ require 'parliament/grom/decorator/article_type'
26
29
 
27
30
  # Namespace for classes and modules that handle connections to, and processing of data from the parliamentary API.
28
31
  # @since 0.1.0
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.14.1
4
+ version: 0.15.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-12-08 00:00:00.000000000 Z
11
+ date: 2017-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -172,6 +172,8 @@ files:
172
172
  - config/locales/en.yml
173
173
  - gocd/web1live.yaml
174
174
  - lib/parliament/grom/decorator.rb
175
+ - lib/parliament/grom/decorator/article_type.rb
176
+ - lib/parliament/grom/decorator/audience.rb
175
177
  - lib/parliament/grom/decorator/constituency_area.rb
176
178
  - lib/parliament/grom/decorator/constituency_group.rb
177
179
  - lib/parliament/grom/decorator/contact_point.rb
@@ -198,6 +200,7 @@ files:
198
200
  - lib/parliament/grom/decorator/postal_address.rb
199
201
  - lib/parliament/grom/decorator/seat_incumbency.rb
200
202
  - lib/parliament/grom/decorator/version.rb
203
+ - lib/parliament/grom/decorator/web_article.rb
201
204
  - makefile
202
205
  - parliament-grom-decorators.gemspec
203
206
  homepage: http://github.com/ukparliament/parliament-grom-decorators