Exception: SplitIoClient::SplitAdapter
- Inherits:
-
NoMethodError
- Object
- NoMethodError
- SplitIoClient::SplitAdapter
- Defined in:
- lib/splitclient-rb/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
-
#events_sender ⇒ Object
Starts thread which loops constantly and sends events to the Split API.
-
#impressions_sender ⇒ Object
Starts thread which loops constantly and sends impressions to the Split API.
-
#initialize(api_key, splits_repository, segments_repository, impressions_repository, metrics_repository, events_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, splits_repository, segments_repository, impressions_repository, metrics_repository, events_repository, sdk_blocker) ⇒ SplitIoClient
Creates a new split api adapter instance that consumes split api endpoints
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/splitclient-rb/engine/parser/split_adapter.rb', line 27 def initialize(api_key, splits_repository, segments_repository, impressions_repository, metrics_repository, events_repository, sdk_blocker) @api_key = api_key @splits_repository = splits_repository @segments_repository = segments_repository @impressions_repository = impressions_repository @metrics_repository = metrics_repository @events_repository = events_repository @metrics = Metrics.new(100, @metrics_repository) @sdk_blocker = sdk_blocker start_based_on_mode(SplitIoClient.configuration.mode) end |
Instance Attribute Details
#impressions_repository ⇒ Object (readonly)
Returns the value of attribute impressions_repository.
14 15 16 |
# File 'lib/splitclient-rb/engine/parser/split_adapter.rb', line 14 def impressions_repository @impressions_repository end |
#metrics ⇒ Object (readonly)
Returns the value of attribute metrics.
14 15 16 |
# File 'lib/splitclient-rb/engine/parser/split_adapter.rb', line 14 def metrics @metrics end |
#segments_repository ⇒ Object (readonly)
Returns the value of attribute segments_repository.
14 15 16 |
# File 'lib/splitclient-rb/engine/parser/split_adapter.rb', line 14 def segments_repository @segments_repository end |
#splits_repository ⇒ Object (readonly)
Returns the value of attribute splits_repository.
14 15 16 |
# File 'lib/splitclient-rb/engine/parser/split_adapter.rb', line 14 def splits_repository @splits_repository end |
Instance Method Details
#events_sender ⇒ Object
Starts thread which loops constantly and sends events to the Split API
82 83 84 |
# File 'lib/splitclient-rb/engine/parser/split_adapter.rb', line 82 def events_sender EventsSender.new(@events_repository, @api_key).call end |
#impressions_sender ⇒ Object
Starts thread which loops constantly and sends impressions to the Split API
72 73 74 |
# File 'lib/splitclient-rb/engine/parser/split_adapter.rb', line 72 def impressions_sender ImpressionsSender.new(@impressions_repository, @api_key).call end |
#metrics_sender ⇒ Object
Starts thread which loops constantly and sends metrics to the Split API
77 78 79 |
# File 'lib/splitclient-rb/engine/parser/split_adapter.rb', line 77 def metrics_sender MetricsSender.new(@metrics_repository, @api_key).call end |
#segment_store ⇒ Object
Starts thread which loops constantly and stores segments in the segments_repository of choice
67 68 69 |
# File 'lib/splitclient-rb/engine/parser/split_adapter.rb', line 67 def segment_store SegmentStore.new(@segments_repository, @api_key, @metrics, @sdk_blocker).call end |
#split_store ⇒ Object
Starts thread which loops constantly and stores splits in the splits_repository of choice
62 63 64 |
# File 'lib/splitclient-rb/engine/parser/split_adapter.rb', line 62 def split_store SplitStore.new(@splits_repository, @api_key, @metrics, @sdk_blocker).call end |
#start_based_on_mode(mode) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/splitclient-rb/engine/parser/split_adapter.rb', line 40 def start_based_on_mode(mode) case mode when :standalone split_store segment_store metrics_sender impressions_sender events_sender when :consumer # Do nothing in background when :producer split_store segment_store impressions_sender metrics_sender events_sender sleep unless ENV['SPLITCLIENT_ENV'] == 'test' end end |