Class: Confluence::Conn
- Inherits:
-
Object
- Object
- Confluence::Conn
- Defined in:
- lib/confluence/conn.rb
Instance Method Summary collapse
- #do_connect ⇒ Object
-
#initialize(config) ⇒ Conn
constructor
A new instance of Conn.
- #method_missing(method_name, *args) ⇒ Object
Constructor Details
#initialize(config) ⇒ Conn
Returns a new instance of Conn.
4 5 6 7 8 9 10 |
# File 'lib/confluence/conn.rb', line 4 def initialize(config) @config = config server = XMLRPC::Client.new2(@config[:server_url]) @conn = server.proxy("confluence1") @token = "12345" do_connect() end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/confluence/conn.rb', line 12 def method_missing(method_name, *args) begin @conn.send(method_name, *([@token] + args)) rescue XMLRPC::FaultException => e if (e.faultString.include?("InvalidSessionException")) do_connect retry else raise(e.faultString) end end end |
Instance Method Details
#do_connect ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/confluence/conn.rb', line 25 def do_connect() @token = @conn.login(@config[:username], @config[:password]) rescue XMLRPC::FaultException => e raise(e.faultString) rescue => e Confluence.logger.debug("#{e.class}: #{e.}") raise(e) end |