Class: WhosGotDirt::Requests::Entity::LittleSis
- Inherits:
-
WhosGotDirt::Request
- Object
- WhosGotDirt::Request
- WhosGotDirt::Requests::Entity::LittleSis
- Defined in:
- lib/whos_got_dirt/requests/entity/little_sis.rb
Overview
Requests for entities from the LittleSis API.
Tokens less than two characters long will be ignored by LittleSis' q
filter. The q
parameter matches names and aliases. If search_all
is
1
, it also matches descriptions and summaries.
Instance Method Summary collapse
-
#convert ⇒ Hash
Converts the MQL parameters to API-specific parameters.
-
#or_operator ⇒ String
Returns the "OR" operator's serialization.
-
#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.
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/whos_got_dirt/requests/entity/little_sis.rb', line 38 def convert match('q', 'name') one_of('type_ids', 'classification') equal('num', 'limit') # default 20, maximum 1000? equal('page', 'page') # API-specific parameters. equal('_key', 'little_sis_api_key') equal('search_all', 'search_all', valid: [1]) output end |
#or_operator ⇒ String
Returns the "OR" operator's serialization.
29 30 31 |
# File 'lib/whos_got_dirt/requests/entity/little_sis.rb', line 29 def or_operator ',' end |
#to_s ⇒ String
Returns the URL to request.
22 23 24 |
# File 'lib/whos_got_dirt/requests/entity/little_sis.rb', line 22 def to_s "#{base_url}?#{to_query(convert)}" end |