Sha256: 93602003bd2e7a6ec9f8bf173c653b89f0ebdbb464218795f2cc99b9fd588fc5

Contents?: true

Size: 502 Bytes

Versions: 2

Compression:

Stored size: 502 Bytes

Contents

module ConsolidatedScreeningList
  class Client
    class << self
      def search(options = {})
        Client.new.search(options)
      end
    end

    attr_reader :api_key

    def initialize(options = {})
      @api_key = options[:api_key] || ENV["TRADE_API_KEY"]
    end

    def search(params = {})
      parse_response Query.new(params, api_key).call
    end

    private

    def parse_response(response)
      JSON.parse(response)["results"].map { |data| Result.new(data) }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
consolidated_screening_list-0.0.2 lib/consolidated_screening_list/client.rb
consolidated_screening_list-0.0.1 lib/consolidated_screening_list/client.rb