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
-
Matt Todd February 7th, 2008 @ 02:08 AM
- State changed from new to open
These changes won't be available until 0.5.0.
-
Matt Todd February 9th, 2008 @ 10:36 PM
- 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.
-
Matt Todd March 7th, 2008 @ 02:07 AM
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.
-
Matt Todd April 14th, 2008 @ 03:21 PM
- Milestone changed from Release 0.5.0 to Release 0.6.0
Moved to 0.6.0.
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.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป