Module: Europeana

Defined in:
lib/europeana.rb,
lib/europeana/errors.rb,
lib/europeana/record.rb,
lib/europeana/search.rb,
lib/europeana/version.rb

Defined Under Namespace

Modules: Errors Classes: Record, Search

Constant Summary collapse

URL =
'http://www.europeana.eu/api/v2'
VERSION =
"0.2.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.api_keyObject

The Europeana API key, required for authentication


15
16
17
# File 'lib/europeana.rb', line 15

def api_key
  @api_key
end

.max_retriesInteger

The maximum number of retries permitted

Retries occur when a network request to the API fails. The default is 5 retries before giving up.


25
26
27
# File 'lib/europeana.rb', line 25

def max_retries
  @max_retries
end

.retry_delayInteger

The number of seconds to wait between retries

The default is 10 seconds.


34
35
36
# File 'lib/europeana.rb', line 34

def retry_delay
  @retry_delay
end

Class Method Details

.defaults!Object

Sets configuration values to their defaults


39
40
41
42
# File 'lib/europeana.rb', line 39

def defaults!
  self.max_retries = 5
  self.retry_delay = 10
end

.record(record_id, params = {}) ⇒ Hash

Sends a Record request to the Europeana API

Equivalent to:

search = Europeana::Record.new(record_id, params)
record.get

71
72
73
# File 'lib/europeana.rb', line 71

def record(record_id, params = {})
  Record.new(record_id, params).get
end

.search(params = {}) ⇒ Hash

Sends a Search request to the Europeana API

Equivalent to:

search = Europeana::Search.new(params)
search.execute

55
56
57
# File 'lib/europeana.rb', line 55

def search(params = {})
  Search.new(params).execute
end