Class: OxfordDictionary::Client

Inherits:
Object
  • Object
show all
Includes:
Endpoints::EntryEndpoint, Endpoints::InflectionEndpoint, Endpoints::SearchEndpoint, Endpoints::WordlistEndpoint
Defined in:
lib/oxford_dictionary/client.rb

Overview

The client object to interact with

Constant Summary

Constants included from Endpoints::WordlistEndpoint

Endpoints::WordlistEndpoint::ADVANCED_FILTERS, Endpoints::WordlistEndpoint::ENDPOINT

Constants included from Request

Request::ACCEPT_TYPE, Request::ADVANCED_FILTERS, Request::BASE

Constants included from Endpoints::SearchEndpoint

Endpoints::SearchEndpoint::ENDPOINT

Constants included from Endpoints::InflectionEndpoint

Endpoints::InflectionEndpoint::ENDPOINT

Constants included from Endpoints::EntryEndpoint

Endpoints::EntryEndpoint::ENDPOINT

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Endpoints::WordlistEndpoint

#wordlist

Methods included from Request

#advanced_query, #build_advanced_url, #build_url, #create_query_string, #error_message, #finish_url, #hash_element?, #options, #query_from_hash, #request, #request_headers, #search_endpoint_url

Methods included from Endpoints::SearchEndpoint

#search

Methods included from Endpoints::InflectionEndpoint

#inflection

Methods included from Endpoints::EntryEndpoint

#entry, #entry_antonyms, #entry_antonyms_synonyms, #entry_definitions, #entry_examples, #entry_pronunciations, #entry_request, #entry_sentences, #entry_synonyms, #entry_translations

Constructor Details

#initialize(params) ⇒ Client

Returns a new instance of Client.



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

def initialize(params)
  unless params.is_a?(Hash) && params.key?(:app_id) && params.key?(:app_key)
    raise(ArgumentError, 'API id and key required.')
  end
  params.each do |key, value|
    instance_variable_set("@#{key}", value)
  end
end

Instance Attribute Details

#app_idObject (readonly)

Returns the value of attribute app_id.



14
15
16
# File 'lib/oxford_dictionary/client.rb', line 14

def app_id
  @app_id
end

#app_keyObject (readonly)

Returns the value of attribute app_key.



14
15
16
# File 'lib/oxford_dictionary/client.rb', line 14

def app_key
  @app_key
end