Created
April 6, 2013 20:59
-
-
Save keikubo/5327601 to your computer and use it in GitHub Desktop.
Ruby1.8.5でWebPayのRest APIを使う例。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'net/https' | |
require 'uri' | |
require 'rubygems' | |
require 'json' | |
url = URI.parse('https://api.webpay.jp/v1/charges/ch_WO14ib0ANJiSHn') | |
req = Net::HTTP::Get.new(url.path) | |
req.basic_auth 'vtUQeOtUnYr7PGCLQ96Ul4zqpDUO4sOE', '' | |
https = Net::HTTP.new(url.host, url.port) | |
https.use_ssl = true | |
https.start do |h| | |
res = h.request(req) | |
obj = JSON.parse(res.body) | |
puts obj['id'] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment