Sha256: 4b45d5a6509d32b507296ba65856feaab8febf8b127b117c07b50ca3ab1c5d3d

Contents?: true

Size: 819 Bytes

Versions: 6

Compression:

Stored size: 819 Bytes

Contents

# frozen_string_literal: true

require 'infreemation/version'

##
# This module is the main entry point of the Gem
#
module Infreemation
  require 'infreemation/api'
  require 'infreemation/errors'
  require 'infreemation/request'

  ConfigurationError = Class.new(StandardError)

  class << self
    attr_accessor :logger
    attr_writer :url, :api_key, :username

    def url
      @url || raise(
        ConfigurationError, 'Infreemation.url not configured'
      )
    end

    def api_key
      @api_key || raise(
        ConfigurationError, 'Infreemation.api_key not configured'
      )
    end

    def username
      @username || raise(
        ConfigurationError, 'Infreemation.username not configured'
      )
    end

    def log(level, message)
      logger&.send(level, name) { message }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
infreemation-0.2.4 lib/infreemation.rb
infreemation-0.2.3 lib/infreemation.rb
infreemation-0.2.2 lib/infreemation.rb
infreemation-0.2.1 lib/infreemation.rb
infreemation-0.2.0 lib/infreemation.rb
infreemation-0.1.0 lib/infreemation.rb