Sha256: 2c779b0148e56025fbb223baf294a26d9cd0677ed34cdd6a70ad0becf92236a4

Contents?: true

Size: 610 Bytes

Versions: 9

Compression:

Stored size: 610 Bytes

Contents

class Iro::DatapointsController < Iro::ApplicationController

  ## params: d, k, v
  def create
    authorize! :create, Iro::Datapoint
    begin
      Iro::Datapoint.create!(
        date:  params[:d],
        kind:  params[:k],
        value: params[:v],
      )
      render json: { status: :ok }
    rescue Mongoid::Errors::Validations => e
      render json: { status: 401 }, status: 401
    end
  end

  def index
    authorize! :datapoints_index, Iro
    @symbol = params[:symbol] || params[:q]
    @datapoints = Iro::Datapoint.where( symbol: @symbol ).order_by( quote_at: :desc ).limit(100)
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
iron_warbler-2.0.7.43 app/controllers/iro/datapoints_controller.rb
iron_warbler-2.0.7.42 app/controllers/iro/datapoints_controller.rb
iron_warbler-2.0.7.41 app/controllers/iro/datapoints_controller.rb
iron_warbler-2.0.7.40 app/controllers/iro/datapoints_controller.rb
iron_warbler-2.0.7.39 app/controllers/iro/datapoints_controller.rb
iron_warbler-2.0.7.38 app/controllers/iro/datapoints_controller.rb
iron_warbler-2.0.7.37 app/controllers/iro/datapoints_controller.rb
iron_warbler-2.0.7.36 app/controllers/iro/datapoints_controller.rb
iron_warbler-2.0.7.35 app/controllers/iro/datapoints_controller.rb