Class: ErrorHunter::App

Inherits:
Object
  • Object
show all
Extended by:
Urls
Defined in:
lib/error_hunter.rb

Class Method Summary collapse

Methods included from Urls

urls

Class Method Details

.add_error(**data) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/error_hunter.rb', line 28

def self.add_error(**data)
  begin
    make_call = RestClient.post(self.urls[:add_error],
                      {:app_error =>{
                      :title => data[:title] || 'ErrorTitle',
                      :description => data[:description] || 'Description Here',
                      :severity => data[:severity] || 'Urgent',
                      :log => data[:log] || 'error log empty',
                      :app_name => @_app_name
                  }},
                       headers = {
                            :AuthToken => @_token
                        }
                  )
  JSON.parse(make_call.body)
  rescue RestClient::NotFound => e
     e.message
  rescue RestClient::InternalServerError => e
     e.message
  end
end

.config(**options) ⇒ Object



22
23
24
25
26
# File 'lib/error_hunter.rb', line 22

def self.config(**options)
  @_token = options[:token]
  @_app_name = options[:app_name]
  {token:@_token,app_name: @_app_name}
end