class NDB::Search
Constants
- PERMITTED_PARAMS
Public Class Methods
base_uri()
click to toggle source
# File lib/ndb/search.rb, line 15 def self.base_uri NDB.base_uri + "/search" end
default_options()
click to toggle source
# File lib/ndb/search.rb, line 19 def self.default_options { q: "", fg: "", sort: "r", max: 50, offset: 0, format: "JSON", api_key: NDB.api_key } end
perform(options = {})
click to toggle source
# File lib/ndb/search.rb, line 8 def self.perform(options = {}) sanitized_options = NDB.sanitize_options(options, PERMITTED_PARAMS) params = NDB.params_from_hash(default_options.merge(sanitized_options)) response = Faraday.get("#{base_uri}?#{params}") JSON.parse(response.body) end