Class: GdsApi::FinderApi

Inherits:
Base
  • Object
show all
Defined in:
lib/gds_api/finder_api.rb

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from Base

#client, #create_client, #get_list!, #url_for_slug

Constructor Details

#initialize(url, options = {}) ⇒ FinderApi

Returns a new instance of FinderApi.



6
7
8
9
# File 'lib/gds_api/finder_api.rb', line 6

def initialize(url, options = {})
  @schema_factory = options.fetch(:schema_factory) { FinderSchema.method(:new) }
  super
end

Instance Method Details

#get_documents(finder_slug, options = {}) ⇒ Object



11
12
13
# File 'lib/gds_api/finder_api.rb', line 11

def get_documents(finder_slug, options = {})
  get_json(documents_url(finder_slug, options))
end

#get_schema(finder_slug, options = {}) ⇒ Object



15
16
17
18
19
# File 'lib/gds_api/finder_api.rb', line 15

def get_schema(finder_slug, options = {})
  @schema_factory.call(
    get_json(finder_url(finder_slug, 'schema', options)).to_hash
  )
end