Class: Kokkai::Client

Inherits:
Object
  • Object
show all
Includes:
ApiMethods
Defined in:
lib/kokkai/client.rb

Instance Method Summary collapse

Methods included from ApiMethods

#speech

Constructor Details

#initializeClient

Returns a new instance of Client.



10
11
# File 'lib/kokkai/client.rb', line 10

def initialize
end

Instance Method Details

#kokkai_connectionObject



22
23
24
25
26
27
28
29
# File 'lib/kokkai/client.rb', line 22

def kokkai_connection
  @kokkai_connection ||= Faraday.new(faraday_options) do |c|
    c.request  :url_encoded
    c.response :xml,  :content_type => /\bxml$/
    c.adapter Faraday.default_adapter
    c.options.params_encoder = ParamsEncoder
  end
end

#send_get(path, params = nil) ⇒ Object



13
14
15
# File 'lib/kokkai/client.rb', line 13

def send_get(path, params = nil)
  send_request(:get, path, params)
end

#send_request(method, path, params = nil) ⇒ Object



17
18
19
20
# File 'lib/kokkai/client.rb', line 17

def send_request(method, path, params = nil)
  response = kokkai_connection.send(method, path, params)
  Kokkai::Response.new(response)
end