Skip to content

Instantly share code, notes, and snippets.

@mattn mattn/file1.txt
Created Dec 20, 2012

What would you like to do?
We love mruby!
mruby is awesome!

This comment has been minimized.

Copy link
Owner Author

commented Dec 20, 2012

mruby-curl mruby-http mruby-json 使ってこんな感じでポストしました。


if ARGV.size != 1
  raise "gist.rb [GIST_TOKEN]"

req =
req.method = "POST"
req.body = JSON::stringify({
  "description"=> "We love mruby!",
  "public"=> true,
  "files"=> {
    "file1.txt"=> {
      "content"=> "mruby is awesome!"
req.headers['Authorization'] = "token #{ARGV[0]}"
req.headers['Content-Type'] = "application/json"
res = Curl::send("", req)
puts JSON::parse(res.body)['html_url']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.