Class: ZktClient::Configuration
- Inherits:
-
Object
- Object
- ZktClient::Configuration
- Includes:
- Singleton
- Defined in:
- lib/zkt_client/configuration.rb
Overview
Configuration class handles the configuration settings for ZktClient
Instance Attribute Summary collapse
-
#access_token ⇒ String?
Retrieves the access token configuration.
-
#host ⇒ String?
Retrieves the host configuration.
-
#is_object_response_enabled ⇒ Object
writeonly
Sets the attribute is_object_response_enabled.
-
#password ⇒ String?
Retrieves the password configuration.
-
#username ⇒ String?
Retrieves the username configuration.
Instance Method Summary collapse
-
#configured? ⇒ Boolean
Checks if the client is configured.
-
#with_object_response? ⇒ Boolean
Checks if object response is enabled.
Instance Attribute Details
#access_token ⇒ String?
Retrieves the access token configuration
36 37 38 |
# File 'lib/zkt_client/configuration.rb', line 36 def access_token @access_token || ENV["ZKT_CLIENT_ACCESS_TOKEN"] end |
#host ⇒ String?
Retrieves the host configuration
15 16 17 |
# File 'lib/zkt_client/configuration.rb', line 15 def host @host || ENV["ZKT_CLIENT_HOST"] end |
#is_object_response_enabled=(value) ⇒ Object (writeonly)
Sets the attribute is_object_response_enabled
10 11 12 |
# File 'lib/zkt_client/configuration.rb', line 10 def is_object_response_enabled=(value) @is_object_response_enabled = value end |
#password ⇒ String?
Retrieves the password configuration
29 30 31 |
# File 'lib/zkt_client/configuration.rb', line 29 def password @password || ENV["ZKT_CLIENT_PASSWORD"] end |
#username ⇒ String?
Retrieves the username configuration
22 23 24 |
# File 'lib/zkt_client/configuration.rb', line 22 def username @username || ENV["ZKT_CLIENT_USERNAME"] end |
Instance Method Details
#configured? ⇒ Boolean
Checks if the client is configured
50 51 52 53 |
# File 'lib/zkt_client/configuration.rb', line 50 def configured? host.present? && (access_token.present? || (username.present? && password.present?)) end |
#with_object_response? ⇒ Boolean
Checks if object response is enabled
43 44 45 |
# File 'lib/zkt_client/configuration.rb', line 43 def with_object_response? @is_object_response_enabled || ENV["ZKT_OBJECT_RESPONSE_ENABLED"] || false end |