lib/ipinfo/adapter.rb in IPinfo-1.0.1 vs lib/ipinfo/adapter.rb in IPinfo-1.1.0
- old
+ new
@@ -21,10 +21,17 @@
end
req.params['token'] = CGI.escape(token) if token
end
end
+ def post(uri, body, timeout = 2)
+ @conn.post(uri) do |req|
+ req.body = body
+ req.options.timeout = timeout
+ end
+ end
+
private
attr_reader :token
def connection(adapter)
@@ -33,10 +40,10 @@
end
end
def default_headers
headers = {
- 'User-Agent' => 'IPinfoClient/Ruby/1.0',
+ 'User-Agent' => 'IPinfoClient/Ruby/1.1.0',
'Accept' => 'application/json'
}
headers['Authorization'] = "Bearer #{CGI.escape(token)}" if token
headers
end