About

NetworkFacade is an alternative to DRb, XML/RPC and other REST api, all in one !

Simple client example


# Declare the Foo class with default port and host (localhost and 5042)
class Foo < NetworkFacade::Client
end

# Or declate the Foo class and set an uri
class Foo < NetworkFacade::Client 'nf://localhost:5042'
end

# Do a remote cal
f = Foo.new
puts f.bar
		

Simple server example


# The server class
class Foo
  def bar
    42
  end
end

# Create the server
server = NetworkFacade::Server.new

# Add an object
server << Foo.new

# Start the server
server.start
		

Simple Digg client


class Digg < NetworkFacade::REST::Client 'http://services.digg.com'
  mapping :apple_stories, '/stories/topic/apple'
  mapping :me, '/user/pyros'
end

d = Digg.new
puts d.apple_stories(:appkey => 'http://network-facade.rubyforge.org',
                  :count => 3, :type => :json)
puts d.me(:appkey => 'http://network-facade.rubyforge.org')
		

Links

News

Copyright (C) 2007 Florent Solt