Class: SupplejackApi::RequestLimitMailer

Inherits:
ActionMailer::Base
  • Object
show all
Defined in:
app/mailers/supplejack_api/request_limit_mailer.rb

Instance Method Summary collapse

Instance Method Details

#at100percent(user) ⇒ Object


20
21
22
23
24
25
# File 'app/mailers/supplejack_api/request_limit_mailer.rb', line 20

def at100percent(user)
  @limit = user.max_requests

  mail(to: [user.email].join(', '),
       subject: 'Your API key exceeded its daily limit')
end

#at100percent_admin(user) ⇒ Object


35
36
37
38
39
40
41
# File 'app/mailers/supplejack_api/request_limit_mailer.rb', line 35

def at100percent_admin(user)
  @limit = user.max_requests
  @email = user.email

  mail(to: ENV['REQUEST_LIMIT_MAILER'],
       subject: 'A API key exceeded its daily limit')
end

#at90percent(user) ⇒ Object


13
14
15
16
17
18
# File 'app/mailers/supplejack_api/request_limit_mailer.rb', line 13

def at90percent(user)
  @limit = user.max_requests

  mail(to: [user.email].join(', '),
       subject: 'Your API key has exceeded 90% of its daily limit')
end

#at90percent_admin(user) ⇒ Object


27
28
29
30
31
32
33
# File 'app/mailers/supplejack_api/request_limit_mailer.rb', line 27

def at90percent_admin(user)
  @limit = user.max_requests
  @email = user.email

  mail(to: ENV['REQUEST_LIMIT_MAILER'],
       subject: 'A API key has exceeded 90% of its daily limit')
end