1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

RubyからのParse繋ぎこみサンプル

Posted at

さーっと調べて、具体例としてgemを使わずにParseに接続しているサンプルコードが見当たらなかったのでメモ。

require 'net/http'
require 'uri'

location = URI.parse('https://api.parse.com/1/classes/Xxxxxxx')
https = Net::HTTP.new(location.host, location.port)
https.use_ssl = true

req = Net::HTTP::Post.new(location.request_uri)
req['X-Parse-Application-Id'] = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
req['X-Parse-REST-API-Key'] = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
req['Content-Type'] = 'application/json'

data = {
  content: 'test'
}.to_json
req.body = data

res = https.request(req)

puts "code -> #{res.code}"
puts "msg -> #{res.message}"
puts "body -> #{res.body}"
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?