lib/hyperdrive/endpoint.rb in hyperdrive-0.0.16 vs lib/hyperdrive/endpoint.rb in hyperdrive-0.0.17
- old
+ new
@@ -29,11 +29,11 @@
def self.xml?
media_type =~ /xml$/ ? true : false
end
def self.requested_version
- regex = /.*\/vnd.#{hyperdrive.config[:vendor]}\..*\.(.*)\+.*$/
+ regex = /.*\/vnd.#{hyperdrive.config[:vendor]}\..*\.(.*?)\+.*$/
regex.match(media_type) { |version| version.captures.first } or resource.latest_version(env['REQUEST_METHOD'])
end
def self.page
env['hyperdrive.page']
@@ -67,11 +67,11 @@
def self.instrument(*args)
hyperdrive.instrument(*args)
end
def self.before_response
- if @resource.has_callback?(:before, env['REQUEST_METHOD'], requested_version)
- instance_eval(&@resource.callback(:before, env['REQUEST_METHOD'], requested_version))
+ if resource.has_callback?(:before, env['REQUEST_METHOD'], requested_version)
+ instance_eval(&resource.callback(:before, env['REQUEST_METHOD'], requested_version))
end
end
def self.status
case env['REQUEST_METHOD']