Created
September 18, 2014 15:49
-
-
Save drochetti/9f30aa3dbc244dc03f04 to your computer and use it in GitHub Desktop.
ruby rest client poc
This file contains 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
module Blowout | |
module Api | |
Client = RC::Builder.client do | |
use RC::DefaultSite, 'http://localhost:7272' | |
use RC::JsonResponse, true | |
use Blowout::Api::HashResponse | |
end | |
end | |
end | |
class Blowout::Api::Client | |
def spiders | |
endpoint = class << Blowout::Api::Spider | |
# def self.resource_name | |
# super | |
# end | |
end | |
puts endpoint | |
puts endpoint.inspect | |
puts endpoint.methods | |
endpoint.set_client self | |
endpoint | |
end | |
end |
The main problem is how to 'inject' different instances of Client as a class variable of each Resource/Model?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The idea would be to use the client like this: