Class: Stn::Configuration
- Inherits:
-
Object
- Object
- Stn::Configuration
- Defined in:
- lib/stn/configuration.rb
Overview
Provides an object to store global configuration settings.
This class is typically not used directly, but by calling Stn.configure, which creates and updates a single instance of Models::Configuration.
An alternative way to set global configuration settings is by storing them in the following environment variables:
-
STN_APP_KEYto store … -
STN_TENANT_IDto store … -
STN_CLIENT_IDto store … -
STN_CLIENT_SECRETto store …
In case both methods are used together, Stn.configure takes precedence.
Instance Attribute Summary collapse
-
#access_token ⇒ String
The Security Token for the API calls.
-
#app_key ⇒ String
…
-
#client_id ⇒ String
…
-
#client_secret ⇒ String
…
-
#mock ⇒ Boolean
Whether to mock the HTTP calls to ServiceTitan.
-
#tenant_id ⇒ String
…
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
Initialize the global configuration settings, using the values of the specified following environment variables by default.
Constructor Details
#initialize ⇒ Configuration
Initialize the global configuration settings, using the values of the specified following environment variables by default.
54 55 56 57 58 59 60 |
# File 'lib/stn/configuration.rb', line 54 def initialize @app_key = ENV['STN_APP_KEY'] @tenant_id = ENV['STN_TENANT_ID'] @client_id = ENV['STN_CLIENT_ID'] @client_secret = ENV['STN_CLIENT_SECRET'] @mock = ENV['STN_MOCK'] == '1' end |
Instance Attribute Details
#access_token ⇒ String
Returns the Security Token for the API calls.
35 36 37 |
# File 'lib/stn/configuration.rb', line 35 def access_token @access_token end |
#app_key ⇒ String
Returns …
38 39 40 |
# File 'lib/stn/configuration.rb', line 38 def app_key @app_key end |
#client_id ⇒ String
Returns …
44 45 46 |
# File 'lib/stn/configuration.rb', line 44 def client_id @client_id end |
#client_secret ⇒ String
Returns …
47 48 49 |
# File 'lib/stn/configuration.rb', line 47 def client_secret @client_secret end |
#mock ⇒ Boolean
Returns whether to mock the HTTP calls to ServiceTitan.
50 51 52 |
# File 'lib/stn/configuration.rb', line 50 def mock @mock end |
#tenant_id ⇒ String
Returns …
41 42 43 |
# File 'lib/stn/configuration.rb', line 41 def tenant_id @tenant_id end |