Sha256: 0677c2c5d1ad8abc72b62a3ee020b26f0fedd2dd9cc3fc0b64ce0cf44ba8fad3

Contents?: true

Size: 616 Bytes

Versions: 4

Compression:

Stored size: 616 Bytes

Contents

# frozen_string_literal: true

module Paddle
  class Configuration

    attr_reader :environment

    attr_accessor :api_key

    def initialize
      @environment ||= :production
    end

    def environment=(env)
      env = env.to_sym
      unless [:development, :sandbox, :production].include?(env)
        raise ArgumentError, "#{env.inspect} is not a valid environment"
      end
      @environment = env
    end

    def url
      case @environment
      when :production
        "https://api.paddle.com"
      when :development, :sandbox
        "https://sandbox-api.paddle.com"
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
paddle-2.0.0 lib/paddle/configuration.rb
paddle-1.1.2 lib/paddle/configuration.rb
paddle-1.1.1 lib/paddle/configuration.rb
paddle-1.1.0 lib/paddle/configuration.rb