Class: RailsAgents::Configuration
- Inherits:
-
Object
- Object
- RailsAgents::Configuration
- Defined in:
- lib/rails_agents/configuration.rb
Constant Summary collapse
- DEFAULT_ORIGIN =
Always Rails Agent Cloud. Not overridable via ENV.
"https://cloud.rails-agent.com"
Instance Attribute Summary collapse
-
#api_base ⇒ Object
Returns the value of attribute api_base.
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#dashboard_base ⇒ Object
Returns the value of attribute dashboard_base.
-
#project_id ⇒ Object
Returns the value of attribute project_id.
Instance Method Summary collapse
- #api_v1_base ⇒ Object
- #configured? ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
11 12 13 14 15 16 |
# File 'lib/rails_agents/configuration.rb', line 11 def initialize @api_key = ENV["RAILS_AGENTS_API_KEY"] @project_id = ENV["RAILS_AGENTS_PROJECT_ID"] @api_base = DEFAULT_ORIGIN @dashboard_base = DEFAULT_ORIGIN end |
Instance Attribute Details
#api_base ⇒ Object
Returns the value of attribute api_base.
9 10 11 |
# File 'lib/rails_agents/configuration.rb', line 9 def api_base @api_base end |
#api_key ⇒ Object
Returns the value of attribute api_key.
8 9 10 |
# File 'lib/rails_agents/configuration.rb', line 8 def api_key @api_key end |
#dashboard_base ⇒ Object
Returns the value of attribute dashboard_base.
9 10 11 |
# File 'lib/rails_agents/configuration.rb', line 9 def dashboard_base @dashboard_base end |
#project_id ⇒ Object
Returns the value of attribute project_id.
8 9 10 |
# File 'lib/rails_agents/configuration.rb', line 8 def project_id @project_id end |
Instance Method Details
#api_v1_base ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/rails_agents/configuration.rb', line 33 def api_v1_base base = api_base.to_s.chomp("/") return base if base.end_with?("/api/v1") return "#{base}/v1" if base.end_with?("/api") "#{base}/api/v1" end |
#configured? ⇒ Boolean
29 30 31 |
# File 'lib/rails_agents/configuration.rb', line 29 def configured? api_key.to_s.strip != "" end |