Sha256: 0fbf833a5dc2bf61387e5b55d6ad65bc2b544a59acd1ed3d62ddb310938cf067

Contents?: true

Size: 1.41 KB

Versions: 12

Compression:

Stored size: 1.41 KB

Contents

module NCore
  module Configuration
    extend ActiveSupport::Concern

    included do
      init_config_options
    end


    module ClassMethods

      def init_config_options
        mattr_accessor :default_url
        self.default_url = 'https://api.example.com/v1/'

        mattr_accessor :default_headers
        self.default_headers = {
          accept: 'application/json',
          content_type: 'application/json',
          user_agent: "NCore/ruby v#{VERSION}"
        }

        mattr_accessor :credentials

        mattr_accessor :debug
        self.debug = false

        mattr_accessor :strict_attributes
        self.strict_attributes = true

        mattr_accessor :instrument_key
        self.instrument_key = 'request.ncore'

        mattr_accessor :status_page
        self.status_page = 'the status page'

        mattr_accessor :auth_header_prefix
        self.auth_header_prefix = 'X-Api'

        mattr_accessor :credentials_error_message
        self.credentials_error_message = %Q{Missing API credentials. Set default credentials using "#{self.parent.name}.credentials = {api_user: YOUR_API_USER, api_key: YOUR_API_KEY}"}

        mattr_accessor :verify_ssl
        self.verify_ssl = true

        mattr_accessor :ssl_cert_bundle
        self.ssl_cert_bundle = File.dirname(__FILE__)+'/ssl/ca-certificates.crt'

        mattr_accessor :logger
        self.logger = Logger.new(STDOUT)
      end

    end

  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ncore-2.0.8 lib/ncore/configuration.rb
ncore-2.0.7 lib/ncore/configuration.rb
ncore-2.0.6 lib/ncore/configuration.rb
ncore-2.0.5 lib/ncore/configuration.rb
ncore-2.0.4 lib/ncore/configuration.rb
ncore-2.0.3 lib/ncore/configuration.rb
ncore-2.0.2 lib/ncore/configuration.rb
ncore-2.0.1 lib/ncore/configuration.rb
ncore-2.0.0 lib/ncore/configuration.rb
ncore-1.2.1 lib/ncore/configuration.rb
ncore-1.1.0 lib/ncore/configuration.rb
ncore-1.0.0 lib/ncore/configuration.rb