Class: ChargeBee::Environment
- Inherits:
-
Object
- Object
- ChargeBee::Environment
- Defined in:
- lib/chargebee/environment.rb
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.
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.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/chargebee/environment.rb', line 7 def initialize() [:api_key, :site].each do |attr| instance_variable_set "@#{attr}", [attr] end if($CHARGEBEE_DOMAIN == nil) @api_endpoint = "https://#{@site}.chargebee.com/api/v1" else @api_endpoint = "http://#{@site}.#{$CHARGEBEE_DOMAIN}/api/v1" end end |
Instance Attribute Details
#api_endpoint ⇒ Object (readonly)
Returns the value of attribute api_endpoint.
5 6 7 |
# File 'lib/chargebee/environment.rb', line 5 def api_endpoint @api_endpoint end |
#api_key ⇒ Object
Returns the value of attribute api_key.
4 5 6 |
# File 'lib/chargebee/environment.rb', line 4 def api_key @api_key end |
#site ⇒ Object
Returns the value of attribute site.
4 5 6 |
# File 'lib/chargebee/environment.rb', line 4 def site @site end |
Instance Method Details
#api_url(url) ⇒ Object
18 19 20 |
# File 'lib/chargebee/environment.rb', line 18 def api_url(url) url = @api_endpoint + url end |