Class: FirstGiving::Search

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/firstgiving/search.rb

Defined Under Namespace

Modules: Actions

Constant Summary

Constants included from Base

Base::DONATION_PRODUCTION_ENDPOINT, Base::DONATION_SANDBOX_ENDPOINT, Base::SEARCH_ENDPOINT

Instance Method Summary collapse

Methods included from Base

#headers_json, #headers_security, #logging

Constructor Details

#initializeSearch

Returns a new instance of Search.



13
14
15
# File 'lib/firstgiving/search.rb', line 13

def initialize
  @api_endpoint = SEARCH_ENDPOINT
end

Instance Method Details

#headersObject



17
18
19
# File 'lib/firstgiving/search.rb', line 17

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

#parse(body) ⇒ Object



26
27
28
29
# File 'lib/firstgiving/search.rb', line 26

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

#query(params) ⇒ Object



21
22
23
24
# File 'lib/firstgiving/search.rb', line 21

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