Class: YandexDictionaryApi::ApiClient

Inherits:
Object
  • Object
show all
Defined in:
lib/yandex_dictionary_api/api_client.rb

Constant Summary collapse

BASE_URI =
"https://dictionary.yandex.net/api/v1/dicservice.json"

Instance Method Summary collapse

Constructor Details

#initialize(api_key) ⇒ ApiClient



9
10
11
12
# File 'lib/yandex_dictionary_api/api_client.rb', line 9

def initialize(api_key)
  @http_client = HTTPClient.new
  @api_key = api_key
end

Instance Method Details

#execute(str_req_type, params_hash) ⇒ Object



14
15
16
17
18
# File 'lib/yandex_dictionary_api/api_client.rb', line 14

def execute(str_req_type, params_hash)
  str_request = BASE_URI + "/#{str_req_type}?"
  params_hash["key"] = @api_key
  self.exec_request_http(str_request, params_hash)
end