lib/hyperdrive/endpoint.rb in hyperdrive-0.0.6 vs lib/hyperdrive/endpoint.rb in hyperdrive-0.0.7
- old
+ new
@@ -28,13 +28,25 @@
def self.xml?
media_type =~ /xml$/
end
+ def self.page
+ env['hyperdrive.page']
+ end
+
+ def self.per_page
+ env['hyperdrive.per_page']
+ end
+
def self.render(body)
case body
when Array, Hash
- Oj.dump(body, mode: :compat) if json?
+ if json?
+ MultiJson.dump(body)
+ else
+ $stderr.puts "can't serialize response automatically"
+ end
when String
body
else
body.to_s
end