Sha256: 64b38c7ef661aebd6f4fd0b8f0ff25cb7b0e5b395903afe806e5bfaa88aa3eef

Contents?: true

Size: 664 Bytes

Versions: 4

Compression:

Stored size: 664 Bytes

Contents

# frozen_string_literal: true

module Paddle
  class Configuration

    attr_reader :environment

    attr_accessor :version
    attr_accessor :api_key

    def initialize
      @environment ||= :production
      @version ||= 1
    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.1.3 lib/paddle/configuration.rb
paddle-2.1.2 lib/paddle/configuration.rb
paddle-2.1.1 lib/paddle/configuration.rb
paddle-2.1.0 lib/paddle/configuration.rb