Class: Notificate::Notice

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/notificate/notice.rb

Instance Method Summary collapse

Constructor Details

#initialize(message, message_type) ⇒ Notice

Returns a new instance of Notice.



4
5
6
7
8
9
10
11
12
13
# File 'lib/notificate/notice.rb', line 4

def initialize(message, message_type)
  @defaults = { headers: { 'Content-Type' => 'application/json'} }

  case message_type
  when :application
    app_notice(message)
  when :exception
    exception_notice(message)
  end
end

Instance Method Details

#app_notice(payload) ⇒ Object



15
16
17
# File 'lib/notificate/notice.rb', line 15

def app_notice(payload)
  self.class.post(Notificate.request_path, payload.merge(@defaults))
end

#exception_notice(payload) ⇒ Object



19
20
21
# File 'lib/notificate/notice.rb', line 19

def exception_notice(payload)
  self.class.post(Notificate.request_path, payload.merge(@defaults))
end