Permalink
Browse files

Support ability to post hashes.

This converts it to standard urlencoded encoding.
  • Loading branch information...
1 parent 9b0ec84 commit bced752b9ff20face0b2ec5e349ca87c4dbfd51a @libc committed Mar 19, 2013
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/viadeo/api/query_methods.rb
@@ -38,6 +38,11 @@ def simple_post_query(access_token, path, args, post_data = "")
connection = Net::HTTP.new(uri.host, 443)
connection.use_ssl = true
connection.verify_mode = OpenSSL::SSL::VERIFY_NONE
+
+ if !post_data.respond_to?(:bytesize) && post_data.respond_to?(:map)
+ post_data = post_data.map { |k, v| "#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}" }.join('&')
+ end
+
resp = connection.request_post(uri.path + '?' + uri.query, post_data)
puts "Viadeo :: resp=#{resp.inspect}"

0 comments on commit bced752

Please sign in to comment.