Class: MailingListsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/mailing_lists_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#robot?

Instance Method Details

#indexObject

GET /mailing_lists GET /mailing_lists.xml


10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/mailing_lists_controller.rb', line 10

def index
  @mailing_lists = []
  GoogleWrapper.retrieve_all_groups.each do |list|
    @mailing_lists << list.email #ie [email protected]
  end

  respond_to do |format|
    format.html
    format.xml { render :xml => @mailing_lists }
  end
end

#showObject

GET /mailing_lists/1 GET /mailing_lists/1.xml


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'app/controllers/mailing_lists_controller.rb', line 25

def show
  @mailing_list = params[:id]

  @mailing_list = switch_sv_to_west(@mailing_list)

  @members = []
  GoogleWrapper.retrieve_all_members(@mailing_list).each do |member|
    @members << member.email
  end

  respond_to do |format|
    format.html # show.html.erb
    format.xml { render :xml => @members }
  end

rescue Google::Apis::ClientError => e
  flash[:error] = 'There was an error'
end