Sha256: efeef9cdda3e651c8b157a82cd23131f38cfde7481eb24530ba364a69cfe72df
Contents?: true
Size: 1.32 KB
Versions: 2
Compression:
Stored size: 1.32 KB
Contents
require "error_hunter/version" require 'rest-client' require 'json' module ErrorHunter class Error < StandardError; end # Your code goes here... module Urls def urls production = "https://errorhunter.herokuapp.com" development = 'https://localhost:3000' @_host = production @add_errors = @_host + '/api/app_errors' {add_error: @add_errors} end end class App extend Urls @_token = nil @_app_name = 'app_name' def self.config(**options) @_token = options[:token] @_app_name = options[:app_name] {token:@_token,app_name: @_app_name} end 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', :serverity => data[:serverity] || 'Urgent', :log => data[:log] || 'error log empty', :app_name => @_app_name } ) JSON.parse(make_call.body) rescue RestClient::NotFound => e e.message rescue RestClient::InternalServerError => e e.message end end # private end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
error_hunter-0.1.1 | lib/error_hunter.rb |
error_hunter-0.1.0 | lib/error_hunter.rb |