Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'ruby-paypal'
- username = 'logylaps_api1.gmail.com'
- password = 'ZEB8HQ7864F7U8NP'
- signature = 'A-e5.pfq.2r5Nckl4TECzF.sZDPMAMD7v48g2MpjJDf56CFbCxQD51nbL'
- paypal = Paypal.new username, password, signature, :production
- # silence annoying output
- class CaptureOutput < IO
- def initialize
- super(2)
- end
- def write(text)
- # send text to logfile
- end
- end
- def silence
- raise unless block_given?
- dout, serr, sout = $defout, $stderr, $stdout
- buf = CaptureOutput.new
- begin
- $defout = buf
- $stderr = buf
- $stdout = buf
- yield
- ensure
- $defout, $stderr, $stdout = dout, serr, sout
- end
- end
- silence do
- paypal = paypal.make_nvp_call 'METHOD' => 'GetBalance'
- end
- if paypal.ack == 'Success'
- puts paypal['L_AMT0']
- end
Add Comment
Please, Sign In to add comment