#5 open
Matt Todd

Improve Client Integration

Reported by Matt Todd | January 19th, 2008 @ 09:59 PM | in Release 0.6.0

Halcyon Clients integrate awkwardly, particularly for well defined client objects like ORM models like ActiveRecord.

A reasonable and sexy solution to including functionality into objects like ActiveRecord models should be available.

For example, a possible solution could include the following code producing the expected results:

class User < ActiveRecord::Base
  include Halcyon::Client::Integrations('http://localhost:5457')
  def self.authenticate(user,pass)
    instance_eval do
      post("/user/auth/#{user}", 'password'=>pass)
    end
  end
  def permit?(key)
    get("/user/permit/#{key}")
  end
end

This can be tricky for conflicting names of properties in the actual object for clients that provide custom methods (which is highly recommended to begin with).

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket

Pages