Class: RaygunRuby::RaygunClient
- Inherits:
-
Object
- Object
- RaygunRuby::RaygunClient
- Defined in:
- lib/RaygunRuby/RaygunClient.rb
Class Method Summary collapse
- .build_message(errorException, env) ⇒ Object
- .send_exception(exception, tags = nil, userCustomData = nil, env = nil) ⇒ Object
- .send_msg(message) ⇒ Object
Class Method Details
.build_message(errorException, env) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/RaygunRuby/RaygunClient.rb', line 13 def self.(errorException, env) = RaygunMessage.new() .build(errorException, env) end |
.send_exception(exception, tags = nil, userCustomData = nil, env = nil) ⇒ Object
7 8 9 10 11 |
# File 'lib/RaygunRuby/RaygunClient.rb', line 7 def self.send_exception(exception, =nil, userCustomData=nil, env=nil) msg = self.(exception, env) self.send_msg(msg) end |
.send_msg(message) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/RaygunRuby/RaygunClient.rb', line 20 def self.send_msg() begin apiKey = RaygunRuby::Config::read["apiKey"] rescue raise "API_KEY not valid, cannot send message to Raygun" end bdy = .api_attributes.to_json connection = Faraday.new 'https://api.raygun.io', :ssl => {:ca_file => "../../vendor/cacert.crt"} do |faraday| faraday.response :logger # log requests to STDOUT faraday.adapter Faraday.default_adapter # make requests with Net::HTTP end request = connection.post do |req| req.url "/entries" req.headers["X-ApiKey"] = apiKey req.headers['Content-Type'] = 'application/x-www-form-urlencoded' req.headers['User-Agent'] = "Hai Raygun" req.body = bdy end puts request.body end |