Sha256: 4d69f4b122414fa071a84abd92eb583f3f94bd487431dbadd3a5fd319462b3b3

Contents?: true

Size: 692 Bytes

Versions: 1

Compression:

Stored size: 692 Bytes

Contents

# frozen_string_literal: true

# Trove
Foederati::Providers.register :trove do
  urls.api = 'http://api.trove.nla.gov.au/result?key=%{api_key}&q=%{query}&n=%{limit}&zone=picture&encoding=json'
  urls.site = 'http://trove.nla.gov.au/result?q=%{query}'

  results.items = ->(response) { response['response']['zone'].detect { |zone| zone['name'] == 'picture' }['records']['work'] }
  results.total = ->(response) { response['response']['zone'].detect { |zone| zone['name'] == 'picture' }['records']['total'].to_i }

  fields.title = 'title'
  fields.thumbnail = ->(item) { item['identifier'].detect { |identifier| identifier['linktype'] == 'thumbnail' }['value'] }
  fields.url = 'troveUrl'
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
foederati-0.1.0 lib/foederati/providers/trove.rb