lib/europeana/blacklight/repository.rb in europeana-blacklight-0.5.0 vs lib/europeana/blacklight/repository.rb in europeana-blacklight-0.5.1
- old
+ new
@@ -11,20 +11,20 @@
# @param id [String] record ID
# @params params [Hash] request params to send to API
# @return (see blacklight_config.response_model)
def find(id, params = {})
id = "/#{id}" unless id[0] == '/'
- res = connection.record(id, params)
+ res = connection.record.fetch(params.merge(id: id))
blacklight_config.response_model.new(
res, params, document_model: blacklight_config.document_model,
blacklight_config: blacklight_config
)
end
def search(params = {})
- res = connection.search(params)
+ res = connection.record.search(params.to_h)
blacklight_config.response_model.new(
res, params, document_model: blacklight_config.document_model,
blacklight_config: blacklight_config
)
@@ -40,26 +40,10 @@
[mlt_response, mlt_response.documents]
end
def build_connection
Europeana::API.tap do |api|
- api.api_key = blacklight_config.connection_config[:europeana_api_key]
- api.cache_store = cache_store
- api.cache_expires_in = cache_expires_in
- end
- end
-
- protected
-
- def cache_store
- @cache_store ||= begin
- blacklight_config.europeana_api_cache || ActiveSupport::Cache::NullStore.new
- end
- end
-
- def cache_expires_in
- @expires_in ||= begin
- blacklight_config.europeana_api_cache_expires_in || 24.hours
+ api.key = blacklight_config.connection_config[:europeana_api_key]
end
end
end
end
end