1
1

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.

ideone APIをrubyで叩いてみる

Last updated at Posted at 2016-11-12

##ideoneとは
ideone(アイディーイーワン)
http://ideone.com/

ブラウザ上で多種のプログラムを実行してくれるサイト
エラー表示は親切ではない

##やったこと

###ideoneとSphere engineの会員登録
ideone
http://ideone.com/

Sphere engine
http://sphere-engine.com/

###ideone-ruby-api gemのインストール
https://rubygems.org/gems/ideone-ruby-api/versions/2.1.2
にあるideone-ruby-api gemをインストール

$ rbenv rehash
$ gem install ideone-ruby-api
$ bundle install

###コーディング
ソースコードとその出力結果を出力するプログラムを作成した

ruby
require 'ideone'

i = Ideone.new('username', 'password')

source_code = <<EOD
a = 10
b = 100
p a*b
EOD

token = i.create_submission(source_code,17) #17はrubyの意味
p i.submission_details(token)["source"]
p i.submission_details(token)["output"]

上記の出力結果

"a = 10\nb = 100\np a*b\n"
"1000\n"

##その他
ideone api リファレンス
http://ideone.com/files/ideone-api.pdf

ideone-ruby-api github
https://github.com/kennym/ideone-ruby-api

1
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?