Sha256: 63c08c69112dcb914f99c7e3e59b324e865e7219d799b5f6991749aac23d51b7
Contents?: true
Size: 870 Bytes
Versions: 1
Compression:
Stored size: 870 Bytes
Contents
module Api module V1 class MeasurementsController < ApplicationController before_action :api_authenticate! skip_before_action :verify_authenticity_token rescue_from ActiveRecord::RecordNotFound do head 404 end rescue_from KeyError do |e| render json: { error: e.message }, status: 422 end def index name = params.fetch :name start_time = params.fetch :start end_time = params.fetch :end measurements = Measurement.named(name).taken_between(start_time, end_time) if slugs = params[:project] slugs = slugs.split(",") if slugs.is_a?(String) projects = Project.where(slug: slugs) measurements = measurements.where(subject: projects) end render json: MeasurementsPresenter.new(measurements) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
houston-core-0.8.0.pre2 | app/controllers/api/v1/measurements_controller.rb |