Class: Raven::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/raven/client.rb

Constant Summary collapse

PROTOCOL_VERSION =
'2.0'
USER_AGENT =
"raven-ruby/#{Raven::VERSION}"
CONTENT_TYPE =
'application/json'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ Client

Returns a new instance of Client.



20
21
22
# File 'lib/raven/client.rb', line 20

def initialize(configuration)
  @configuration = configuration
end

Instance Attribute Details

#configurationObject

Returns the value of attribute configuration.



18
19
20
# File 'lib/raven/client.rb', line 18

def configuration
  @configuration
end

Instance Method Details

#send(event) ⇒ Object



24
25
26
27
28
29
30
31
32
33
# File 'lib/raven/client.rb', line 24

def send(event)
  return unless configuration.send_in_current_environment?

  # Set the project ID correctly
  event.project = self.configuration.project_id
  Raven.logger.debug "Sending event #{event.id} to Sentry"
  content_type, encoded_data = encode(event)
  transport.send(generate_auth_header(encoded_data), encoded_data,
                 :content_type => content_type)
end