lib/api_client/scope.rb in api_client-0.1.2 vs lib/api_client/scope.rb in api_client-0.1.3
- old
+ new
@@ -27,10 +27,19 @@
@connection = klass.new(@endpoint , @options || {})
@hooks.each { |hook| hook.call(@connection) }
@connection
end
+ def raw
+ @raw = true
+ self
+ end
+
+ def raw?
+ !!@raw
+ end
+
# 3 Pillars of scoping
# options - passed on the the adapter
# params - converted to query or request body
# headers - passed on to the request
def options(new_options = nil)
@@ -61,10 +70,10 @@
end
# Low-level connection methods
def request(method, path, options = {})
- raw = options.delete(:raw)
+ raw = raw? || options.delete(:raw)
params(options)
response = connection.send method, path, @params, @headers
raw ? response : @scopeable.parse(response)
end