Sha256: a3cba0e5cb3f111ec9ec9fb73fd0399b67885ce48c374e02e5954ba2d7dc2a5a

Contents?: true

Size: 1.05 KB

Versions: 53

Compression:

Stored size: 1.05 KB

Contents

module ChargeBee
  class Environment
    API_VERSION = "v2"
    # in seconds
    TIME_MACHINE_TIMEOUT = 3
    EXPORT_TIMEOUT = 10
    CONNECT_TIMEOUT = 30
    READ_TIMEOUT = 80

    attr_accessor :api_key, :site, :time_machine_sleeptime, :export_sleeptime, :connect_timeout, :read_timeout
    attr_reader :api_endpoint

    def initialize(options)
      options[:time_machine_sleeptime] ||= TIME_MACHINE_TIMEOUT
      options[:export_sleeptime] ||= EXPORT_TIMEOUT
      options[:connect_timeout] ||= CONNECT_TIMEOUT
      options[:read_timeout] ||= READ_TIMEOUT
      [:api_key, :site, :time_machine_sleeptime, :export_sleeptime, :connect_timeout, :read_timeout].each do |attr|
        instance_variable_set "@#{attr}", options[attr]
      end
      if($CHARGEBEE_DOMAIN == nil)
        @api_endpoint = "https://#{@site}.chargebee.com/api/#{API_VERSION}"
      else
        @api_endpoint = "#{$ENV_PROTOCOL == nil ? "http": "https"}://#{@site}.#{$CHARGEBEE_DOMAIN}/api/#{API_VERSION}"
      end
    end

    def api_url(url)
      url = @api_endpoint + url
    end
  end
end

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
chargebee-2.49.0 lib/chargebee/environment.rb
chargebee-2.48.0 lib/chargebee/environment.rb
chargebee-2.47.1 lib/chargebee/environment.rb
chargebee-2.47.0 lib/chargebee/environment.rb
chargebee-2.47.0.beta.1 lib/chargebee/environment.rb
chargebee-2.46.0 lib/chargebee/environment.rb
chargebee-2.45.0 lib/chargebee/environment.rb
chargebee-2.44.1 lib/chargebee/environment.rb
chargebee-2.44.0 lib/chargebee/environment.rb
chargebee-2.43.0 lib/chargebee/environment.rb
chargebee-2.42.0 lib/chargebee/environment.rb
chargebee-2.41.0 lib/chargebee/environment.rb
chargebee-2.40.0 lib/chargebee/environment.rb
chargebee-2.38.1 lib/chargebee/environment.rb
chargebee-2.38.0 lib/chargebee/environment.rb
chargebee-2.37.1 lib/chargebee/environment.rb
chargebee-2.37.0 lib/chargebee/environment.rb
chargebee-2.36.2 lib/chargebee/environment.rb
chargebee-2.36.1 lib/chargebee/environment.rb
chargebee-2.36.0 lib/chargebee/environment.rb