appflux/appflux-ruby

View on GitHub
lib/appflux_ruby/bugflux_config.rb

Summary

Maintainability
A
0 mins
Test Coverage
##
# This class hold all configurations related to Bugflux. Our aim is to make this
# a generalized class that collects metrics for all the apps like: bugflux,
# perflux etc based on the host application configuration.
#
# Also, it would be better to extract the notice sending logic to its own gem.
# This is because all hook applications might not be on the same address.
module AppfluxRuby
  class BugfluxConfig
    ##
    # @return [ID] Identify the application where to send the notification.
    # This value *must* be set.
    attr_accessor :app_id, :ignored_environments

    ##
    # @return [Logger] the default logger used for debug output
    # attr_accessor :logger

    ##
    # @return [String] the host, which provides the API endpoint to which
    #   exceptions should be sent
    attr_reader :host

    def initialize config = Hash.new
      @host = host_name
    end

    ##
    # @return [Boolean], Whether we are using secure connection or not.
    def use_ssl
      false
    end

    private

      # This is the URL to API that accepts notifications generated by this gem.
      # Should be something like: /applications/<app_id>/notifications [POST]
      def host_name
        'https://appflux.io/exceptions'
      end

  end
end