Class: Raygun::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/raygun/client.rb

Overview

client for the Raygun REST APIv1 as per raygun.com/documentation/product-guides/crash-reporting/api/

Constant Summary collapse

ENV_IP_ADDRESS_KEYS =
%w(action_dispatch.remote_ip raygun.remote_ip REMOTE_ADDR)
NO_API_KEY_MESSAGE =
"[RAYGUN] Just a note, you've got no API Key configured, which means we can't report exceptions. Specify your Raygun API key using Raygun#setup (find yours at https://app.raygun.com)"
MAX_BREADCRUMBS_SIZE =
100_000

Instance Method Summary collapse

Constructor Details

#initializeClient

Returns a new instance of Client.



12
13
14
15
16
17
18
19
20
21
# File 'lib/raygun/client.rb', line 12

def initialize
  @api_key = require_api_key
  @headers = {
    "X-ApiKey" => @api_key
  }

  enable_http_proxy if Raygun.configuration.proxy_settings[:address]
  self.class.base_uri Raygun.configuration.api_url
  self.class.default_timeout(Raygun.configuration.error_report_send_timeout)
end

Instance Method Details

#require_api_keyObject



23
24
25
# File 'lib/raygun/client.rb', line 23

def require_api_key
  Raygun.configuration.api_key || print_api_key_warning
end

#track_exception(exception_instance, env = {}, user = nil) ⇒ Object



27
28
29
# File 'lib/raygun/client.rb', line 27

def track_exception(exception_instance, env = {}, user = nil)
  create_entry(build_payload_hash(exception_instance, env, user))
end