module ESP
Constants
- HOST
@private
- PATH
- VERSION
Public Class Methods
Reads the ESP_ACCESS_KEY_ID
environment variable if {.access_key_id=} was not set manually.
Returns nil if no key or environment variable has been set.
@return [String, nil]
# File lib/esp.rb, line 18 def self.access_key_id @access_key_id || ENV['ESP_ACCESS_KEY_ID'] end
Manually set the access_key_id
you created from esp.evident.io/settings/api_keys.
You can optionally set the ESP_ACCESS_KEY_ID
environment variable.
@param access_key_id
[String] Your access key ID. @return [void]
# File lib/esp.rb, line 8 def self.access_key_id=(access_key_id) @access_key_id = access_key_id ESP::Resource.hmac_access_id = access_key_id end
For use in a Rails initializer to set the {.access_key_id=}, {.secret_access_key=} and {.site}.
@yield [self] @return [void] @example
ESP.configure do |config| config.access_key_id = <your key> config.secret_access_key = <your secret key> config.host = <host of your appliance instance> config.http_proxy = <your proxy URI> end
# File lib/esp.rb, line 97 def self.configure yield self end
Default environment is production which will set {.site} to “api.evident.io/api/v2”.
@return [String]
# File lib/esp.rb, line 104 def self.env @env ||= ActiveSupport::StringInquirer.new(ENV['ESP_ENV'] || ENV['RAILS_ENV'] || 'production') end
Users of the Evident.io marketplace appliance application will need to set the host for their instance.
@param host [String] The host for the installed appliance instance. @return [void]
# File lib/esp.rb, line 53 def self.host=(host) @host = host ESP::Resource.site = site end
Reads the HTTP_PROXY
environment variable if {.http_proxy=} was not set manually.
Returns nil if no proxy or environment variable has been set.
@return [String, nil]
# File lib/esp.rb, line 81 def self.http_proxy @http_proxy || ENV['http_proxy'] end
Manually set an http_proxy
You can optionally set the HTTP_PROXY
environment variable.
@param proxy [String] The URI of the http proxy @return [void]
# File lib/esp.rb, line 71 def self.http_proxy=(proxy) @http_proxy = proxy ESP::Resource.proxy = http_proxy end
Reads the ESP_SECRET_ACCESS_KEY
environment variable if {.secret_access_key=} was not set manually.
Returns nil if no key or environment variable has been set.
@return [String, nil]
# File lib/esp.rb, line 38 def self.secret_access_key @secret_access_key || ENV['ESP_SECRET_ACCESS_KEY'] end
Manually set the secret_access_key
you created from esp.evident.io/settings/api_keys.
You can optionally set the ESP_SECRET_ACCESS_KEY
environment variable.
@param secret_access_key
[String] Your secret access key. @return [void]
# File lib/esp.rb, line 28 def self.secret_access_key=(secret_access_key) @secret_access_key = secret_access_key ESP::Resource.hmac_secret_key = secret_access_key end
The site the SDK will hit.
@return [String]
# File lib/esp.rb, line 61 def self.site "#{(@host || HOST[ESP.env.to_sym] || ENV['ESP_HOST'])}#{PATH}" end