class ChargeBee::Environment

Constants

API_VERSION
EXPORT_TIMEOUT
TIME_MACHINE_TIMEOUT

in seconds

Attributes

api_endpoint[R]
api_key[RW]
export_sleeptime[RW]
site[RW]
time_machine_sleeptime[RW]

Public Class Methods

new(options) click to toggle source
# File lib/chargebee/environment.rb, line 11
def initialize(options)
  options[:time_machine_sleeptime] ||= TIME_MACHINE_TIMEOUT
  options[:export_sleeptime] ||= EXPORT_TIMEOUT
  [:api_key, :site, :time_machine_sleeptime, :export_sleeptime].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

Public Instance Methods

api_url(url) click to toggle source
# File lib/chargebee/environment.rb, line 24
def api_url(url)
  url = @api_endpoint + url
end