Class: ChargeBee::Environment
- Inherits:
-
Object
- Object
- ChargeBee::Environment
- Defined in:
- lib/chargebee/environment.rb
Constant Summary collapse
- API_VERSION =
"v2"- TIME_MACHINE_TIMEOUT =
in seconds
3
Instance Attribute Summary collapse
-
#api_endpoint ⇒ Object
readonly
Returns the value of attribute api_endpoint.
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#site ⇒ Object
Returns the value of attribute site.
-
#time_machine_sleeptime ⇒ Object
Returns the value of attribute time_machine_sleeptime.
Instance Method Summary collapse
- #api_url(url) ⇒ Object
-
#initialize(options) ⇒ Environment
constructor
A new instance of Environment.
Constructor Details
#initialize(options) ⇒ Environment
Returns a new instance of Environment.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/chargebee/environment.rb', line 10 def initialize() [:time_machine_sleeptime] ||= TIME_MACHINE_TIMEOUT [:api_key, :site, :time_machine_sleeptime].each do |attr| instance_variable_set "@#{attr}", [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 |
Instance Attribute Details
#api_endpoint ⇒ Object (readonly)
Returns the value of attribute api_endpoint.
8 9 10 |
# File 'lib/chargebee/environment.rb', line 8 def api_endpoint @api_endpoint end |
#api_key ⇒ Object
Returns the value of attribute api_key.
7 8 9 |
# File 'lib/chargebee/environment.rb', line 7 def api_key @api_key end |
#site ⇒ Object
Returns the value of attribute site.
7 8 9 |
# File 'lib/chargebee/environment.rb', line 7 def site @site end |
#time_machine_sleeptime ⇒ Object
Returns the value of attribute time_machine_sleeptime.
7 8 9 |
# File 'lib/chargebee/environment.rb', line 7 def time_machine_sleeptime @time_machine_sleeptime end |
Instance Method Details
#api_url(url) ⇒ Object
22 23 24 |
# File 'lib/chargebee/environment.rb', line 22 def api_url(url) url = @api_endpoint + url end |