Class: WhosGotDirt::Requests::List::OpenCorporates
- Inherits:
-
WhosGotDirt::Request
- Object
- WhosGotDirt::Request
- WhosGotDirt::Requests::List::OpenCorporates
- Defined in:
- lib/whos_got_dirt/requests/list/open_corporates.rb
Overview
Requests for corporate groupings from the OpenCorporates API.
OpenCorporates' q
filter performs a prefix search.
Instance Method Summary collapse
-
#convert ⇒ Hash
Converts the MQL parameters to API-specific parameters.
-
#to_s ⇒ String
Returns the URL to request.
Constructor Details
This class inherits a constructor from WhosGotDirt::Request
Instance Method Details
#convert ⇒ Hash
Converts the MQL parameters to API-specific parameters.
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/whos_got_dirt/requests/list/open_corporates.rb', line 24 def convert match('q', 'name') equal('per_page', 'limit', default: input['open_corporates_api_key'] && 100) # default 30, maximum 100 equal('page', 'page') # API-specific parameters. equal('api_token', 'open_corporates_api_key') output end |
#to_s ⇒ String
Returns the URL to request.
16 17 18 |
# File 'lib/whos_got_dirt/requests/list/open_corporates.rb', line 16 def to_s "#{base_url}?#{to_query(convert)}" end |