Sha256: 1c7aa000695a766e375be41acf29dbdd01860a996429b7011044f13b80196411

Contents?: true

Size: 1.16 KB

Versions: 7

Compression:

Stored size: 1.16 KB

Contents

module Errplane
  class Transmitter
    def initialize(params = {})
    end

    def relay(black_box, deployment = false)
      http = initialize_http_connection
      data = black_box.to_json
      response = begin
                   url = "/api/v1/applications/#{Errplane.configuration.application_id}/exceptions/#{Errplane.configuration.rails_environment}#{"/deploy" if deployment}?api_key=#{Errplane.configuration.api_key}"
                   Errplane.configuration.logger.info("\nURL: #{url}") if Errplane.configuration.debug?
                   Errplane.configuration.logger.info("\nData: #{data.inspect}") if Errplane.configuration.debug?
                   response = http.post(url, data)
                   Errplane.configuration.logger.info("\nException Response: #{response.inspect}") if Errplane.configuration.debug?
                   response
                 rescue Exception => e
                   # e
                 end

      case response
      when Net::HTTPSuccess
        # Success
      else
        # Failure
      end
    end

    private
    def initialize_http_connection
      connection = Net::HTTP.new(Errplane.configuration.api_host, "80")
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
errplane-0.3.7 lib/errplane/transmitter.rb
errplane-0.2.7 lib/errplane/transmitter.rb
errplane-0.2.6 lib/errplane/transmitter.rb
errplane-0.2.5 lib/errplane/transmitter.rb
errplane-0.2.4 lib/errplane/transmitter.rb
errplane-0.2.3 lib/errplane/transmitter.rb
errplane-0.2.0 lib/errplane/transmitter.rb