我有以下废墟,试图以同样的方式实施:<条码>。
curl -X POST
-H "X-Parse-Application-Id: $APP_ID"
-H "X-Parse-REST-API-Key: $KEY"
-H "Content-Type: application/json"
-d {"score": 1337, "playerName": "Sean Plott", "cheatMode": false }
https://api.parse.com/1/classes/GameScore
这里的废墟法典:
def execute_post
puts "executing post script.."
payload ={
"score" => "1337",
"playerName" => "Sean Plott",
"cheatMode" => "false"
}.to_json
headers = {
X-Parse-Application-Id => $APP_ID,
X-Parse-REST-API-KEY => $KEY,
Content-Type => application/json
}
url = "https://" + $DOMAIN + $BASE_URL + $LIST_CLASS
uri = URI.parse(url)
puts uri
puts payload
puts "***************"
req = Net::HTTP::Post.new(uri.host, initheader = headers)
req.body = payload
response = Net::HTTP.new(uri.host, uri.port).start{|http| http.request(req)}
puts "Response #{response.code} #{response.message}: #{response.body}"
end
出于某种原因,我错了。 任何关于什么错误的想法?
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/protocol.rb:135:in `sysread : end of file reached (EOFError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/protocol.rb:135:in `rbuf_fill
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/timeout.rb:62:in `timeout
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/timeout.rb:93:in `timeout
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/protocol.rb:134:in `rbuf_fill
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/protocol.rb:116:in `readuntil
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/protocol.rb:126:in `readline
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb:2024:in `read_status_line
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb:2013:in `read_new
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb:1050:in `request
from parse_connect.rb:33:in `execute_post
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb:543:in `start
from parse_connect.rb:33:in `execute_post
from parse_connect.rb:42