Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Improve Client Integration

#5

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).

Reported by Matt Todd · January 19th, 2008 @ 09:59 PM

State: open
Milestone: Release 0.6.0
Assigned to: Matt Todd Matt Todd

Activity

  1. Matt Todd
    Matt Todd
    • State changed from new to open

    These changes won't be available until 0.5.0.

    February 7th, 2008 @ 02:08 AM

  2. Matt Todd
    Matt Todd
    • Milestone changed from Release 0.4.0 to Release 0.5.0

    Use this when referring to how to implement a simple Plugin for Rails:

    http://projects.jkraemer.net/act...

    For instance, this is how it would be invoked:

    class Report < ActiveRecord::Base
      acts_as_halcyon_client 'http://localhost:6467/'
      def status
        halcyon :status, id
      end
      after_create {|o| halcyon :generate_report, o.id }
    end
    

    Or something like that. Should work out some details about having to write halcyon everywhere when your client could be called Axe or FishMonger or ReportManager or whatever.

    February 9th, 2008 @ 10:36 PM

  3. Matt Todd
    Matt Todd

    Some changes to the client design may change how this is done, but this is still a huge necessity.

    One particular change will be the move from Halcyon::Client::Base to just Halcyon::Client.

    March 7th, 2008 @ 02:07 AM

  4. Matt Todd
    Matt Todd
    • Milestone changed from Release 0.5.0 to Release 0.6.0

    Moved to 0.6.0.

    April 14th, 2008 @ 03:21 PM

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.