Class: Confluency::Client
- Inherits:
-
Object
- Object
- Confluency::Client
- Defined in:
- lib/confluency/client.rb
Instance Method Summary collapse
-
#initialize(url) ⇒ Client
constructor
A new instance of Client.
- #login(username, password) ⇒ Object
- #method_missing(method_name, *args) ⇒ Object
Constructor Details
#initialize(url) ⇒ Client
Returns a new instance of Client.
5 6 7 8 9 10 11 |
# File 'lib/confluency/client.rb', line 5 def initialize(url) url += "/rpc/xmlrpc" unless url[-11..-1] == "/rpc/xmlrpc" @url = url server = XMLRPC::Client.new2(url) @conf = server.proxy("confluence2") @token = "12345" end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/confluency/client.rb', line 19 def method_missing(method_name, *args) begin @conf.send(method_name, *([@token] + args)) rescue XMLRPC::FaultException => e if (e.faultString.include?("InvalidSessionException")) do_login retry else raise e.faultString end end end |
Instance Method Details
#login(username, password) ⇒ Object
13 14 15 16 17 |
# File 'lib/confluency/client.rb', line 13 def login(username, password) @user = username @pass = password do_login() end |