Module: Hackle

Defined in:
lib/hackle.rb,
lib/hackle/client.rb,
lib/hackle/config.rb,
lib/hackle/version.rb,
lib/hackle/http/http.rb,
lib/hackle/models/slot.rb,
lib/hackle/events/event.rb,
lib/hackle/models/bucket.rb,
lib/hackle/decision/decider.rb,
lib/hackle/models/variation.rb,
lib/hackle/decision/bucketer.rb,
lib/hackle/models/event_type.rb,
lib/hackle/models/experiment.rb,
lib/hackle/workspaces/workspace.rb,
lib/hackle/events/event_processor.rb,
lib/hackle/events/event_dispatcher.rb,
lib/hackle/workspaces/http_workspace_fetcher.rb,
lib/hackle/workspaces/polling_workspace_fetcher.rb

Defined Under Namespace

Classes: Bucket, Bucketer, Client, Config, Decider, Decision, Event, EventDispatcher, EventProcessor, EventType, Experiment, HTTP, HttpWorkspaceFetcher, PollingWorkspaceFetcher, SdkInfo, Slot, UnexpectedResponseError, Variation, Workspace

Constant Summary collapse

VERSION =
'0.1.0'
SDK_NAME =
'ruby-sdk'

Class Method Summary collapse

Class Method Details

.client(sdk_key:, **options) ⇒ Client

Instantiates a Hackle client.

Parameters:

  • sdk_key (String)

    The SDK key of your Hackle environment

  • options

    An optional client configuration

Returns:

  • (Client)

    The Hackle client instance.

See Also:



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/hackle.rb', line 19

def self.client(sdk_key:, **options)
  config = Config.new(options)
  sdk_info = SdkInfo.new(key: sdk_key)

  http_workspace_fetcher = HttpWorkspaceFetcher.new(config: config, sdk_info: sdk_info)
  polling_workspace_fetcher = PollingWorkspaceFetcher.new(config: config, http_fetcher: http_workspace_fetcher)

  event_dispatcher = EventDispatcher.new(config: config, sdk_info: sdk_info)
  event_processor = EventProcessor.new(config: config, event_dispatcher: event_dispatcher)

  polling_workspace_fetcher.start!
  event_processor.start!

  Client.new(
    config: config,
    workspace_fetcher: polling_workspace_fetcher,
    event_processor: event_processor,
    decider: Decider.new
  )
end