Class: Foederati::Provider

Inherits:
Object
  • Object
show all
Defined in:
lib/foederati/provider.rb,
lib/foederati/provider/request.rb,
lib/foederati/provider/response.rb

Overview

A Foederati provider is one JSON API provider capable of being searched by the Foederati.

TODO allow specification of a wildcard to search all the provider’s records

Defined Under Namespace

Classes: Fields, Request, Response, Results, Urls

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, &block) ⇒ Provider

Returns a new instance of Provider.



19
20
21
22
23
24
25
26
27
28
# File 'lib/foederati/provider.rb', line 19

def initialize(id, &block)
  @id = id
  @urls = Urls.new
  @results = Results.new
  @fields = Fields.new

  instance_eval(&block) if block_given?

  self
end

Instance Attribute Details

#fieldsObject (readonly)

Returns the value of attribute fields.



17
18
19
# File 'lib/foederati/provider.rb', line 17

def fields
  @fields
end

#idObject (readonly)

Returns the value of attribute id.



17
18
19
# File 'lib/foederati/provider.rb', line 17

def id
  @id
end

#resultsObject (readonly)

Returns the value of attribute results.



17
18
19
# File 'lib/foederati/provider.rb', line 17

def results
  @results
end

#urlsObject (readonly)

Returns the value of attribute urls.



17
18
19
# File 'lib/foederati/provider.rb', line 17

def urls
  @urls
end

Instance Method Details

#search(**params) ⇒ Object

TODO sanity check things like presence of API URL



31
32
33
# File 'lib/foederati/provider.rb', line 31

def search(**params)
  request.execute(params).normalise
end