Module: Responders::ApiResponder

Defined in:
lib/responders/api_responder.rb

Instance Method Summary collapse

Instance Method Details

#api_optionsObject



7
8
9
# File 'lib/responders/api_responder.rb', line 7

def api_options
  { :api_version => api_version }
end

#api_versionObject



11
12
13
14
# File 'lib/responders/api_responder.rb', line 11

def api_version
  return controller.api_version if controller.respond_to? :api_version
  detect_api_version
end

#detect_api_versionObject



16
17
18
19
# File 'lib/responders/api_responder.rb', line 16

def detect_api_version
  return $1.to_i if request.path =~ /^\/api\/v(\d+)\//
  nil
end

#optionsObject



3
4
5
# File 'lib/responders/api_responder.rb', line 3

def options
  super.merge(api_options)
end