aboutsummaryrefslogtreecommitdiff
blob: 669f3640455bc5688cf5976aea47ad24a0535eea (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
34
35
36
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.update_voting_options data['agenda']
    Agenda.process_results data data['votes']
    agenda = Agenda.current
    agenda.meeting_log = data['lines']
    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