Class: FirstGiving::Search
- Inherits:
-
Object
- Object
- FirstGiving::Search
- 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
- #headers ⇒ Object
-
#initialize ⇒ Search
constructor
A new instance of Search.
- #parse(body) ⇒ Object
- #query(params) ⇒ Object
Methods included from Base
#headers_json, #headers_security, #logging
Constructor Details
#initialize ⇒ Search
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
#headers ⇒ Object
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 |