foederati 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3103d55ec719c63f670ee42ac313112660d19a79
4
+ data.tar.gz: 3ccb00693242f608b312f20235788170136ea203
5
+ SHA512:
6
+ metadata.gz: c272cff39bea08cadf79e0f2ef76e805af218ff3497ca36be087dcd6912985ff8add1a5da04a8de44a460be89036299afa78c938f9587e53b763e65c37fe4bc1
7
+ data.tar.gz: 0dc042b82753b553db3b3cad95e6fb7ebe94b46ebc031eda1113ee28cf04dbb93c00acf50e995ce320063c2b3ef32430679a708322e3a308344473c2a31278fc
@@ -0,0 +1,119 @@
1
+ # European Union Public Licence v. 1.1
2
+ EUPL © the European Community 2007
3
+
4
+ This European Union Public Licence (the “EUPL”) applies to the Work or Software (as defined below) which is provided under the terms of this Licence. Any use of the Work, other than as authorised under this Licence is prohibited (to the extent such use is covered by a right of the copyright holder of the Work).
5
+ The Original Work is provided under the terms of this Licence when the Licensor (as defined below) has placed the following notice immediately following the copyright notice for the Original Work:
6
+
7
+ Licensed under the EUPL v.1.1
8
+
9
+ or has expressed by any other mean his willingness to license under the EUPL.
10
+
11
+ ## 1. Definitions
12
+ In this Licence, the following terms have the following meaning:
13
+ - *The Licence*: this Licence.
14
+ - *The Original Work or the Software*: the software distributed and/or communicated by the Licensor under this Licence, available as Source Code and also as Executable Code as the case may be.
15
+ - *Derivative Works*: the works or software that could be created by the Licensee, based upon the Original Work or modifications thereof. This Licence does not define the extent of modification or dependence on the Original Work required in order to classify a work as a Derivative Work; this extent is determined by copyright law applicable in the country mentioned in Article 15.
16
+ - *The Work*: the Original Work and/or its Derivative Works.
17
+ - *The Source Code*: the human-readable form of the Work which is the most convenient for people to study and modify.
18
+ - *The Executable Code*: any code which has generally been compiled and which is meant to be interpreted by a computer as a program.
19
+ - *The Licensor*: the natural or legal person that distributes and/or communicates the Work under the Licence.
20
+ - *Contributor(s)*: any natural or legal person who modifies the Work under the Licence, or otherwise contributes to the creation of a Derivative Work.
21
+ - *The Licensee* or “*You*”: any natural or legal person who makes any usage of the Software under the terms of the Licence.
22
+ - *Distribution and/or Communication*: any act of selling, giving, lending, renting, distributing, communicating, transmitting, or otherwise making available, on-line or off-line, copies of the Work or providing access to its essential functionalities at the disposal of any other natural or legal person.
23
+
24
+ ## 2. Scope of the rights granted by the Licence
25
+ The Licensor hereby grants You a world-wide, royalty-free, non-exclusive, sub- licensable licence to do the following, for the duration of copyright vested in the Original Work:
26
+ - use the Work in any circumstance and for all usage,
27
+ - reproduce the Work,
28
+ - modify the Original Work, and make Derivative Works based upon the Work,
29
+ - communicate to the public, including the right to make available or display the Work or copies thereof to the public and perform publicly, as the case may be, the Work,
30
+ - distribute the Work or copies thereof,
31
+ - lend and rent the Work or copies thereof,
32
+ - sub-license rights in the Work or copies thereof.
33
+
34
+ Those rights can be exercised on any media, supports and formats, whether now known or later invented, as far as the applicable law permits so.
35
+
36
+ In the countries where moral rights apply, the Licensor waives his right to exercise his moral right to the extent allowed by law in order to make effective the licence of the economic rights here above listed.
37
+
38
+ The Licensor grants to the Licensee royalty-free, non exclusive usage rights to any patents held by the Licensor, to the extent necessary to make use of the rights granted on the Work under this Licence.
39
+
40
+ ## 3. Communication of the Source Code
41
+ The Licensor may provide the Work either in its Source Code form, or as Executable Code. If the Work is provided as Executable Code, the Licensor provides in addition a machine-readable copy of the Source Code of the Work along with each copy of the Work that the Licensor distributes or indicates, in a notice following the copyright notice attached to the Work, a repository where the Source Code is easily and freely accessible for as long as the Licensor continues to distribute and/or communicate the Work.
42
+
43
+ ## 4. Limitations on copyright
44
+ Nothing in this Licence is intended to deprive the Licensee of the benefits from any exception or limitation to the exclusive rights of the rights owners in the Original Work or Software, of the exhaustion of those rights or of other applicable limitations thereto.
45
+
46
+ ## 5. Obligations of the Licensee
47
+ The grant of the rights mentioned above is subject to some restrictions and obligations imposed on the Licensee. Those obligations are the following:
48
+
49
+ **Attribution right**: the Licensee shall keep intact all copyright, patent or trademarks notices and all notices that refer to the Licence and to the disclaimer of warranties. The Licensee must include a copy of such notices and a copy of the Licence with every copy of the Work he/she distributes and/or communicates. The Licensee must cause any Derivative Work to carry prominent notices stating that the Work has been modified and the date of modification.
50
+
51
+ **Copyleft clause**: If the Licensee distributes and/or communicates copies of the Original Works or Derivative Works based upon the Original Work, this Distribution and/or Communication will be done under the terms of this Licence or of a later version of this Licence unless the Original Work is expressly distributed only under this version of the Licence. The Licensee (becoming Licensor) cannot offer or impose any additional terms or conditions on the Work or Derivative Work that alter or restrict the terms of the Licence.
52
+
53
+ **Compatibility clause**: If the Licensee Distributes and/or Communicates Derivative Works or copies thereof based upon both the Original Work and another work licensed under a Compatible Licence, this Distribution and/or Communication can be done under the terms of this Compatible Licence. For the sake of this clause, “Compatible Licence” refers to the licences listed in the appendix attached to this Licence. Should the Licensee’s obligations under the Compatible Licence conflict with his/her obligations under this Licence, the obligations of the Compatible Licence shall prevail.
54
+
55
+ **Provision of Source Code**: When distributing and/or communicating copies of the Work, the Licensee will provide a machine-readable copy of the Source Code or indicate a repository where this Source will be easily and freely available for as long as the Licensee continues to distribute and/or communicate the Work.
56
+
57
+ **Legal Protection**: This Licence does not grant permission to use the trade names, trademarks, service marks, or names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the copyright notice.
58
+
59
+ ## 6. Chain of Authorship
60
+ The original Licensor warrants that the copyright in the Original Work granted hereunder is owned by him/her or licensed to him/her and that he/she has the power and authority to grant the Licence.
61
+
62
+ Each Contributor warrants that the copyright in the modifications he/she brings to the Work are owned by him/her or licensed to him/her and that he/she has the power and authority to grant the Licence.
63
+
64
+ Each time You accept the Licence, the original Licensor and subsequent Contributors grant You a licence to their contributions to the Work, under the terms of this Licence.
65
+
66
+ ## 7. Disclaimer of Warranty
67
+ The Work is a work in progress, which is continuously improved by numerous contributors. It is not a finished work and may therefore contain defects or “bugs” inherent to this type of software development.
68
+
69
+ For the above reason, the Work is provided under the Licence on an “as is” basis and without warranties of any kind concerning the Work, including without limitation merchantability, fitness for a particular purpose, absence of defects or errors, accuracy, non-infringement of intellectual property rights other than copyright as stated in Article 6 of this Licence.
70
+
71
+ This disclaimer of warranty is an essential part of the Licence and a condition for the grant of any rights to the Work.
72
+
73
+ ## 8. Disclaimer of Liability
74
+ Except in the cases of wilful misconduct or damages directly caused to natural persons, the Licensor will in no event be liable for any direct or indirect, material or moral, damages of any kind, arising out of the Licence or of the use of the Work, including without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, loss of data or any commercial damage, even if the Licensor has been advised of the possibility of such damage. However, the Licensor will be liable under statutory product liability laws as far such laws apply to the Work.
75
+
76
+ ## 9. Additional agreements
77
+ While distributing the Original Work or Derivative Works, You may choose to conclude an additional agreement to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or services consistent with this Licence. However, in accepting such obligations, You may act only on your own behalf and on your sole responsibility, not on behalf of the original Licensor or any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against such Contributor by the fact You have accepted any such warranty or additional liability.
78
+ 
79
+ ## 10. Acceptance of the Licence
80
+ The provisions of this Licence can be accepted by clicking on an icon “I agree” placed under the bottom of a window displaying the text of this Licence or by affirming consent in any other similar way, in accordance with the rules of applicable law. Clicking on that icon indicates your clear and irrevocable acceptance of this Licence and all of its terms and conditions.
81
+
82
+ Similarly, you irrevocably accept this Licence and all of its terms and conditions by exercising any rights granted to You by Article 2 of this Licence, such as the use of the Work, the creation by You of a Derivative Work or the Distribution and/or Communication by You of the Work or copies thereof.
83
+
84
+ ## 11. Information to the public
85
+ In case of any Distribution and/or Communication of the Work by means of electronic communication by You (for example, by offering to download the Work from a remote location) the distribution channel or media (for example, a website) must at least provide to the public the information requested by the applicable law regarding the Licensor, the Licence and the way it may be accessible, concluded, stored and reproduced by the Licensee.
86
+
87
+ ## 12. Termination of the Licence
88
+ The Licence and the rights granted hereunder will terminate automatically upon any breach by the Licensee of the terms of the Licence.
89
+
90
+ Such a termination will not terminate the licences of any person who has received the Work from the Licensee under the Licence, provided such persons remain in full compliance with the Licence.
91
+
92
+ ## 13. Miscellaneous
93
+ Without prejudice of Article 9 above, the Licence represents the complete agreement between the Parties as to the Work licensed hereunder.
94
+
95
+ If any provision of the Licence is invalid or unenforceable under applicable law, this will not affect the validity or enforceability of the Licence as a whole. Such provision will be construed and/or reformed so as necessary to make it valid and enforceable.
96
+
97
+ The European Commission may publish other linguistic versions and/or new versions of this Licence, so far this is required and reasonable, without reducing the scope of the rights granted by the Licence. New versions of the Licence will be published with a unique version number.
98
+
99
+ All linguistic versions of this Licence, approved by the European Commission, have identical value. Parties can take advantage of the linguistic version of their choice.
100
+ 
101
+ ## 14. Jurisdiction
102
+ Any litigation resulting from the interpretation of this License, arising between the European Commission, as a Licensor, and any Licensee, will be subject to the jurisdiction of the Court of Justice of the European Communities, as laid down in article 238 of the Treaty establishing the European Community.
103
+
104
+ Any litigation arising between Parties, other than the European Commission, and resulting from the interpretation of this License, will be subject to the exclusive jurisdiction of the competent court where the Licensor resides or conducts its primary business.
105
+
106
+ ## 15. Applicable Law
107
+ This Licence shall be governed by the law of the European Union country where the Licensor resides or has his registered office.
108
+
109
+ This licence shall be governed by the Belgian law if:
110
+
111
+ - a litigation arises between the European Commission, as a Licensor, and any Licensee;
112
+ - the Licensor, other than the European Commission, has no residence or registered office inside a European Union country.
113
+
114
+ ## Appendix
115
+ “Compatible Licences” according to article 5 EUPL are:
116
+ - *GNU General Public License (GNU GPL) v. 2 - Open Software License (OSL) v. 2.1, v. 3.0*
117
+ - *Common Public License v. 1.0*
118
+ - *Eclipse Public License v. 1.0*
119
+ - *Cecill v. 2.0*
@@ -0,0 +1,78 @@
1
+ # Foederati
2
+
3
+ [![Build Status](https://travis-ci.org/europeana/foederati.svg?branch=develop)](https://travis-ci.org/europeana/foederati) [![Coverage Status](https://coveralls.io/repos/github/europeana/foederati/badge.svg?branch=develop)](https://coveralls.io/github/europeana/foederati?branch=develop) [![security](https://hakiri.io/github/europeana/foederati/develop.svg)](https://hakiri.io/github/europeana/foederati/develop) [![Dependency Status](https://gemnasium.com/europeana/foederati.svg)](https://gemnasium.com/europeana/foederati) [![Code Climate](https://codeclimate.com/github/europeana/foederati/badges/gpa.svg)](https://codeclimate.com/github/codeclimate/codeclimate)
4
+
5
+ Federated API search library for Ruby.
6
+
7
+ ## Usage
8
+
9
+ ### With Rails
10
+
11
+ #### Configure Foederati in an initializer
12
+ ```ruby
13
+ # config/initializers/foederati.rb
14
+ Foederati.configure do
15
+ api_keys.dpla = 'dpla_api_key'
16
+ api_keys.digitalnz = 'digitalnz_api_key'
17
+ api_keys.europeana = 'europeana_api_key'
18
+ api_keys.trove = 'trove_api_key'
19
+
20
+ defaults.limit = 4
21
+ end
22
+ ```
23
+
24
+ #### Mount the engine
25
+ ```ruby
26
+ # config/routes.rb
27
+ mount Foederati::Engine
28
+ ```
29
+
30
+ #### Search
31
+
32
+ The Rails engine provides a single controller which searches one or more of the
33
+ available providers' JSON APIs and returns normalised and simplified search
34
+ results.
35
+
36
+ Routes:
37
+ * To search one provider, visit e.g. http://www.example.com/foederati/europeana?q=music
38
+ * To search multiple providers, visit e.g. http://www.example.com/foederati?p=dpla,trove&q=music
39
+
40
+ Parameters:
41
+ * `l`: number of results to request from each provider
42
+ * `p`: comma-separated list of the providers to search
43
+ * `q`: search query, passed as-is to provider APIs (so keep it simple if
44
+ searching more than one!)
45
+
46
+
47
+ ### Without Rails
48
+
49
+ TODO: instruct how to use Foederati outside of Rails.
50
+
51
+ ### Registering custom providers
52
+
53
+ TODO: instruct how to register custom providers.
54
+
55
+ ## Installation
56
+ Add this line to your application's Gemfile:
57
+
58
+ ```ruby
59
+ gem 'foederati'
60
+ ```
61
+
62
+ And then execute:
63
+ ```bash
64
+ $ bundle
65
+ ```
66
+
67
+ Or install it yourself as:
68
+ ```bash
69
+ $ gem install foederati
70
+ ```
71
+
72
+ ## Contributing
73
+ TODO: Contribution directions go here.
74
+
75
+ ## License
76
+ Licensed under the EUPL V.1.1.
77
+
78
+ For full details, see [LICENSE.md](LICENSE.md).
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+
8
+ require 'bundler/gem_tasks'
9
+
10
+ require 'rspec/core/rake_task'
11
+ RSpec::Core::RakeTask.new(:spec)
12
+ task default: :spec
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+ require 'active_support/core_ext/module/delegation'
3
+ require 'active_support/core_ext/object/blank'
4
+ require 'active_support/hash_with_indifferent_access'
5
+ require 'faraday'
6
+ require 'faraday_middleware'
7
+ require 'foederati/faraday_middleware'
8
+ require 'ostruct'
9
+ require 'typhoeus/adapters/faraday'
10
+
11
+ require 'foederati/engine' if defined?(Rails)
12
+
13
+ # TODO add logger
14
+ module Foederati
15
+ autoload :FaradayMiddleware, 'foederati/faraday_middleware'
16
+ autoload :Provider, 'foederati/provider'
17
+ autoload :Providers, 'foederati/providers'
18
+
19
+ Defaults = Struct.new(:limit)
20
+
21
+ class << self
22
+ def configure(&block)
23
+ instance_eval(&block)
24
+ self
25
+ end
26
+
27
+ def api_keys
28
+ @api_keys ||= OpenStruct.new
29
+ end
30
+
31
+ def defaults
32
+ @defaults ||= Defaults.new
33
+ end
34
+
35
+ ##
36
+ # Search registered providers
37
+ #
38
+ # @param ids [Symbol] ID(s) of one or more provider to search
39
+ # @param params [Hash] search query parameters
40
+ # @return [Hash] combined results of all providers
41
+ # TODO run multiple searches in parallel
42
+ def search(*ids, **params)
43
+ ids.map do |id|
44
+ Providers.get(id).search(params)
45
+ end.reduce(&:merge)
46
+ end
47
+
48
+ ##
49
+ # `Faraday` connection for executing HTTP requests
50
+ #
51
+ # @return [Faraday::Connection]
52
+ def connection
53
+ @connection ||= begin
54
+ Faraday.new do |conn|
55
+ # TODO are max: 5 and interval: 3 sensible values? should they be
56
+ # made configurable?
57
+ conn.request :retry, max: 5, interval: 3,
58
+ exceptions: [Errno::ECONNREFUSED, Errno::ETIMEDOUT, 'Timeout::Error',
59
+ Faraday::Error::TimeoutError, EOFError]
60
+
61
+ conn.response :unsupported #, content_type: /\bjson$/
62
+ conn.response :json, content_type: /\bjson$/
63
+
64
+ conn.adapter :typhoeus
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
70
+
71
+ # TODO something nicer than this
72
+ Dir.glob(File.expand_path('../foederati/providers/*.rb', __FILE__)).each do |file|
73
+ require file
74
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+ module Foederati
3
+ class Engine < ::Rails::Engine
4
+ isolate_namespace Foederati
5
+ end
6
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+ require 'faraday_middleware/response_middleware'
3
+
4
+ module Foederati
5
+ module FaradayMiddleware
6
+ ##
7
+ # Response handler for unspported content types returned by provider APIs
8
+ #
9
+ # For instance, if upstream APIs break and start returning HTML or text from
10
+ # load balancers.
11
+ class ParseUnsupportedContentTypes < ::FaradayMiddleware::ResponseMiddleware
12
+ def process_response(env)
13
+ super
14
+ content_type = env.response_headers['Content-Type']
15
+ fail Faraday::ParsingError,
16
+ %(API responded with Content-Type "#{content_type}" and status #{env[:status]})
17
+ end
18
+ end
19
+
20
+ Faraday::Response.register_middleware unsupported: -> { ParseUnsupportedContentTypes }
21
+ end
22
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+ module Foederati
3
+ ##
4
+ # A Foederati provider is one JSON API provider capable of being searched by
5
+ # the Foederati.
6
+ #
7
+ # TODO allow specification of a wildcard to search all the provider's records
8
+ class Provider
9
+ autoload :Request, 'foederati/provider/request'
10
+ autoload :Response, 'foederati/provider/response'
11
+
12
+ # TODO validate the type of values added to these
13
+ Urls = Struct.new(:api, :site)
14
+ Results = Struct.new(:items, :total)
15
+ Fields = Struct.new(:title, :thumbnail, :url)
16
+
17
+ attr_reader :id, :urls, :results, :fields
18
+
19
+ def initialize(id, &block)
20
+ @id = id
21
+ @urls = Urls.new
22
+ @results = Results.new
23
+ @fields = Fields.new
24
+
25
+ instance_eval(&block) if block_given?
26
+
27
+ self
28
+ end
29
+
30
+ # TODO sanity check things like presence of API URL
31
+ def search(**params)
32
+ request.execute(params).normalise
33
+ end
34
+
35
+ protected
36
+
37
+ def request
38
+ Request.new(self)
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+ module Foederati
3
+ class Provider
4
+ ##
5
+ # Makes HTTP requests to provider APIs.
6
+ #
7
+ # Used by `Foederati::Provider#search`.
8
+ class Request
9
+ attr_reader :provider
10
+
11
+ delegate :id, :urls, to: :provider
12
+ delegate :connection, to: Foederati
13
+
14
+ # @param provider [Foederati::Provider] the provider to make an API request for
15
+ def initialize(provider)
16
+ @provider = provider
17
+ end
18
+
19
+ ##
20
+ # Executes a query against the provider's API
21
+ #
22
+ # @param params [Hash] query-specific URL parameters
23
+ # @return [Foederati::Response] response from the API
24
+ def execute(**params)
25
+ faraday_response = connection.get(api_url(params))
26
+ Response.new(provider, faraday_response)
27
+ end
28
+
29
+ ##
30
+ # Default parameters to add to query-specific ones when querying the
31
+ # provider's API.
32
+ #
33
+ # For instance, API key and limit.
34
+ #
35
+ # @return [Hash]
36
+ def default_params
37
+ { api_key: Foederati.api_keys.send(id) }.merge(Foederati.defaults.to_h)
38
+ end
39
+
40
+ ##
41
+ # Construct the URL for making an API request
42
+ #
43
+ # @param params [Hash] query-specific URL parameters
44
+ # @return [String] the provider's API URL with all necessary params
45
+ def api_url(**params)
46
+ format(urls.api, default_params.merge(params))
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,85 @@
1
+ # frozen_string_literal: true
2
+ module Foederati
3
+ class Provider
4
+ ##
5
+ # Contains a response from a request to a provider's API
6
+ #
7
+ # Returned by `Foederati::Provider::Request#execute`.
8
+ class Response
9
+ attr_reader :provider, :faraday_response
10
+
11
+ delegate :body, to: :faraday_response
12
+ delegate :results, :fields, :id, to: :provider
13
+
14
+ # @param provider [Foederati::Provider] provider the API response is for
15
+ # @param faraday_response [Faraday::Response] Faraday response object
16
+ def initialize(provider, faraday_response)
17
+ @provider = provider
18
+ @faraday_response = faraday_response
19
+ end
20
+
21
+ ##
22
+ # Normalises response from provider's API
23
+ #
24
+ # @return [Hash]
25
+ def normalise
26
+ {
27
+ id => {
28
+ total: fetch_from_response(results.total, body) || 0,
29
+ results: items_from_response.map do |item|
30
+ {
31
+ title: fetch_from_response(fields.title, item),
32
+ thumbnail: fetch_from_response(fields.thumbnail, item),
33
+ url: fetch_from_response(fields.url, item)
34
+ }
35
+ end
36
+ }
37
+ }
38
+ end
39
+ alias_method :to_h, :normalise
40
+
41
+ protected
42
+
43
+ ##
44
+ # Gets the set of items from the response body
45
+ #
46
+ # @return [Array]
47
+ def items_from_response
48
+ fetch_from_response(results.items, body) || []
49
+ end
50
+
51
+ ##
52
+ # Fetch a field from part of the provider's JSON response
53
+ #
54
+ # @param field `Proc` to call with `hash`, else keys to pass to `#fetch_deep`
55
+ # @param hash [Hash] (part of) the JSON response hash
56
+ def fetch_from_response(field, hash)
57
+ if field.blank?
58
+ nil
59
+ elsif field.respond_to?(:call)
60
+ field.call(hash)
61
+ else
62
+ fetch_deep(field, hash)
63
+ end
64
+ end
65
+
66
+ ##
67
+ # Digs down into a nested hash to get the value beneath multiple keys
68
+ #
69
+ # @example
70
+ # fetch_deep(%i(a b), { a: { b: 'c' } }) #=> 'c'
71
+ #
72
+ # @param keys one or more keys to fetch from the hash
73
+ # @param hash [Hash] the hash to fetch deep from
74
+ def fetch_deep(keys, hash)
75
+ return hash unless hash.is_a?(Hash)
76
+
77
+ local_keys = [keys.dup].flatten
78
+ return hash if local_keys.blank?
79
+
80
+ key = local_keys.shift
81
+ fetch_deep(local_keys, hash[key])
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+ module Foederati
3
+ ##
4
+ # All providers known to Foederati
5
+ class Providers
6
+ @registry = HashWithIndifferentAccess.new
7
+
8
+ class << self
9
+ attr_reader :registry
10
+
11
+ ##
12
+ # Register a provider
13
+ #
14
+ # @param id_or_provider [Symbol,Foederati::Provider] identifier of a new
15
+ # provider, or an instantiated provider
16
+ def register(id_or_provider, &block)
17
+ case id_or_provider
18
+ when Foederati::Provider
19
+ registry[id_or_provider.id] = id_or_provider
20
+ when Symbol
21
+ registry[id_or_provider] = Provider.new(id_or_provider, &block)
22
+ else
23
+ fail ArgumentError, "Expected Symbol or Foederati::Provider, got #{id_or_provider.class}"
24
+ end
25
+ end
26
+
27
+ ##
28
+ # Unregisters a provider
29
+ #
30
+ # @param id [Symbol] unique identifier of the provider
31
+ # @param provider [Foederati::Provider] provider removed from the registry
32
+ def unregister(id)
33
+ registry.delete(id)
34
+ end
35
+
36
+ ##
37
+ # Get a provider from the registry
38
+ #
39
+ # @param id [Symbol] identifier of the provider to get
40
+ # @return [Foederati::Provider]
41
+ def get(id)
42
+ registry[id]
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ # DigitalNZ
4
+ Foederati::Providers.register :digitalnz do
5
+ urls.api = 'https://api.digitalnz.org/v3/records.json?api_key=%{api_key}&text=%{query}&per_page=%{limit}'
6
+ urls.site = 'https://digitalnz.org/records?text=%{query}'
7
+
8
+ results.items = %w(search results)
9
+ results.total = %w(search result_count)
10
+
11
+ fields.title = 'title'
12
+ fields.thumbnail = 'thumbnail_url'
13
+ fields.url = 'source_url'
14
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ # DPLA
4
+ Foederati::Providers.register :dpla do
5
+ urls.api = 'https://api.dp.la/v2/items?api_key=%{api_key}&q=%{query}&page_size=%{limit}'
6
+ urls.site = 'https://dp.la/search?q=%{query}'
7
+
8
+ results.items = 'docs'
9
+ results.total = 'count'
10
+
11
+ fields.title = %w(sourceResource title)
12
+ fields.thumbnail = 'object'
13
+ fields.url = 'isShownAt'
14
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Europeana
4
+ Foederati::Providers.register :europeana do
5
+ urls.api = 'https://www.europeana.eu/api/v2/search.json?wskey=%{api_key}&query=%{query}&rows=%{limit}&profile=minimal'
6
+ urls.site = 'http://www.europeana.eu/portal/search?q=%{query}'
7
+
8
+ results.items = 'items'
9
+ results.total = 'totalResults'
10
+
11
+ fields.title = 'title'
12
+ fields.thumbnail = 'edmPreview'
13
+ fields.url = 'guid'
14
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Trove
4
+ Foederati::Providers.register :trove do
5
+ urls.api = 'http://api.trove.nla.gov.au/result?key=%{api_key}&q=%{query}&n=%{limit}&zone=picture&encoding=json'
6
+ urls.site = 'http://trove.nla.gov.au/result?q=%{query}'
7
+
8
+ results.items = ->(response) { response['response']['zone'].detect { |zone| zone['name'] == 'picture' }['records']['work'] }
9
+ results.total = ->(response) { response['response']['zone'].detect { |zone| zone['name'] == 'picture' }['records']['total'].to_i }
10
+
11
+ fields.title = 'title'
12
+ fields.thumbnail = ->(item) { item['identifier'].detect { |identifier| identifier['linktype'] == 'thumbnail' }['value'] }
13
+ fields.url = 'troveUrl'
14
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+ module Foederati
3
+ VERSION = '0.1.0'
4
+ end
@@ -0,0 +1,81 @@
1
+ # frozen_string_literal: true
2
+ RSpec.describe Foederati::Provider::Request do
3
+ subject { described_class.new(provider) }
4
+
5
+ let(:provider) do
6
+ Foederati::Provider.new(:good_provider).tap do |p|
7
+ p.urls.api = "#{api_url}?q=%{query}&k=%{api_key}&l=%{limit}"
8
+ end
9
+ end
10
+ let(:api_url) { 'http://api.example.com/' }
11
+ let(:query) { 'whale' }
12
+ let(:api_key) { 'moby' }
13
+ let(:result_limit) { 10 }
14
+
15
+ before do
16
+ Foederati.api_keys.good_provider = api_key
17
+ Foederati.defaults.limit = result_limit
18
+ Foederati::Providers.register(provider)
19
+ end
20
+
21
+ after do
22
+ Foederati::Providers.unregister(provider.id)
23
+ end
24
+
25
+ describe '#execute' do
26
+ context 'when API responds with JSON' do
27
+ before do
28
+ stub_request(:get, api_url).with(query: hash_including(q: query)).
29
+ to_return(status: 200,
30
+ body: '{}',
31
+ headers: { 'Content-Type' => 'application/json;charset=UTF-8' })
32
+ end
33
+
34
+ it "sends a request to the provider's API" do
35
+ subject.execute(query: query)
36
+ expect(a_request(:get, api_url).with(query: hash_including(q: query))).to have_been_made
37
+ end
38
+
39
+ it 'returns a response object with Faraday response stored' do
40
+ response = subject.execute(query: query)
41
+ expect(response).to be_a Foederati::Provider::Response
42
+ expect(response.faraday_response).to be_a Faraday::Response
43
+ end
44
+ end
45
+
46
+ context 'when API responds with non-JSON' do
47
+ before do
48
+ stub_request(:get, api_url).with(query: hash_including(q: query)).
49
+ to_return(status: 200,
50
+ body: '<html></html>',
51
+ headers: { 'Content-Type' => 'text/html;charset=UTF-8' })
52
+ end
53
+
54
+ it 'fails with Faraday::ParsingError' do
55
+ expect { described_class.new(provider).execute(query: query) }.
56
+ to raise_error(Faraday::ParsingError)
57
+ end
58
+ end
59
+ end
60
+
61
+ describe '#default_params' do
62
+ it 'adds limit from Foederati defaults' do
63
+ expect(subject.default_params[:limit]).to eq(result_limit)
64
+ end
65
+ it 'adds API key for provider' do
66
+ expect(subject.default_params[:api_key]).to eq(api_key)
67
+ end
68
+ end
69
+
70
+ describe '#api_url' do
71
+ it 'replaces placeholders in API URL with params' do
72
+ expect(subject.api_url(query: query)).to \
73
+ eq("http://api.example.com/?q=#{query}&k=#{api_key}&l=#{result_limit}")
74
+ end
75
+
76
+ it 'overrides defaults with args' do
77
+ expect(subject.api_url(query: query, limit: 5)).to \
78
+ eq("http://api.example.com/?q=#{query}&k=#{api_key}&l=5")
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,110 @@
1
+ # frozen_string_literal: true
2
+ require 'faraday'
3
+
4
+ RSpec.describe Foederati::Provider::Response do
5
+ describe '#normalise' do
6
+ let(:provider) do
7
+ Foederati::Provider.new(:friendly_provider) do
8
+ results.total = 'totalItems'
9
+ results.items = 'searchResults'
10
+ fields.title = 'dcTitle'
11
+ fields.thumbnail = 'edmIsShownBy'
12
+ fields.url = 'guid'
13
+ end
14
+ end
15
+
16
+ let(:faraday_response) do
17
+ double(Faraday::Response).tap do |faraday_response|
18
+ allow(faraday_response).to receive(:body).and_return(faraday_response_body)
19
+ end
20
+ end
21
+
22
+ let(:faraday_response_body) do
23
+ {
24
+ 'totalItems' => 123,
25
+ 'searchResults' => [
26
+ {
27
+ 'dcTitle' => 'One result',
28
+ 'edmIsShownBy' => 'http://www.example.com/one.jpg',
29
+ 'guid' => 'http://www.example.com/one.html'
30
+ }
31
+ ]
32
+ }
33
+ end
34
+
35
+ subject { described_class.new(provider, faraday_response).normalise }
36
+
37
+ it { is_expected.to be_a Hash }
38
+
39
+ it 'is keyed by provider ID' do
40
+ expect(subject).to have_key(provider.id)
41
+ end
42
+
43
+ describe 'provider ID keyed hash' do
44
+ subject { described_class.new(provider, faraday_response).normalise[provider.id] }
45
+
46
+ describe 'total' do
47
+ context 'when in API response' do
48
+ it 'is mapped' do
49
+ expect(subject).to have_key(:total)
50
+ expect(subject[:total]).to eq(faraday_response_body['totalItems'])
51
+ end
52
+ end
53
+
54
+ context 'when not in API response' do
55
+ before do
56
+ faraday_response_body.delete('totalItems')
57
+ end
58
+
59
+ it 'defaults to 0' do
60
+ expect(subject[:total]).to be_zero
61
+ end
62
+ end
63
+ end
64
+
65
+ it { is_expected.to have_key :results }
66
+
67
+ describe 'results' do
68
+ subject { described_class.new(provider, faraday_response).normalise[provider.id][:results] }
69
+
70
+ it { is_expected.to be_a Array }
71
+
72
+ it 'has one element for each result' do
73
+ expect(subject.count).to eq(faraday_response_body['searchResults'].count)
74
+ end
75
+
76
+ describe 'each result' do
77
+ subject { described_class.new(provider, faraday_response).normalise[provider.id][:results].first }
78
+ let(:provider_result) { faraday_response_body['searchResults'].first }
79
+
80
+ it 'includes title' do
81
+ expect(subject[:title]).to eq(provider_result['dcTitle'])
82
+ end
83
+
84
+ it 'includes thumbnail' do
85
+ expect(subject[:thumbnail]).to eq(provider_result['edmIsShownBy'])
86
+ end
87
+
88
+ it 'includes URL' do
89
+ expect(subject[:url]).to eq(provider_result['guid'])
90
+ end
91
+ end
92
+ end
93
+
94
+ describe 'response traversal' do
95
+ it 'handles arrays of keys' do
96
+ provider.results.items = %w(results search)
97
+ faraday_response_body['results'] = {
98
+ 'search' => faraday_response_body.delete('searchResults')
99
+ }
100
+ expect(described_class.new(provider, faraday_response).normalise[provider.id][:results].count).to eq(faraday_response_body['results']['search'].count)
101
+ end
102
+
103
+ it 'handles procs' do
104
+ provider.results.items = ->(response) { response['searchResults'] }
105
+ expect(described_class.new(provider, faraday_response).normalise[provider.id][:results].count).to eq(faraday_response_body['searchResults'].count)
106
+ end
107
+ end
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+ RSpec.describe Foederati::Provider do
3
+ describe '#urls' do
4
+ subject { described_class.new(:new_provider).urls }
5
+ it { is_expected.to respond_to :api }
6
+ it { is_expected.to respond_to :site }
7
+ end
8
+
9
+ describe '#results' do
10
+ subject { described_class.new(:new_provider).results }
11
+ it { is_expected.to respond_to :items }
12
+ it { is_expected.to respond_to :total }
13
+ end
14
+
15
+ describe '#fields' do
16
+ subject { described_class.new(:new_provider).fields }
17
+ it { is_expected.to respond_to :title }
18
+ it { is_expected.to respond_to :thumbnail }
19
+ it { is_expected.to respond_to :url }
20
+ end
21
+
22
+ describe '#initialize' do
23
+ it 'evaluates a given block' do
24
+ provider = described_class.new(:new_provider) do
25
+ urls.api = 'http://api.example.com/'
26
+ end
27
+ expect(provider.urls.api).to eq('http://api.example.com/')
28
+ end
29
+ end
30
+
31
+ describe '#search' do
32
+ let(:search_params) { { query: 'fish' } }
33
+
34
+ it 'creates and executes a request' do
35
+ provider = described_class.new(:new_provider)
36
+
37
+ mock_request = double(Foederati::Provider::Request)
38
+ mock_response = double(Foederati::Provider::Response)
39
+
40
+ allow(provider).to receive(:request).and_return(mock_request)
41
+
42
+ expect(mock_request).to receive(:execute).with(search_params).and_return(mock_response)
43
+ expect(mock_response).to receive(:normalise)
44
+
45
+ provider.search(search_params)
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+ RSpec.describe Foederati::Providers do
3
+ it 'has registered Europeana' do
4
+ expect(described_class.registry).to have_key(:europeana)
5
+ end
6
+ end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+ RSpec.describe Foederati::Providers do
3
+ subject { described_class }
4
+
5
+ describe '.registry' do
6
+ subject { described_class.registry }
7
+
8
+ it 'has indifferent access' do
9
+ expect(subject).to be_a(HashWithIndifferentAccess)
10
+ end
11
+
12
+ it 'supports some providers by default' do
13
+ expect(subject.keys.sort).to eq(%w(europeana dpla digitalnz trove).sort)
14
+ end
15
+ end
16
+
17
+ describe '.get' do
18
+ let(:registered_provider) { double(Foederati::Provider) }
19
+ it 'returns the registered provider' do
20
+ allow(described_class).to receive(:registry) { { registered_provider: registered_provider } }
21
+ expect(described_class.get(:registered_provider)).to eq(registered_provider)
22
+ end
23
+ end
24
+
25
+ describe '.register' do
26
+ it 'adds a provider to the registry' do
27
+ subject.register(:new_provider)
28
+ expect(subject.registry).to have_key(:new_provider)
29
+ end
30
+
31
+ it 'accepts a provider instance' do
32
+ provider = Foederati::Provider.new(:new_provider)
33
+ subject.register(provider)
34
+ expect(subject.registry[:new_provider]).to eq(provider)
35
+ end
36
+
37
+ it 'accepts a Symbol as ID' do
38
+ subject.register(:fish_provider)
39
+ expect(subject.registry[:fish_provider]).to be_a(Foederati::Provider)
40
+ end
41
+
42
+ it 'fails with other arg types' do
43
+ expect { subject.register('fish_provider') }.to raise_error(ArgumentError)
44
+ end
45
+
46
+ it 'evaluates a given block' do
47
+ subject.register(:new_provider) do
48
+ urls.api = 'http://api.example.com/'
49
+ end
50
+ expect(subject.get(:new_provider).urls.api).to eq('http://api.example.com/')
51
+ end
52
+ end
53
+
54
+ describe '.unregister' do
55
+ let(:provider) { Foederati::Provider.new(:cunning_provider) }
56
+
57
+ before do
58
+ Foederati::Providers.register(provider)
59
+ end
60
+
61
+ it 'removes the provider from the registry' do
62
+ expect(subject.registry.values).to include(provider)
63
+ subject.unregister(provider.id)
64
+ expect(subject.registry.values).not_to include(provider)
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+ RSpec.describe Foederati do
3
+ describe '.defaults' do
4
+ subject { described_class.defaults }
5
+ it { is_expected.to respond_to :limit }
6
+ end
7
+
8
+ describe '.api_keys' do
9
+ subject { described_class.api_keys }
10
+ it 'accepts arbitrary attr assignment' do
11
+ expect { subject.not_a_known_api }.not_to raise_error
12
+ end
13
+ end
14
+
15
+ describe '.configure' do
16
+ it 'configures Foederati in a block' do
17
+ Foederati::Providers.register(:my_provider)
18
+ described_class.configure do
19
+ api_keys.my_provider = 'secret'
20
+ end
21
+ expect(described_class.api_keys.my_provider).to eq('secret')
22
+ end
23
+ end
24
+
25
+ describe '.connection' do
26
+ subject { described_class.connection }
27
+ it { is_expected.to be_a Faraday::Connection }
28
+ end
29
+
30
+ describe '.search' do
31
+ context 'with one provider specified' do
32
+ it 'searches that provider' do
33
+ best_provider = double(Foederati::Provider)
34
+ allow(Foederati::Providers).to receive(:get).with(:best_provider) { best_provider }
35
+ expect(best_provider).to receive(:search).with(query: 'river', api_key: 'secret')
36
+ described_class.search(:best_provider, query: 'river', api_key: 'secret')
37
+ end
38
+ end
39
+
40
+ context 'with multiple providers specified' do
41
+ let(:first_provider) { double(Foederati::Provider) }
42
+ let(:second_provider) { double(Foederati::Provider) }
43
+ let(:params) { { query: 'jelly' } }
44
+
45
+ before do
46
+ allow(Foederati::Providers).to receive(:get).with(:first_provider) { first_provider }
47
+ allow(Foederati::Providers).to receive(:get).with(:second_provider) { second_provider }
48
+ allow(first_provider).to receive(:search) { { first_provider: {} } }
49
+ allow(second_provider).to receive(:search) { { second_provider: {} } }
50
+ end
51
+
52
+ it 'searches each of those providers' do
53
+ expect(first_provider).to receive(:search).with(params)
54
+ expect(second_provider).to receive(:search).with(params)
55
+ described_class.search(:first_provider, :second_provider, params)
56
+ end
57
+
58
+ it 'merges results' do
59
+ response = described_class.search(:first_provider, :second_provider, params)
60
+ expect(response).to have_key(:first_provider)
61
+ expect(response).to have_key(:second_provider)
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,108 @@
1
+ # frozen_string_literal: true
2
+ require 'coveralls'
3
+ require 'foederati'
4
+ require 'webmock/rspec'
5
+
6
+ Coveralls.wear! unless Coveralls.will_run?.nil?
7
+
8
+ # This file was generated by the `rspec --init` command. Conventionally, all
9
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
10
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
11
+ # this file to always be loaded, without a need to explicitly require it in any
12
+ # files.
13
+ #
14
+ # Given that it is always loaded, you are encouraged to keep this file as
15
+ # light-weight as possible. Requiring heavyweight dependencies from this file
16
+ # will add to the boot time of your test suite on EVERY test run, even for an
17
+ # individual file that may not need all of that loaded. Instead, consider making
18
+ # a separate helper file that requires the additional dependencies and performs
19
+ # the additional setup, and require it from the spec files that actually need
20
+ # it.
21
+ #
22
+ # The `.rspec` file also contains a few flags that are not defaults but that
23
+ # users commonly want.
24
+ #
25
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
26
+ RSpec.configure do |config|
27
+ # rspec-expectations config goes here. You can use an alternate
28
+ # assertion/expectation library such as wrong or the stdlib/minitest
29
+ # assertions if you prefer.
30
+ config.expect_with :rspec do |expectations|
31
+ # This option will default to `true` in RSpec 4. It makes the `description`
32
+ # and `failure_message` of custom matchers include text for helper methods
33
+ # defined using `chain`, e.g.:
34
+ # be_bigger_than(2).and_smaller_than(4).description
35
+ # # => "be bigger than 2 and smaller than 4"
36
+ # ...rather than:
37
+ # # => "be bigger than 2"
38
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
39
+ end
40
+
41
+ # rspec-mocks config goes here. You can use an alternate test double
42
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
43
+ config.mock_with :rspec do |mocks|
44
+ # Prevents you from mocking or stubbing a method that does not exist on
45
+ # a real object. This is generally recommended, and will default to
46
+ # `true` in RSpec 4.
47
+ mocks.verify_partial_doubles = true
48
+ end
49
+
50
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
51
+ # have no way to turn it off -- the option exists only for backwards
52
+ # compatibility in RSpec 3). It causes shared context metadata to be
53
+ # inherited by the metadata hash of host groups and examples, rather than
54
+ # triggering implicit auto-inclusion in groups with matching metadata.
55
+ config.shared_context_metadata_behavior = :apply_to_host_groups
56
+
57
+ # The settings below are suggested to provide a good initial experience
58
+ # with RSpec, but feel free to customize to your heart's content.
59
+ # # This allows you to limit a spec run to individual examples or groups
60
+ # # you care about by tagging them with `:focus` metadata. When nothing
61
+ # # is tagged with `:focus`, all examples get run. RSpec also provides
62
+ # # aliases for `it`, `describe`, and `context` that include `:focus`
63
+ # # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
64
+ # config.filter_run_when_matching :focus
65
+ #
66
+ # # Allows RSpec to persist some state between runs in order to support
67
+ # # the `--only-failures` and `--next-failure` CLI options. We recommend
68
+ # # you configure your source control system to ignore this file.
69
+ # config.example_status_persistence_file_path = "spec/examples.txt"
70
+ #
71
+ # # Limits the available syntax to the non-monkey patched syntax that is
72
+ # # recommended. For more details, see:
73
+ # # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
74
+ # # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
75
+ # # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
76
+ # config.disable_monkey_patching!
77
+ #
78
+ # # This setting enables warnings. It's recommended, but in some cases may
79
+ # # be too noisy due to issues in dependencies.
80
+ # config.warnings = true
81
+ #
82
+ # # Many RSpec users commonly either run the entire suite or an individual
83
+ # # file, and it's useful to allow more verbose output when running an
84
+ # # individual spec file.
85
+ # if config.files_to_run.one?
86
+ # # Use the documentation formatter for detailed output,
87
+ # # unless a formatter has already been configured
88
+ # # (e.g. via a command-line flag).
89
+ # config.default_formatter = 'doc'
90
+ # end
91
+ #
92
+ # # Print the 10 slowest examples and example groups at the
93
+ # # end of the spec run, to help surface which specs are running
94
+ # # particularly slow.
95
+ # config.profile_examples = 10
96
+ #
97
+ # # Run specs in random order to surface order dependencies. If you find an
98
+ # # order dependency and want to debug it, you can fix the order by providing
99
+ # # the seed, which is printed after each run.
100
+ # # --seed 1234
101
+ # config.order = :random
102
+ #
103
+ # # Seed global randomization in this process using the `--seed` CLI option.
104
+ # # Setting this allows you to use `--seed` to deterministically reproduce
105
+ # # test failures related to randomization by passing the same `--seed` value
106
+ # # as the one that triggered the failure.
107
+ # Kernel.srand config.seed
108
+ end
metadata ADDED
@@ -0,0 +1,184 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: foederati
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Richard Doe
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-05-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 4.2.2
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '6.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 4.2.2
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '6.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: faraday
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: faraday_middleware
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: typhoeus
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '1'
68
+ type: :runtime
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '1'
75
+ - !ruby/object:Gem::Dependency
76
+ name: rake
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: rubocop
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - '='
94
+ - !ruby/object:Gem::Version
95
+ version: 0.39.0
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - '='
101
+ - !ruby/object:Gem::Version
102
+ version: 0.39.0
103
+ - !ruby/object:Gem::Dependency
104
+ name: rspec
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '3.5'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '3.5'
117
+ - !ruby/object:Gem::Dependency
118
+ name: webmock
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '2'
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: '2'
131
+ description:
132
+ email:
133
+ - richard.doe@rwdit.net
134
+ executables: []
135
+ extensions: []
136
+ extra_rdoc_files: []
137
+ files:
138
+ - LICENSE.md
139
+ - README.md
140
+ - Rakefile
141
+ - lib/foederati.rb
142
+ - lib/foederati/engine.rb
143
+ - lib/foederati/faraday_middleware.rb
144
+ - lib/foederati/provider.rb
145
+ - lib/foederati/provider/request.rb
146
+ - lib/foederati/provider/response.rb
147
+ - lib/foederati/providers.rb
148
+ - lib/foederati/providers/digitalnz.rb
149
+ - lib/foederati/providers/dpla.rb
150
+ - lib/foederati/providers/europeana.rb
151
+ - lib/foederati/providers/trove.rb
152
+ - lib/foederati/version.rb
153
+ - spec/lib/foederati/provider/request_spec.rb
154
+ - spec/lib/foederati/provider/response_spec.rb
155
+ - spec/lib/foederati/provider_spec.rb
156
+ - spec/lib/foederati/providers/europeana_spec.rb
157
+ - spec/lib/foederati/providers_spec.rb
158
+ - spec/lib/foederati_spec.rb
159
+ - spec/spec_helper.rb
160
+ homepage: https://github.com/europeana/foederati
161
+ licenses:
162
+ - EUPL-1.1
163
+ metadata: {}
164
+ post_install_message:
165
+ rdoc_options: []
166
+ require_paths:
167
+ - lib
168
+ required_ruby_version: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: 2.1.0
173
+ required_rubygems_version: !ruby/object:Gem::Requirement
174
+ requirements:
175
+ - - ">="
176
+ - !ruby/object:Gem::Version
177
+ version: '0'
178
+ requirements: []
179
+ rubyforge_project:
180
+ rubygems_version: 2.5.2
181
+ signing_key:
182
+ specification_version: 4
183
+ summary: Federated search
184
+ test_files: []