Module: Shipeasy::SDK
- Defined in:
- lib/shipeasy-sdk.rb,
lib/shipeasy/sdk/see.rb,
lib/shipeasy/sdk/eval.rb,
lib/shipeasy/sdk/anon_id.rb,
lib/shipeasy/sdk/murmur3.rb,
lib/shipeasy/sdk/railtie.rb,
lib/shipeasy/sdk/version.rb,
lib/shipeasy/sdk/telemetry.rb,
lib/shipeasy/sdk/flags_client.rb,
lib/shipeasy/sdk/sticky_store.rb,
lib/shipeasy/sdk/rack_middleware.rb
Defined Under Namespace
Modules: AnonId, Eval, Murmur3, See Classes: FlagsClient, InMemoryStickyStore, RackMiddleware, Railtie, Telemetry
Constant Summary collapse
- VERSION =
"1.7.0"
Class Method Summary collapse
-
.control_flow_exception(err) ⇒ Object
Mark an exception as expected control flow (reports nothing).
- .default_client ⇒ Object
-
.new_client(api_key: Shipeasy.config.api_key, base_url: Shipeasy.config.base_url) ⇒ Object
Convenience constructor.
-
.see(problem) ⇒ Object
Report a caught exception via the default client.
-
.see_violation(name) ⇒ Object
Report a non-exception problem via the default client.
-
.set_default_client(client) ⇒ Object
Register the client backing the module-level see() funcs.
Class Method Details
.control_flow_exception(err) ⇒ Object
Mark an exception as expected control flow (reports nothing). Works without a client — it only stamps the exception object.
74 75 76 |
# File 'lib/shipeasy-sdk.rb', line 74 def self.control_flow_exception(err) See::ControlFlowChain.new(err) end |
.default_client ⇒ Object
47 48 49 |
# File 'lib/shipeasy-sdk.rb', line 47 def self.default_client @see_default_mutex.synchronize { @see_default_client } end |
.new_client(api_key: Shipeasy.config.api_key, base_url: Shipeasy.config.base_url) ⇒ Object
Convenience constructor. Reads api_key + base_url from the gem-wide config when omitted, so a single ‘Shipeasy.configure { … }` block at boot is enough.
25 26 27 |
# File 'lib/shipeasy-sdk.rb', line 25 def self.new_client(api_key: Shipeasy.config.api_key, base_url: Shipeasy.config.base_url) FlagsClient.new(api_key: api_key, base_url: base_url) end |
.see(problem) ⇒ Object
Report a caught exception via the default client. Use client.see to target a specific client.
53 54 55 56 57 58 59 60 |
# File 'lib/shipeasy-sdk.rb', line 53 def self.see(problem) client = default_client if client.nil? warn "[shipeasy] see() called before a client was created — error dropped" return See::NullChain.new end client.see(problem) end |
.see_violation(name) ⇒ Object
Report a non-exception problem via the default client.
63 64 65 66 67 68 69 70 |
# File 'lib/shipeasy-sdk.rb', line 63 def self.see_violation(name) client = default_client if client.nil? warn "[shipeasy] see_violation() called before a client was created — error dropped" return See::NullChain.new end client.see_violation(name) end |
.set_default_client(client) ⇒ Object
Register the client backing the module-level see() funcs. Called automatically from FlagsClient#initialize; also exposed for explicit use.
42 43 44 45 |
# File 'lib/shipeasy-sdk.rb', line 42 def self.set_default_client(client) @see_default_mutex.synchronize { @see_default_client = client } client end |