Ruby confluence4r的例子

我无法找到下载confluence4r gem的位置,但在我这样做时无法正常工作:

gem install confluence4r

我在这里下载了一个:http://confluence.atlassian.com/display/DISC/Confluence4r

我可以登录

server = Confluence::RPC.new("http://wiki/")
server.login("username","password")

但是一旦我做了其他事情就会失败

server.getSpace("key")

但是等等..我第二次这样做,它可以工作...

server.getSpace("key")

{"name"=>"key example", "homePage"=>"235325", "url"=>"http://wiki/display/key", "type"=>"global", "description"=>"description example", "key"=>"key"}

以下是第一次尝试在第二次尝试时收到的错误:

EOFError: end of file reached

从/ usr / lib / ruby​​ /从/usr/lib/ruby/1.8/net/protocol.rb:135:in sysread' from /usr/lib/ruby/1.8/net/protocol.rb:135:in /usr/lib/ruby/1.8/net/protocol.rb:135:in rbuf_fill' 1.8 / timeout.rb:62:来自/usr/lib/ruby/1.8/net/protocol.rb:134:in rbuf_fill' from /usr/lib/ruby/1.8/net/protocol.rb:116:in timeout' from /usr/lib/ruby/1.8/timeout.rb:93:in timeout中的超时rbuf_fill' from /usr/lib/ruby/1.8/net/protocol.rb:116:in readuntil'从readline' from /usr/lib/ruby/1.8/net/http.rb:2024:in读取' readline' from /usr/lib/ruby/1.8/net/http.rb:2024:in read_status_line'from /usr/lib/ruby/1.8/net/http.rb:2013:in read_new' from /usr/lib/ruby/1.8/net/http.rb:1050:in请求'from /usr/lib/ruby/1.8/net/http.rb:992:in post2' from /usr/lib/ruby/1.8/xmlrpc/client.rb:538:in do_rpc'from / usr / lib / ruby​​ / 1.8 / xmlrpc / client.rb:420:在call2' from /usr/lib/ruby/1.8/xmlrpc/client.rb:410:in调用xmlrpc / client.rb:617: send' from /usr/lib/ruby/1.8/xmlrpc/client.rb:617:in method_missing'从/./confluence4r.rb:35:in send' from ./confluence4r.rb:35:in method_missing'

任何想法,为什么我得到错误?

编辑

好的,我正在使用这个宝石的一部分,它可以正常工作:

gem install confluencer
@api = Confluence::Client.new(:url => "http://wiki")
@api.login("username","password")
user = @api.getUser("username")
pp user

{"name"=>"username",
 "url"=>"http://wiki/display/~username",
 "fullname"=>"Full Name",
 "email"=>"EmailAddress@example.com"}

现在的问题是我无法添加任何东西,但我可以做得到,那就是它。 它只是挂起,我相信会一遍又一遍地重试。 也许我的wiki被打破了..

create_user = @api.createUser("username","password","First LastName","Email@example.com")
pp create_user

挂在create_user上


好吧,现在只使用XMLRPC客户端,一切正常

require 'xmlrpc/client'

confluence = XMLRPC::Client.new2("http://wiki/rpc/xmlrpc").proxy("confluence1")
token = confluence.login("username", "password")

user = {
"name" => user_name,
"fullname" => full_name,
"email" => email
}

confluence.addUser(token, user, user_name)

我在2.8到3.4的汇合中测试了这个 - 哇,这太容易了!


仅供参考,Confluence v4使用confluence4r.rb代码失败。 简单的解决方法是更改​​... @conf = server.proxy(“confluence1”)TO @conf = server.proxy(“confluence2”)

错误消息是:confluence.rb:38:in rescue in method_missing': java.lang.Exception: com.atlassian.confluence.rpc.RemoteException: Unsupported operation: Wiki formatted content can no longer be retrieved from this API. Please use the version 2 API. The version 2 WSDL is available at: https://wiki.globalrelay. net/rpc/soap-axis/confluenceservice-v2?wsdl. XML-RPC requests should prefixed with "confluence2.". (RuntimeError) from confluence.rb:31:in rescue in method_missing': java.lang.Exception: com.atlassian.confluence.rpc.RemoteException: Unsupported operation: Wiki formatted content can no longer be retrieved from this API. Please use the version 2 API. The version 2 WSDL is available at: https://wiki.globalrelay. net/rpc/soap-axis/confluenceservice-v2?wsdl. XML-RPC requests should prefixed with "confluence2.". (RuntimeError) from confluence.rb:31:in rescue in method_missing': java.lang.Exception: com.atlassian.confluence.rpc.RemoteException: Unsupported operation: Wiki formatted content can no longer be retrieved from this API. Please use the version 2 API. The version 2 WSDL is available at: https://wiki.globalrelay. net/rpc/soap-axis/confluenceservice-v2?wsdl. XML-RPC requests should prefixed with "confluence2.". (RuntimeError) from confluence.rb:31:in method_missing'

链接地址: http://www.djcxy.com/p/38769.html

上一篇: Ruby confluence4r examples

下一篇: require.rb:55:in `require': cannot load such file error