parliament-opensearch 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 89764f0e23de18af2c597be14a52198dc7011e16
4
- data.tar.gz: 95f44a316c601778ad1fd466757b2b9b5deec1ce
3
+ metadata.gz: aa1e7fcde557b8ce18754819661d6caaa492639b
4
+ data.tar.gz: 0a12a2c9bc5cae5071545c48c9b99380390eac4b
5
5
  SHA512:
6
- metadata.gz: d9d48aa35039abcee3cef6731d79af106f020b306098f11e01bca5bec6e49f16aecf7415d65613ce680dfa944b2f8a467a4236fe788aac86a51f67ace2d2c1df
7
- data.tar.gz: acb15d5c8218eb7fd4d817f9dfe01683c734b3fff359b6c7cea1a59723d08e219bd3e617152d9ce69252c8f7b96ac67ca4b3ec94641d8f29c682b8f14f8dadc4
6
+ metadata.gz: bb06ee7a2bf36541c6606dbb269266bc94d9effaa9fcc9fc2d123c0ed609ccceb6a3a7eab64f72acd5c0f6efa36a9dc3b6d301d371b7485d949254206ca4d130
7
+ data.tar.gz: 3a63183474c23a308cffc5c93449ef7d5e8f75002a60c63ae61cba1d2c9d7f9e57755043c3af4c868705c3d50c58b9f7de7bf0d91be70da04faa060bb1301317
data/README.md CHANGED
@@ -7,6 +7,7 @@
7
7
  [parliament-opensearch](http://github.com/ukparliament/opensearch) requires the following:
8
8
  * [Ruby](https://www.ruby-lang.org/en/)
9
9
  * [Bundler](http://http://bundler.io/)
10
+ * [parliament-ruby](https://rubygems.org/gems/parliament-ruby)
10
11
 
11
12
  ## Installation
12
13
 
@@ -17,6 +18,15 @@ This gem is currently not available on RubyGems. To use it in an application, in
17
18
  gem 'parliament-opensearch', git: 'https://github.com/ukparliament/parliament-open-search.git', branch: 'master'
18
19
  ```
19
20
 
21
+ You will also need to include the parliament-ruby gem. Add the following to your Gemfile:
22
+ ```
23
+ gem 'parliament-ruby'
24
+ ```
25
+ then run:
26
+ ```
27
+ bundle install
28
+ ```
29
+
20
30
  ## Usage
21
31
 
22
32
  This gem's main function is fetching data from an OpenSearch API and parsing it.
@@ -1,5 +1,3 @@
1
- require 'feedjira'
2
-
3
1
  module Parliament
4
2
  module Builder
5
3
  # OpenSearch response builder using Feedjira to parse the response.
@@ -1,16 +1,88 @@
1
- require 'rexml/document'
2
-
3
- require 'parliament'
4
-
5
- require 'parliament/open_search/version'
6
- require 'parliament/open_search/description_error'
7
- require 'parliament/request/open_search_request'
8
- require 'parliament/builder/open_search_response_builder'
9
-
10
1
  # Namespace for classes and modules that handle connections to, and processing of data from OpenSearch APIs.
11
2
  # @since 0.1.0
12
3
  module Parliament
13
4
  module OpenSearch
14
5
  # Currently just a namespace definition
6
+ class << self
7
+ def load!
8
+ if parliament_response?
9
+ register_parliament_response
10
+ else
11
+ raise(LoadError, "Missing requirement 'Parliament::Response'. Have you added `gem 'parliament-ruby'` to your Gemfile?")
12
+ end
13
+
14
+ if parliament_request?
15
+ register_parliament_request
16
+ register_opensearch_request
17
+ else
18
+ raise(LoadError, "Missing requirement 'Parliament::Request'. Have you added `gem 'parliament-ruby'` to your Gemfile?")
19
+ end
20
+
21
+ if parliament_builder?
22
+ register_parliament_builder
23
+ register_opensearch_builder
24
+ else
25
+ raise(LoadError, "Missing requirement 'Parliament::Builder'. Have you added `gem 'parliament-ruby'` to your Gemfile?")
26
+ end
27
+
28
+ register_opensearch
29
+ register_rexml_document
30
+ register_active_support_inflector
31
+ register_feedjira
32
+ end
33
+
34
+ def parliament_response?
35
+ defined?(::Parliament::Response)
36
+ end
37
+
38
+ def parliament_request?
39
+ defined?(::Parliament::Request)
40
+ end
41
+
42
+ def parliament_builder?
43
+ defined?(::Parliament::Builder)
44
+ end
45
+
46
+ private
47
+
48
+ def register_parliament_response
49
+ require 'parliament/response'
50
+ end
51
+
52
+ def register_parliament_request
53
+ require 'parliament/request'
54
+ end
55
+
56
+ def register_parliament_builder
57
+ require 'parliament/builder'
58
+ end
59
+
60
+ def register_opensearch
61
+ require 'parliament/open_search/version'
62
+ require 'parliament/open_search/description_error'
63
+ end
64
+
65
+ def register_opensearch_request
66
+ require 'parliament/request/open_search_request'
67
+ end
68
+
69
+ def register_opensearch_builder
70
+ require 'parliament/builder/open_search_response_builder'
71
+ end
72
+
73
+ def register_rexml_document
74
+ require 'rexml/document'
75
+ end
76
+
77
+ def register_active_support_inflector
78
+ require 'active_support/inflector'
79
+ end
80
+
81
+ def register_feedjira
82
+ require 'feedjira'
83
+ end
84
+ end
15
85
  end
16
- end
86
+ end
87
+
88
+ Parliament::OpenSearch.load!
@@ -1,5 +1,5 @@
1
1
  module Parliament
2
2
  module OpenSearch
3
- VERSION = '0.2.3'.freeze
3
+ VERSION = '0.2.4'.freeze
4
4
  end
5
5
  end
@@ -75,7 +75,7 @@ module Parliament
75
75
  xml_response = request.get
76
76
 
77
77
  begin
78
- xml_root = REXML::Document.new(xml_response.body).root
78
+ xml_root = REXML::Document.new(xml_response.response.body).root
79
79
  template = xml_root.elements['Url'].attributes['template']
80
80
 
81
81
  raise Parliament::OpenSearch::DescriptionError.new(url), "The document found does not contain a require node. Attempted to get a 'Url' element with the attribute 'template'. Please check the description document at '#{url}' and try again." if template.nil?
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.require_paths = ['lib']
22
22
 
23
23
  spec.add_dependency 'feedjira', '~> 2.1', '>= 2.1.2'
24
- spec.add_dependency 'parliament-ruby', '~> 0.7.4'
24
+ spec.add_dependency 'activesupport', '>= 5.0.0.1'
25
25
 
26
26
  spec.add_development_dependency 'bundler', '~> 1.14'
27
27
  spec.add_development_dependency 'rake', '~> 10.0'
@@ -30,4 +30,5 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency 'simplecov', '~> 0.12'
31
31
  spec.add_development_dependency 'vcr', '~> 3.0'
32
32
  spec.add_development_dependency 'webmock', '~> 2.3'
33
+ spec.add_development_dependency 'parliament-ruby', '~> 0.7.4'
33
34
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parliament-opensearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rebecca Appleyard
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2017-04-18 00:00:00.000000000 Z
12
+ date: 2017-05-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: feedjira
@@ -32,19 +32,19 @@ dependencies:
32
32
  - !ruby/object:Gem::Version
33
33
  version: 2.1.2
34
34
  - !ruby/object:Gem::Dependency
35
- name: parliament-ruby
35
+ name: activesupport
36
36
  requirement: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 0.7.4
40
+ version: 5.0.0.1
41
41
  type: :runtime
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 0.7.4
47
+ version: 5.0.0.1
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: bundler
50
50
  requirement: !ruby/object:Gem::Requirement
@@ -143,6 +143,20 @@ dependencies:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
145
  version: '2.3'
146
+ - !ruby/object:Gem::Dependency
147
+ name: parliament-ruby
148
+ requirement: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 0.7.4
153
+ type: :development
154
+ prerelease: false
155
+ version_requirements: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: 0.7.4
146
160
  description: 'Parliamentary OpenSearch response builder '
147
161
  email:
148
162
  - rklappleyard@gmail.com
@@ -188,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
202
  version: '0'
189
203
  requirements: []
190
204
  rubyforge_project:
191
- rubygems_version: 2.6.11
205
+ rubygems_version: 2.6.8
192
206
  signing_key:
193
207
  specification_version: 4
194
208
  summary: Parliamentary OpenSearch response builder