Exception: SplitIoClient::SplitAdapter
- Inherits:
-
NoMethodError
- Object
- NoMethodError
- SplitIoClient::SplitAdapter
- Defined in:
- lib/engine/parser/split_adapter.rb
Overview
acts as an api adapater to connect to split endpoints uses a configuration object that can be modified when creating the client instance also, uses safe threads to execute fetches and post give the time execution values from the config
Instance Attribute Summary collapse
-
#impressions_repository ⇒ Object
readonly
Returns the value of attribute impressions_repository.
-
#metrics ⇒ Object
readonly
Returns the value of attribute metrics.
-
#segments_repository ⇒ Object
readonly
Returns the value of attribute segments_repository.
-
#splits_repository ⇒ Object
readonly
Returns the value of attribute splits_repository.
Instance Method Summary collapse
-
#impressions_sender ⇒ Object
Starts thread which loops constantly and sends impressions to the Split API.
-
#initialize(api_key, config, splits_repository, segments_repository, impressions_repository, metrics_repository, sdk_blocker) ⇒ SplitIoClient
constructor
Creates a new split api adapter instance that consumes split api endpoints.
-
#metrics_sender ⇒ Object
Starts thread which loops constantly and sends metrics to the Split API.
-
#segment_store ⇒ Object
Starts thread which loops constantly and stores segments in the segments_repository of choice.
-
#split_store ⇒ Object
Starts thread which loops constantly and stores splits in the splits_repository of choice.
- #start_based_on_mode(mode) ⇒ Object
Constructor Details
#initialize(api_key, config, splits_repository, segments_repository, impressions_repository, metrics_repository, sdk_blocker) ⇒ SplitIoClient
Creates a new split api adapter instance that consumes split api endpoints
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/engine/parser/split_adapter.rb', line 25 def initialize(api_key, config, splits_repository, segments_repository, impressions_repository, metrics_repository, sdk_blocker) @api_key = api_key @config = config @splits_repository = splits_repository @segments_repository = segments_repository @impressions_repository = impressions_repository @metrics_repository = metrics_repository @metrics = Metrics.new(100, @config, @metrics_repository) @sdk_blocker = sdk_blocker start_based_on_mode(@config.mode) end |
Instance Attribute Details
#impressions_repository ⇒ Object (readonly)
Returns the value of attribute impressions_repository.
11 12 13 |
# File 'lib/engine/parser/split_adapter.rb', line 11 def impressions_repository @impressions_repository end |
#metrics ⇒ Object (readonly)
Returns the value of attribute metrics.
11 12 13 |
# File 'lib/engine/parser/split_adapter.rb', line 11 def metrics @metrics end |
#segments_repository ⇒ Object (readonly)
Returns the value of attribute segments_repository.
11 12 13 |
# File 'lib/engine/parser/split_adapter.rb', line 11 def segments_repository @segments_repository end |
#splits_repository ⇒ Object (readonly)
Returns the value of attribute splits_repository.
11 12 13 |
# File 'lib/engine/parser/split_adapter.rb', line 11 def splits_repository @splits_repository end |
Instance Method Details
#impressions_sender ⇒ Object
Starts thread which loops constantly and sends impressions to the Split API
68 69 70 |
# File 'lib/engine/parser/split_adapter.rb', line 68 def impressions_sender SplitIoClient::Cache::Senders::ImpressionsSender.new(@impressions_repository, @config, @api_key).call end |
#metrics_sender ⇒ Object
Starts thread which loops constantly and sends metrics to the Split API
73 74 75 |
# File 'lib/engine/parser/split_adapter.rb', line 73 def metrics_sender SplitIoClient::Cache::Senders::MetricsSender.new(@metrics_repository, @config, @api_key).call end |
#segment_store ⇒ Object
Starts thread which loops constantly and stores segments in the segments_repository of choice
63 64 65 |
# File 'lib/engine/parser/split_adapter.rb', line 63 def segment_store SplitIoClient::Cache::Stores::SegmentStore.new(@segments_repository, @config, @api_key, @metrics, @sdk_blocker).call end |
#split_store ⇒ Object
Starts thread which loops constantly and stores splits in the splits_repository of choice
58 59 60 |
# File 'lib/engine/parser/split_adapter.rb', line 58 def split_store SplitIoClient::Cache::Stores::SplitStore.new(@splits_repository, @config, @api_key, @metrics, @sdk_blocker).call end |
#start_based_on_mode(mode) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/engine/parser/split_adapter.rb', line 38 def start_based_on_mode(mode) case mode when :standalone split_store segment_store metrics_sender impressions_sender when :consumer # Do nothing in background when :producer split_store segment_store impressions_sender metrics_sender sleep unless ENV['SPLITCLIENT_ENV'] == 'test' end end |