Class: Raven::Transports::HTTP

Inherits:
Transport show all
Defined in:
lib/raven/transports/http.rb

Instance Attribute Summary collapse

Attributes inherited from Transport

#configuration

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ HTTP

Returns a new instance of HTTP.



11
12
13
14
15
# File 'lib/raven/transports/http.rb', line 11

def initialize(*args)
  super
  self.adapter = configuration.http_adapter || Faraday.default_adapter
  self.conn = set_conn
end

Instance Attribute Details

#adapterObject

Returns the value of attribute adapter.



9
10
11
# File 'lib/raven/transports/http.rb', line 9

def adapter
  @adapter
end

#connObject

Returns the value of attribute conn.



9
10
11
# File 'lib/raven/transports/http.rb', line 9

def conn
  @conn
end

Instance Method Details

#send_event(auth_header, data, options = {}) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/raven/transports/http.rb', line 17

def send_event(auth_header, data, options = {})
  project_id = configuration[:project_id]
  path = configuration[:path] + "/"

  conn.post "#{path}api/#{project_id}/store/" do |req|
    req.headers['Content-Type'] = options[:content_type]
    req.headers['X-Sentry-Auth'] = auth_header
    req.body = data
  end
end