Sha256: 78136987c1e6d9cd86552e097e3ab4bfff0cb474770b33d64a7b11c27a496c8d

Contents?: true

Size: 534 Bytes

Versions: 2

Compression:

Stored size: 534 Bytes

Contents

require 'json'

# Search API

module FirstGiving
  class Search
    include Base

    module Actions
      LIST_ORGANIZATION = '/v1/list/organization'
    end

    def initialize
      @api_endpoint = SEARCH_ENDPOINT
    end

    def headers
      { 'Accept' => 'application/json' }
    end

    def query(params)
      response = get_call(@api_endpoint, Actions::LIST_ORGANIZATION, params, headers)
      parse(response.body)
    end

    def parse(body)
      response = JSON.parse(body)
      response['payload']
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
firstgiving-1.0.2 lib/firstgiving/search.rb
firstgiving-1.0.1 lib/firstgiving/search.rb