Sha256: d29cf9190e900c71c782e4cd25241266a643005cdc2597766cf61473bb21d271

Contents?: true

Size: 739 Bytes

Versions: 6

Compression:

Stored size: 739 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 :api_key, :options

      def initialize(api_key, options = {})
        @api_key = api_key
        @options = options
      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
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
kentaa-api-0.4.0 lib/kentaa/api/config.rb
kentaa-api-0.3.2 lib/kentaa/api/config.rb
kentaa-api-0.3.1 lib/kentaa/api/config.rb
kentaa-api-0.3.0 lib/kentaa/api/config.rb
kentaa-api-0.2.1 lib/kentaa/api/config.rb
kentaa-api-0.2.0 lib/kentaa/api/config.rb