Class: OxfordDictionary::Endpoints::Search
- Defined in:
- lib/oxford_dictionary/endpoints/search.rb
Overview
Interface for the /search endpoint
API documentation can be found here: developer.oxforddictionaries.com/documentation
Constant Summary collapse
- ENDPOINT =
'search'.freeze
Instance Method Summary collapse
- #search(language:, params: {}) ⇒ Object
- #search_translation(source_language:, target_language:, params: {}) ⇒ Object
Methods inherited from Endpoint
Constructor Details
This class inherits a constructor from OxfordDictionary::Endpoints::Endpoint
Instance Method Details
#search(language:, params: {}) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/oxford_dictionary/endpoints/search.rb', line 12 def search(language:, params: {}) path = "#{ENDPOINT}/#{language}" uri = request_uri(path: path, params: params) response = @request_client.get(uri: uri) deserialize.call(response.body) end |
#search_translation(source_language:, target_language:, params: {}) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/oxford_dictionary/endpoints/search.rb', line 20 def search_translation(source_language:, target_language:, params: {}) path = "#{ENDPOINT}/translations/#{source_language}/#{target_language}" uri = request_uri(path: path, params: params) response = @request_client.get(uri: uri) deserialize.call(response.body) end |