class Foederati::Provider
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
Constants
- DefaultParams
- Fields
- Results
- Urls
TODO validate the type of values added to these
Attributes
default_params[R]
fields[R]
id[R]
name[W]
results[R]
urls[R]
Public Class Methods
new(id, &block)
click to toggle source
# File lib/foederati/provider.rb, line 21 def initialize(id, &block) @id = id @urls = Urls.new @default_params = DefaultParams.new @results = Results.new @fields = Fields.new instance_eval(&block) if block_given? self end
Public Instance Methods
name()
click to toggle source
# File lib/foederati/provider.rb, line 33 def name @name || id.to_s.titleize end
search(**params)
click to toggle source
TODO sanity check things like presence of API URL
# File lib/foederati/provider.rb, line 38 def search(**params) request.execute(params).normalise end
Protected Instance Methods
request()
click to toggle source
# File lib/foederati/provider.rb, line 44 def request Request.new(self) end