Sha256: bc0faac71d3920d451d85c8e2ccbec215c4dae03bdba0a090e52a8677fecba8a

Contents?: true

Size: 819 Bytes

Versions: 1

Compression:

Stored size: 819 Bytes

Contents

# frozen_string_literal: true

module Kentaa
  module Api
    class Config
      LIVE_URL = "https://api.kentaa.nl/v1"
      TEST_URL = "https://api.kentaa.staatklaar.nu/v1"
      DEV_URL  = "http://api.lvh.me:3000/v1"

      attr_accessor :options

      def initialize(options = {})
        @options = options
      end

      def api_key
        options.fetch(:api_key)
      end

      def api_url
        case environment
        when :test
          TEST_URL
        when :development
          DEV_URL
        when :live
          LIVE_URL
        end
      end

      def environment
        if options[:test]
          :test
        elsif options[:dev]
          :development
        else
          :live
        end
      end

      def debug?
        options.fetch(:debug, false)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kentaa-api-0.6.0 lib/kentaa/api/config.rb