Class: Dogapi::V1::SearchService

Inherits:
APIService show all
Defined in:
lib/dogapi/v1/search.rb

Constant Summary collapse

API_VERSION =
'v1'

Instance Attribute Summary

Attributes inherited from APIService

#api_key, #application_key

Instance Method Summary collapse

Methods inherited from APIService

#connect, #handle_redirect, #handle_response, #initialize, #prepare_params, #prepare_request, #request, #should_set_api_and_app_keys_in_params?, #suppress_error_if_silent

Constructor Details

This class inherits a constructor from Dogapi::APIService

Instance Method Details

#search(query) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/dogapi/v1/search.rb', line 12

def search(query)
  # Deprecating search for hosts
  split_query = query.split(':')
  if split_query.length > 1 && split_query[0] == 'hosts'
    warn '[DEPRECATION] Dogapi::V1::SearchService::search has been '\
      'deprecated for hosts in favor of Dogapi::V1::HostsService::search'
  end

  extra_params = {
    :q => query
  }

  request(Net::HTTP::Get, "/api/#{API_VERSION}/search", extra_params, nil, false)
end