Sha256: b20cf51d32dc2bfbea82ac5f1368127ee57876517ef94961223dcb0ba1b216a1
Contents?: true
Size: 1.18 KB
Versions: 2
Compression:
Stored size: 1.18 KB
Contents
module Restfulie::Client class Dsl def initialize @requests = [] trait :base trait :verb request :base_request request :setup_header request :serialize_body request :enhance_response # request :cache request :follow_request end def request(what, *args) req = "Restfulie::Client::Feature::#{what.to_s.classify}".constantize @requests << {:type => req, :args => args} self end def trait(sym) t = "Restfulie::Client::Feature::#{sym.to_s.classify}".constantize self.extend t self end def method_missing(sym, *args) if Restfulie::Client::Feature.const_defined? sym.to_s.classify loaded = true trait sym end if Restfulie::Client::Feature.const_defined? "#{sym.to_s.classify}Request" loaded = true request "#{sym.to_s}Request", *args end if loaded self else super sym, *args end end def request_flow(env = {}) Restfulie::Common::Logger.logger.debug "ready to execute request using stack #{@requests}" StackNavigator.new(@requests).continue(self, env) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
restfulie-1.0.0.beta5 | lib/restfulie/client/dsl.rb |
restfulie-1.0.0.beta4 | lib/restfulie/client/dsl.rb |