class EmailsController

Public Instance Methods

archive() click to toggle source

POST /admin/mastiff_email/archive

# File lib/generators/mastiff/views/templates/emails_controller.rb, line 76
def archive
  #TODO: figure out how to get DataTables to send a JSON array
  tableData = params["tableData"]
  tableData_a = tableData.split ","
  ids = Mastiff::Email.archive(tableData_a)

  respond_to do |format|
     format.json{
       render :json => ids
     }
  end
end
handle_mail() click to toggle source

POST /admin/mastiff_email/archive

# File lib/generators/mastiff/views/templates/emails_controller.rb, line 90
def handle_mail
  #TODO: figure out how to get DataTables to send a JSON array
  tableData = params["tableData"]
  tableData_a = tableData.split ","
  ids = Mastiff::Email.handle_mail(tableData_a)

  respond_to do |format|
     format.json{
       render :json => ids
     }
  end
end
index() click to toggle source

GET /admin/mastiff_emails GET /admin/mastiff_emails.json

# File lib/generators/mastiff/views/templates/emails_controller.rb, line 6
def index
  respond_to do |format|
     format.html{}
  end
end
list() click to toggle source
# File lib/generators/mastiff/views/templates/emails_controller.rb, line 11
def list
  @emails = Mastiff::Email.headers
  @emails.each{|m| m["DT_RowId"] = m[:id]}
  Rails.logger.info @emails.map{|m| "#{m[:id]}, #{m[:attachment_size]}"}
  render :json => {aaData: @emails}
  #    render :json => {aaData: @emails.map{|email| [
  #    email[:id],
  #    email[:date], email[:subject], email[:sender_email],
  #    email[:attachment_name], email[:attachment_size].to_s
  #]}}
end
message_ids() click to toggle source
# File lib/generators/mastiff/views/templates/emails_controller.rb, line 22
def message_ids
  respond_to do |format|
      format.json{
        @msg_ids = Mastiff::Email.msg_ids
        render :json => @msg_ids
      }
  end
end
process_inbox() click to toggle source
# File lib/generators/mastiff/views/templates/emails_controller.rb, line 53
def process_inbox
  message_ids = Mastiff::Email.process_inbox
  respond_to do |format|
     format.json{
       render :json => message_ids
     }
  end
end
reload() click to toggle source

GETS masquerading as POSTS

# File lib/generators/mastiff/views/templates/emails_controller.rb, line 37
def reload
  message_ids = Mastiff::Email.sync_messages
  respond_to do |format|
     format.json{
       render :json => message_ids
     }
  end
end
remove() click to toggle source
# File lib/generators/mastiff/views/templates/emails_controller.rb, line 63
def remove
  #TODO: figure out how to get DataTables to send a JSON array
  tableData = params["tableData"]
  tableData_a = tableData.split ","
  ids = Mastiff::Email.remove(tableData_a)
  respond_to do |format|
     format.json{
       render :json => ids
     }
  end
end
reset() click to toggle source
# File lib/generators/mastiff/views/templates/emails_controller.rb, line 45
def reset
  message_ids = Mastiff::Email.sync_all
  respond_to do |format|
     format.json{
       render :json => message_ids
     }
  end
end