Module: OxfordDictionary::DeprecatedRequest

Included in:
Endpoints::EntryEndpoint, Endpoints::InflectionEndpoint, Endpoints::SearchEndpoint, Endpoints::WordlistEndpoint
Defined in:
lib/oxford_dictionary/deprecated_request.rb

Overview

Handles all of the actual API calls

Constant Summary collapse

BASE =
'https://od-api.oxforddictionaries.com/api/v1'.freeze
HTTP_OK =
'200'.freeze
ACCEPT_TYPE =
'application/json'.freeze
ADVANCED_FILTERS =

May be used by the wordlist endpoint

[:exact, :exclude, :exclude_senses,
:exclude_prime_senses, :limit, :offset,
:prefix, :word_length].freeze

Instance Method Summary collapse

Instance Method Details

#request(endpoint, q, params) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/oxford_dictionary/deprecated_request.rb', line 17

def request(endpoint, q, params)
  url = URI(build_url(endpoint, q, params))
  response = Net::HTTP.start(url.host, url.port, use_ssl: true) do |http|
    request = build_get_request(url)
    http.request(request)
  end
  parse_body_or_raise(response)
end