Class: Server
- Inherits:
-
Object
- Object
- Server
- Defined in:
- lib/model/server.rb
Class Method Summary collapse
Class Method Details
.open_session(key) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/model/server.rb', line 5 def self.open_session(key) server = XMLRPC::Client.new( "snipplr.com", "/xml-rpc.php") puts "#{} not valid API Key" and return if server.call("user.checkkey", key)==NOTVALID begin yield server rescue XMLRPC::FaultException => err if err.faultString =~ /No snippets found/ puts "No snippets yet!" else puts "Error: " + err.faultCode.to_s + ", " + err.faultString end end end |