Class: Taksi::DataController

Inherits:
ApplicationController show all
Defined in:
app/controllers/taksi/data_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



5
6
7
8
9
10
11
12
13
14
# File 'app/controllers/taksi/data_controller.rb', line 5

def index
  return head(404) unless params[:interface_id].match?(::Taksi::Registry::NAME_REGEX)

  interface = ::Taksi::Interface.find(params[:interface_id].to_sym,
                                      request.env['X_TAKSI_VERSION']).new(params: parameters)

  render json: {interface_data: interface.data.as_json}
rescue Taksi::Registry::InterfaceNotFoundError
  head(404)
end