aboutsummaryrefslogtreecommitdiff
blob: e0fd813e45a248af3d9206d88c7612a45e627119 (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
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
    Agenda.process_results JSON.parse(request.env["rack.input"].read)
  end

  def reminders
    render :json => Agenda.irc_reminders
  end

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