class RaygunClient::HTTP::Post
Attributes
data[R]
Public Class Methods
build(connection: nil)
click to toggle source
# File lib/raygun_client/http/post.rb, line 17 def self.build(connection: nil) instance = new RaygunClient::Settings.set(instance) instance end
call(data)
click to toggle source
# File lib/raygun_client/http/post.rb, line 23 def self.call(data) instance = build instance.(data) end
host()
click to toggle source
# File lib/raygun_client/http/post.rb, line 41 def self.host 'api.raygun.io' end
path()
click to toggle source
# File lib/raygun_client/http/post.rb, line 45 def self.path '/entries' end
register_telemetry_sink(post)
click to toggle source
# File lib/raygun_client/http/post.rb, line 61 def self.register_telemetry_sink(post) sink = Telemetry.sink post.telemetry.register(sink) sink end
uri()
click to toggle source
# File lib/raygun_client/http/post.rb, line 49 def self.uri @uri ||= URI::HTTPS.build(:host => host, :path => path) end
Public Instance Methods
call(data)
click to toggle source
# File lib/raygun_client/http/post.rb, line 28 def call(data) logger.trace { "Posting to Raygun" } json_text = Transform::Write.(data, :json) response = http_post(json_text) telemetry.record(:posted, Telemetry::Data.new(data, response)) logger.info { "Posted to Raygun (#{LogText::Posted.(data, response)})" } response end
http_post(request_body)
click to toggle source
# File lib/raygun_client/http/post.rb, line 53 def http_post(request_body) uri = self.class.uri response = Net::HTTP.post(uri, request_body, { 'X-ApiKey' => api_key }) response end