make use of ruby client sample code.

Discussion and information for XML-RPC interface.

Moderators: Amaradana, TurboPT, TL Developers

make use of ruby client sample code.

Postby srikanth » Tue Jun 30, 2009 7:05 am

Hi All,
I have implemente a web application using 'ruby on rails' used to upload,download and search the streams.I have used mysql as my database in windows environment.

Now i want to implement my own APIs for client to search,upload and down load the streams from any other place using these APIs.To implement this feature i found TESTLink API is suitable.

And as i am very new to use of test linK,I need help .
So far i have just copid the sample code given in testlink site and modified somehow like below.
-----------------------------
#!/usr/bin/env ruby

# Testlink API Sample Ruby Client implementation
require 'xmlrpc/client'

class TestlinkAPIClient
# substitute your server URL Here
SERVER_URL = "http://smruti.india.ti.com"

def initialize(dev_key)
@server = XMLRPC::Client.new2(SERVER_URL)
@devKey = dev_key
end

def reportTCResult(tcid, status)
args = {"devKey"=>@devKey, "tcid"=>tcid, "status"=>status}
@server.call("tl.reportTCResult", args)
end
end

# substitute your Dev Key Here
client = TestlinkAPIClient.new("f2a979d533cdd9761434bba60a88e4d8")
# Substitute for tcid and tpid that apply to your project
result = client.reportTCResult(4584, "f")
# Typically you'd want to validate the result here and probably do something more useful with it
puts "result was: %s" %(result)
---------------------------------------------------------------------
In the above code i am not clear about what is dev_key and initialize method.

With the aboe code i f run the above code getting error like:
--------------
C:/Ruby/lib/ruby/1.8/xmlrpc/client.rb:549:in `do_rpc': HTTP-Error: 404 Not Found
(RuntimeError)
from C:/Ruby/lib/ruby/1.8/xmlrpc/client.rb:420:in `call2'
from C:/Ruby/lib/ruby/1.8/xmlrpc/client.rb:410:in `call'
from testapi.rb:17:in `reportTCResult'
from testapi.rb:24
-----------------------------------
Can any one suggest how exactly the code is linking with the server and what are all modifications do i need to do in my code.

Thanks All
Srikanth
srikanth
TestLink user
 
Posts: 2
Joined: Tue Jun 30, 2009 6:54 am

Return to XML-RPC API



Who is online

Users browsing this forum: Google [Bot] and 1 guest