Sha256: 32fbe929315894d4878f7a00f7fc88e9d0adda3825d707dcf96b5af0882de292

Contents?: true

Size: 689 Bytes

Versions: 9

Compression:

Stored size: 689 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.nil? ? :production : 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

9 entries across 9 versions & 1 rubygems

Version Path
paddle-2.7.0 lib/paddle/configuration.rb
paddle-2.6.0 lib/paddle/configuration.rb
paddle-2.5.2 lib/paddle/configuration.rb
paddle-2.5.1 lib/paddle/configuration.rb
paddle-2.5.0 lib/paddle/configuration.rb
paddle-2.4.1 lib/paddle/configuration.rb
paddle-2.4.0 lib/paddle/configuration.rb
paddle-2.3.0 lib/paddle/configuration.rb
paddle-2.2.1 lib/paddle/configuration.rb