Class: QuizApiClient::Config
- Inherits:
-
Object
- Object
- QuizApiClient::Config
- Defined in:
- lib/quiz_api_client/config.rb
Defined Under Namespace
Classes: InvalidErrorHandler, InvalidMetricsHandler, InvalidMetricsNamespace
Constant Summary collapse
- DEFAULT_ALLOWABLE_RESPONSE_CODES =
[401, 422].freeze
- DEFAULT_PROTOCOL =
'https'.freeze
- ERROR_HANDLERS =
%i[sentry_raven].freeze
- METRICS_HANDLERS =
%i[inststatsd].freeze
Instance Attribute Summary collapse
- #allowable_response_codes ⇒ Object
-
#consumer_key ⇒ Object
Returns the value of attribute consumer_key.
-
#consumer_request_id ⇒ Object
Returns the value of attribute consumer_request_id.
-
#error_handler ⇒ Object
Returns the value of attribute error_handler.
-
#host ⇒ Object
Returns the value of attribute host.
-
#metrics_handler ⇒ Object
readonly
Returns the value of attribute metrics_handler.
-
#metrics_namespace ⇒ Object
readonly
Returns the value of attribute metrics_namespace.
- #protocol ⇒ Object
-
#shared_secret ⇒ Object
Returns the value of attribute shared_secret.
Instance Method Summary collapse
-
#initialize {|_self| ... } ⇒ Config
constructor
A new instance of Config.
- #setup_metrics(handler, namespace) ⇒ Object
Constructor Details
#initialize {|_self| ... } ⇒ Config
Returns a new instance of Config.
16 17 18 |
# File 'lib/quiz_api_client/config.rb', line 16 def initialize yield(self) if block_given? end |
Instance Attribute Details
#allowable_response_codes ⇒ Object
38 39 40 |
# File 'lib/quiz_api_client/config.rb', line 38 def allowable_response_codes @allowable_response_codes || DEFAULT_ALLOWABLE_RESPONSE_CODES end |
#consumer_key ⇒ Object
Returns the value of attribute consumer_key.
14 15 16 |
# File 'lib/quiz_api_client/config.rb', line 14 def consumer_key @consumer_key end |
#consumer_request_id ⇒ Object
Returns the value of attribute consumer_request_id.
14 15 16 |
# File 'lib/quiz_api_client/config.rb', line 14 def consumer_request_id @consumer_request_id end |
#error_handler ⇒ Object
Returns the value of attribute error_handler.
12 13 14 |
# File 'lib/quiz_api_client/config.rb', line 12 def error_handler @error_handler end |
#host ⇒ Object
Returns the value of attribute host.
14 15 16 |
# File 'lib/quiz_api_client/config.rb', line 14 def host @host end |
#metrics_handler ⇒ Object (readonly)
Returns the value of attribute metrics_handler.
12 13 14 |
# File 'lib/quiz_api_client/config.rb', line 12 def metrics_handler @metrics_handler end |
#metrics_namespace ⇒ Object (readonly)
Returns the value of attribute metrics_namespace.
12 13 14 |
# File 'lib/quiz_api_client/config.rb', line 12 def metrics_namespace @metrics_namespace end |
#protocol ⇒ Object
20 21 22 |
# File 'lib/quiz_api_client/config.rb', line 20 def protocol @protocol || DEFAULT_PROTOCOL end |
#shared_secret ⇒ Object
Returns the value of attribute shared_secret.
14 15 16 |
# File 'lib/quiz_api_client/config.rb', line 14 def shared_secret @shared_secret end |
Instance Method Details
#setup_metrics(handler, namespace) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/quiz_api_client/config.rb', line 30 def setup_metrics(handler, namespace) validate_metrics_handler!(handler) validate_metrics_namespace!(namespace) @metrics_handler = handler.to_sym @metrics_namespace = namespace.to_s.strip end |