Using Camping with XMLRPC

I know this group is not for Camping, but I can’t find any good
alternative :slight_smile:

I’m trying to use the xmlrpc library with camping. And to do that I’m
trying to only have to initialize the connection once.

This is my current camping module:

require ‘camping’
require ‘xmlrpc/client’

Camping.goes :Grabbr

def Grabbr.create
@server = XMLRPC::Client.new “localhost”, “/the.rpc”
end

module Grabbr::Controllers
class Index < R ‘/’
def get
@downloads = @server.call “get_list”
render :index
end
end
end

module Grabbr::Views
def layout
html do
body do
self << yield
end
end
end

def index
table do

  for d in @downloads
    tr do
      td @server.call "get_details ${d}"
    end
  end
end

end
end

However it complains that the “server” variable is not availible…

How do I create the “server” object to be globally availible? I have
tried @ and @@ but it still won’t work.

Christian…

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs