Class: LiveQA::Config
- Inherits:
-
Object
- Object
- LiveQA::Config
- Defined in:
- lib/liveqa/config.rb
Overview
LiveQA Config
Represent the LiveQA configuration for the API
Constant Summary collapse
- DEFAULT_OBFUSCATED_FIELDS =
%w[ password password_confirmation secret secret_token authenticity_token token api_key access_token credit_card_number cvv ccv ].freeze
Instance Attribute Summary collapse
-
#account_token ⇒ String
API account token.
-
#api_host ⇒ String
API host.
-
#api_version ⇒ String
API version.
-
#async ⇒ Boolean
Send.
-
#custom_object_properties ⇒ Hash
Custom object properties.
-
#enabled ⇒ Boolean
Service is enable.
-
#environment_name ⇒ String
API environment name.
-
#http_secure ⇒ Boolean
Http secure.
-
#log ⇒ Boolean
Enable the logger.
-
#logger ⇒ Logger
Logger.
-
#metadata ⇒ Hash
Metadata to be attach to the payload.
-
#obfuscated_fields ⇒ Array[String]
Fields to obfuscate.
-
#proxy_url ⇒ String
Proxy url.
-
#space_name ⇒ String
API space name.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Config
constructor
Initialize and validate the configuration rubocop:disable Metrics/CyclomaticComplexity rubocop:disable Metrics/PerceivedComplexity.
-
#valid! ⇒ Boolean
validate the configuration Raise when configuration are not valid.
Constructor Details
#initialize(options = {}) ⇒ Config
Initialize and validate the configuration rubocop:disable Metrics/CyclomaticComplexity rubocop:disable Metrics/PerceivedComplexity
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/liveqa/config.rb', line 83 def initialize( = {}) self.account_token = [:account_token] self.space_name = [:space_name] self.environment_name = [:environment_name] self.api_host = [:api_host] || 'api.liveqa.io' self.api_version = [:api_version] || 'v1' self.proxy_url = [:proxy_url] self.http_secure = [:http_secure] || true self.enabled = [:enabled] || true self. = [:obfuscated_fields] || [] self.async = [:async] || true self.custom_object_properties = [:custom_object_properties] || {} self. = [:metadata] self.log = [:log] || true self.logger = FormatedLogger.build([:logger]) end |
Instance Attribute Details
#account_token ⇒ String
Returns API account token.
24 25 26 |
# File 'lib/liveqa/config.rb', line 24 def account_token @account_token end |
#api_host ⇒ String
Returns API host.
36 37 38 |
# File 'lib/liveqa/config.rb', line 36 def api_host @api_host end |
#api_version ⇒ String
Returns API version.
40 41 42 |
# File 'lib/liveqa/config.rb', line 40 def api_version @api_version end |
#async ⇒ Boolean
Returns send.
60 61 62 |
# File 'lib/liveqa/config.rb', line 60 def async @async end |
#custom_object_properties ⇒ Hash
Returns custom object properties.
64 65 66 |
# File 'lib/liveqa/config.rb', line 64 def custom_object_properties @custom_object_properties end |
#enabled ⇒ Boolean
Returns service is enable.
52 53 54 |
# File 'lib/liveqa/config.rb', line 52 def enabled @enabled end |
#environment_name ⇒ String
Returns API environment name.
32 33 34 |
# File 'lib/liveqa/config.rb', line 32 def environment_name @environment_name end |
#http_secure ⇒ Boolean
Returns http secure.
48 49 50 |
# File 'lib/liveqa/config.rb', line 48 def http_secure @http_secure end |
#log ⇒ Boolean
Returns enable the logger.
72 73 74 |
# File 'lib/liveqa/config.rb', line 72 def log @log end |
#logger ⇒ Logger
Returns logger.
76 77 78 |
# File 'lib/liveqa/config.rb', line 76 def logger @logger end |
#metadata ⇒ Hash
Returns metadata to be attach to the payload.
68 69 70 |
# File 'lib/liveqa/config.rb', line 68 def end |
#obfuscated_fields ⇒ Array[String]
Returns fields to obfuscate.
56 57 58 |
# File 'lib/liveqa/config.rb', line 56 def end |
#proxy_url ⇒ String
Returns proxy url.
44 45 46 |
# File 'lib/liveqa/config.rb', line 44 def proxy_url @proxy_url end |
#space_name ⇒ String
Returns API space name.
28 29 30 |
# File 'lib/liveqa/config.rb', line 28 def space_name @space_name end |
Instance Method Details
#valid! ⇒ Boolean
validate the configuration Raise when configuration are not valid
106 107 108 109 110 111 112 113 114 |
# File 'lib/liveqa/config.rb', line 106 def valid! format! i[account_token space_name environment_name api_host api_version].each do |field| validate_presence(field) end true end |