Sha256: bb3fc966879481a9147d6de1be2d00e9e89ead5f34647766e39c160d7f95b83a
Contents?: true
Size: 817 Bytes
Versions: 1
Compression:
Stored size: 817 Bytes
Contents
# frozen_string_literal: true module OpenFdaApi # Base class for all endpoints to share behavior like building queries and making requests class Endpoint attr_reader :client def initialize(client) @client = client end def build_query(query_input, valid_search_fields) QueryBuilder.new(query_input: query_input, valid_search_fields: valid_search_fields).build_query end def build_inputs(search:, sort:, count:, skip:, limit:) QueryInputs.new(search: search, sort: sort, count: count, skip: skip, limit: limit, api_key: client.api_key) end def make_request(endpoint, query) url = "#{endpoint_path}/#{endpoint}" if query.empty? client.connection.get(url) else client.connection.get(url, query) end.body end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
open_fda_api-0.0.13 | lib/open_fda_api/endpoint.rb |