aboutsummaryrefslogtreecommitdiff
blob: c6865a18100a7fe7c86e91b789cae7fdc15da00c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
class AgendasController < ApplicationController

  hobo_model_controller

  before_filter :authenticate_bot, :only => :results
  auto_actions :all

  def index
    hobo_index Agenda.state_is(:old)
  end

  def current_items
    render :json => Agenda.current.voting_array
  end

  def results
    data = JSON.parse(request.env["rack.input"].read)
    Agenda.process_results data
    Participation.mark_participations data
  end

  def reminders
    render :json => Agenda.irc_reminders
  end

  private
    def authenticate_bot
      botconf = CustomConfig['Bot']
      authenticate_or_request_with_http_basic do |user_name, password|
        user_name == botconf['user'] && password == botconf['password']
      end
    end
end