Вопрос

I have a Ruby-On-Rails app that I'm trying to hookup to Dwolla using Mechanize

agent = Mechanize.new 
agent.keep_alive = false 
agent.log = Logger.new $stderr 
agent.agent.http.debug_output = $stderr 
ajax_headers = { 'X-Requested-With' => 'XMLHttpRequest', 'Content-Type' => 'application/json; charset=utf-8', 'Accept' => 'application/json, text/javascript, */*'} 
response = agent.post( "https://www.dwolla.com/oauth/rest/tes...", query_string.to_json, ajax_headers) 

The response I get back is:

Conn close because of error Connection reset by peer 

These are the params I'm sending:

{\"password\":\"Password1\",\"confirm_password\":\"Password1\",\"pin\":\"1234\",\"firstName\":\"firstName\",\"lastName\":\"lastName\",\"address\":\"address\",\"address2\":null,\"city\":\"Troy\",\"state\":\"NY\",\"zip\":\"12180\",\"phone\":\"111-123-4567\",\"dateOfBirth\":\"10/15/1970\",\"type\":\"Personal\",\"organization\":null,\"ein\":null,\"acceptTerms\":true,\"client_id\":\"foo\",\"client_secret\":\bar\"}" 

And here's what's logged:

Net::HTTP::Post: /oauth/rest/testapi/register
request-header: accept => application/json, text/javascript, */*
request-header: user-agent => Mechanize/2.5.1 Ruby/1.9.2p290 (http://github.com/tenderlove/mechanize/)
request-header: connection => close
request-header: accept-encoding => gzip,deflate,identity
request-header: accept-charset => ISO-8859-1,utf-8;q=0.7,*;q=0.7
request-header: accept-language => en-us,en;q=0.5
request-header: host => www.dwolla.com
request-header: content-type => application/json; charset=utf-8
request-header: content-length => 444
opening connection to www.dwolla.com...
opened
<- "POST /oauth/rest/testapi/register HTTP/1.1\r\nAccept: application/json, text/javascript, */*\r\nUser-Agent: Mechanize/2.5.1 Ruby/1.9.2p290 (http://github.com/tenderlove/mechanize/)\r\nConnection: close\r\nAccept-Encoding: gzip,deflate,identity\r\nAccept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\nAccept-Language: en-us,en;q=0.5\r\nHost: www.dwolla.com\r\nContent-Type: application/json; charset=utf-8\r\nContent-Length: 444\r\n\r\n"
<- "{\"password\":\"Password1\",\"confirm_password\":\"Password1\",\"pin\":\"1234\",\"firstName\":\"firstName\",\"lastName\":\"lastName\",\"address\":\"address\",\"address2\":null,\"city\":\"Cohoes\",\"state\":\"NY\",\"zip\":\"12047\",\"phone\":\"111-123-4567\",\"dateOfBirth\":\"9/13/1973\",\"type\":\"Personal\",\"organization\":null,\"ein\":null,\"acceptTerms\":true,\"client_id\":\"foo\",\"client_secret\":\"bar\"}"
Conn close because of error Connection reset by peer

Any help would be greatly appreciated!

Это было полезно?

Решение

I believe you're using an old [unsupported] endpoint. Try removing that "/testapi" part from the URL... In anyway, the dev docs for this method also include an inline console that should help you get started with this: https://developers.dwolla.com/dev/docs/register/register

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top