Created
November 26, 2012 22:44
-
-
Save mikekelly/4151159 to your computer and use it in GitHub Desktop.
Hactor example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'hactor' | |
class HomeActor | |
include Hactor::Actor | |
def on_200(response) | |
response.follow 'ht:users', actor: UserListActor.new | |
end | |
end | |
class UserListActor | |
include Hactor::Actor | |
def on_200(response) | |
user_links = response.body.links.select { |link| link.rel == 'ht:user' } | |
user_links.each do |link| | |
puts "#{link.title} (#{link.href})" | |
end | |
end | |
end | |
Hactor.start url: 'http://haltalk.herokuapp.com/', actor: HomeActor.new |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@steveklabnik no, I've only looked over it briefly. It's server side though right not client side?