lib/rubytter.rb in jugyo-rubytter-0.3.4 vs lib/rubytter.rb in jugyo-rubytter-0.3.5
- old
+ new
@@ -80,21 +80,21 @@
send_direct_message(params.merge({:user => user, :text => text}))
end
def get(path, params = {})
path += '.json'
- param_str = '?' + params.to_a.map{|i| i[0].to_s + '=' + CGI.escape(i[1]) }.join('&')
+ param_str = '?' + params.to_a.map{|i| i[0].to_s + '=' + CGI.escape(i[1].to_s) }.join('&')
path = path + param_str unless param_str.empty?
req = prepare_request(Net::HTTP::Get.new(path))
res_body = @connection.start(@host) do |http|
http.request(req).body
end
json_to_struct(JSON.parse(res_body))
end
def post(path, params = {})
path += '.json'
- param_str = params.to_a.map{|i| i[0].to_s + '=' + CGI.escape(i[1]) }.join('&')
+ param_str = params.to_a.map{|i| i[0].to_s + '=' + CGI.escape(i[1].to_s) }.join('&')
req = prepare_request(Net::HTTP::Post.new(path))
res_body = @connection.start(@host) do |http|
http.request(req, param_str).body
end
json_to_struct(JSON.parse(res_body))