Class: FeatureHub::Sdk::PollingEdgeService
- Inherits:
-
EdgeService
- Object
- EdgeService
- FeatureHub::Sdk::PollingEdgeService
- Defined in:
- lib/feature_hub/sdk/poll_edge_service.rb,
sig/feature_hub/featurehub.rbs
Overview
uses a periodic polling mechanism to get updates
Instance Attribute Summary collapse
-
#api_keys ⇒ Object
readonly
Returns the value of attribute api_keys.
-
#cancel ⇒ Object
readonly
Returns the value of attribute cancel.
-
#edge_url ⇒ Object
readonly
Returns the value of attribute edge_url.
-
#etag ⇒ Object
readonly
Returns the value of attribute etag.
-
#interval ⇒ Object
readonly
Returns the value of attribute interval.
-
#sha_context ⇒ Object
readonly
Returns the value of attribute sha_context.
-
#stopped ⇒ Object
readonly
Returns the value of attribute stopped.
Attributes inherited from EdgeService
Instance Method Summary collapse
- #active ⇒ Object
- #close ⇒ Object
- #context_change(new_header) ⇒ Object
-
#initialize(repository, api_keys, edge_url, interval, logger = nil) ⇒ PollingEdgeService
constructor
A new instance of PollingEdgeService.
-
#poll ⇒ Object
abstract.
- #update_interval(interval) ⇒ Object
Constructor Details
#initialize(repository, api_keys, edge_url, interval, logger = nil) ⇒ PollingEdgeService
Returns a new instance of PollingEdgeService.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/feature_hub/sdk/poll_edge_service.rb', line 16 def initialize(repository, api_keys, edge_url, interval, logger = nil) super(repository, api_keys, edge_url, logger) @interval = interval @task = nil @cancel = false @context = nil @etag = nil @stopped = false @sha_context = nil generate_url end |
Instance Attribute Details
#api_keys ⇒ Object (readonly)
Returns the value of attribute api_keys.
14 15 16 |
# File 'lib/feature_hub/sdk/poll_edge_service.rb', line 14 def api_keys @api_keys end |
#cancel ⇒ Object (readonly)
Returns the value of attribute cancel.
14 15 16 |
# File 'lib/feature_hub/sdk/poll_edge_service.rb', line 14 def cancel @cancel end |
#edge_url ⇒ Object (readonly)
Returns the value of attribute edge_url.
14 15 16 |
# File 'lib/feature_hub/sdk/poll_edge_service.rb', line 14 def edge_url @edge_url end |
#etag ⇒ Object (readonly)
Returns the value of attribute etag.
14 15 16 |
# File 'lib/feature_hub/sdk/poll_edge_service.rb', line 14 def etag @etag end |
#interval ⇒ Object (readonly)
Returns the value of attribute interval.
14 15 16 |
# File 'lib/feature_hub/sdk/poll_edge_service.rb', line 14 def interval @interval end |
#sha_context ⇒ Object (readonly)
Returns the value of attribute sha_context.
14 15 16 |
# File 'lib/feature_hub/sdk/poll_edge_service.rb', line 14 def sha_context @sha_context end |
#stopped ⇒ Object (readonly)
Returns the value of attribute stopped.
14 15 16 |
# File 'lib/feature_hub/sdk/poll_edge_service.rb', line 14 def stopped @stopped end |
Instance Method Details
#active ⇒ Object
63 64 65 |
# File 'lib/feature_hub/sdk/poll_edge_service.rb', line 63 def active !@task.nil? end |
#close ⇒ Object
59 60 61 |
# File 'lib/feature_hub/sdk/poll_edge_service.rb', line 59 def close cancel_task end |
#context_change(new_header) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/feature_hub/sdk/poll_edge_service.rb', line 46 def context_change(new_header) return if new_header == @context @context = new_header @sha_context = Digest::SHA256.hexdigest(@context) if active get_updates else poll end end |
#poll ⇒ Object
abstract
32 33 34 35 |
# File 'lib/feature_hub/sdk/poll_edge_service.rb', line 32 def poll @cancel = false poll_with_interval end |
#update_interval(interval) ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/feature_hub/sdk/poll_edge_service.rb', line 37 def update_interval(interval) @interval = interval if @task.nil? poll else @task.execution_interval = interval end end |