Sha256: 12c2f3e0686e2d4af7162599ee412cc8ecedfa0bc4419a7956eaff384ed22ec9
Contents?: true
Size: 1.21 KB
Versions: 6
Compression:
Stored size: 1.21 KB
Contents
module Restfulie::Client class Dsl def initialize @requests = [] trait :base trait :verb request :base_request request :rescue_exception 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
6 entries across 6 versions & 2 rubygems