Class: Confluency::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/confluency/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(server_url) ⇒ Client

Returns a new instance of Client.



6
7
8
9
10
11
12
# File 'lib/confluency/client.rb', line 6

def initialize(server_url)
  server_url += "/rpc/xmlrpc" unless server_url[-11..-1] == "/rpc/xmlrpc"
  @server_url = server_url
  server = XMLRPC::Client.new2(server_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



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/confluency/client.rb', line 20

def method_missing(method_name, *args)
  begin
    @conf.send(method_name, *([@token] + args))
  rescue XMLRPC::FaultException => e
    if (e.faultString.include?("InvalidSessionException"))
      
      retry
    else
      raise e.faultString
    end
  end
end

Instance Method Details

#login(username, password) ⇒ Object



14
15
16
17
18
# File 'lib/confluency/client.rb', line 14

def (username, password)
  @user = username
  @pass = password
  ()
end