lib/chatwork/client.rb in chatwork-0.0.2 vs lib/chatwork/client.rb in chatwork-0.0.3
- old
+ new
@@ -4,14 +4,14 @@
module ChatWork
class Client
def initialize(api_key, api_base, api_version)
default_header = {
'X-ChatWorkToken' => api_key,
- 'User-Agent' => 'ChatWork#{api_version} RubyBinding/#{ChatWork::VERSION}'
+ 'User-Agent' => "ChatWork#{api_version} RubyBinding/#{ChatWork::VERSION}"
}
- @conn = Faraday.new(api_base, headers: default_header) do |builder|
+ @conn = Faraday.new("#{api_base}#{api_version}", headers: default_header) do |builder|
builder.request :url_encoded
builder.adapter Faraday.default_adapter
end
@api_version = api_version
end
@@ -23,10 +23,10 @@
JSON.parse(response.body)
rescue JSON::ParserError => e
raise ChatWork::APIConnectionError.new("Response JSON is broken. #{e.message}: #{response.body}")
end
else
- ChatWork::ChatWorkError.from_response(response.status, rensponse.body)
+ ChatWork::ChatWorkError.from_response(response.status, response.body)
end
end
Faraday::Connection::METHODS.each do |method|
define_method(method) do |url, *args|