httparty

How can I implement this POST request using HTTParty?

风流意气都作罢 提交于 2019-11-28 23:26:55
I am having difficulty making a POST request to an API endpoint using Ruby's HTTParty library. The API I'm interacting with is the Gittip API and their endpoint requires authentication. I have been able to successfully make an authenticated GET request using HTTParty. You can see in the example code: user = "gratitude_test" api_key = "5962b93a-5bf7-4cb6-ae6f-aa4114c5e4f2" # I have included real credentials since the above is merely a test account. HTTParty.get("https://www.gittip.com/#{user}/tips.json", { :basic_auth => { :username => api_key } }) That request works and returns the following

Passing headers and query params in HTTparty

隐身守侯 提交于 2019-11-28 19:05:57
How to pass query params and headers in post method using HTTparty. I am doing as follows But it throws query = {:method => "neworder", :nonce => 1404996028, :order_type => "buy", :quantity=>1,:rate=>1} headers = {:key=> "87819747209090199871234", :sign=> "0a3888ac7f8e411ad73a0a503c55db70a291rsf34bfb9f9a47147d5200882674f717f6ede475669f3453"} HTTParty.post("https://www.acb.com/api/v2/market/LTC_BTC/", :query => query, :headers => headers ) But it throws the following error. How to handle query string params and headers with HTTparty. /home/user/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/net/http

How do I make HTTParty ignore SSL?

半城伤御伤魂 提交于 2019-11-28 07:55:20
I'm using a local server to test an application, and make requests to that server from my own machine. The test server's SSL is bad, and HTTParty throws errors because of that. From what I read, HTTParty should ignore SSL by default, but when I try to do this: HTTParty.get( "#{ @settings.api_server }#{ url }" ).parsed_response It throws this error: OpenSSL::SSL::SSLError at / SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed How do I make it ignore the SSL? In the latest HTTParty, you can use the verify option to disable SSL verification; HTTParty

How can I implement this POST request using HTTParty?

别等时光非礼了梦想. 提交于 2019-11-27 21:16:12
问题 I am having difficulty making a POST request to an API endpoint using Ruby's HTTParty library. The API I'm interacting with is the Gittip API and their endpoint requires authentication. I have been able to successfully make an authenticated GET request using HTTParty. You can see in the example code: user = "gratitude_test" api_key = "5962b93a-5bf7-4cb6-ae6f-aa4114c5e4f2" # I have included real credentials since the above is merely a test account. HTTParty.get("https://www.gittip.com/#{user}

POST JSON to API using Rails and HTTParty

让人想犯罪 __ 提交于 2019-11-27 06:12:06
I would like for a user within my ruby on rails app to be able to submit a ticket to my external ticket management system, squishlist.com. They have an api and instructions as follows. You need to authenticate and get a token and then submit the ticket with the token. From squishlist. # get the token https://api.squishlist.com/auth/?cfg=testcorp&user_key=privatekey&api_key=TEST-KEY-12345 => {"token": "authtoken", "expires": "2010-06-16 13:31:56"} # and then the ticket with the token https://api.squishlist.com/rest/?cfg=testcorp&token=authtoken&method=squish.issue.submit&prj=demo POST data: {