Module: Equipoise
- Defined in:
- lib/equipoise/util.rb,
lib/equipoise.rb,
lib/equipoise/client.rb,
lib/equipoise/errors.rb,
lib/equipoise/railtie.rb,
lib/equipoise/version.rb,
lib/equipoise/contacts.rb,
lib/equipoise/response.rb,
lib/equipoise/syncable.rb,
lib/equipoise/batch_result.rb,
lib/equipoise/configuration.rb,
lib/equipoise/custom_fields.rb,
lib/generators/equipoise/install_generator.rb
Overview
=============================================================================
Equipoise::CustomFields
Manage a producer's typed custom-field definitions (the schema the producer
owns). Values themselves ride along on a contact sync via
custom_fields: { key: value }; this resource is for declaring/inspecting the
field definitions up front.
declare(key:, field_type:, options:, source:) → POST /custom_fields (upsert)
list(customizable_type:) → GET /custom_fields
get(key) → GET /custom_fields/:key
update(key, label:, …) → PATCH /custom_fields/:key
delete(key, purge_values:) → DELETE /custom_fields/:key
Used by: Equipoise::Client#custom_fields
Defined Under Namespace
Modules: Generators, Syncable, Util Classes: ApiError, AuthenticationError, BatchResult, Client, Configuration, ConfigurationError, ConflictError, ConnectionError, Contacts, CustomFields, Error, ForbiddenError, NotFoundError, Railtie, RateLimitError, Response, ServerError, ValidationError
Constant Summary collapse
- VERSION =
"0.2.0"
Class Method Summary collapse
-
.client ⇒ Object
Memoized default client.
-
.configuration ⇒ Object
The process-wide configuration.
- .configure {|configuration| ... } ⇒ Object
- .configured? ⇒ Boolean
-
.disable! ⇒ Object
Test-mode kill switch.
- .disabled? ⇒ Boolean
- .enable! ⇒ Object
-
.reset! ⇒ Object
Reset global state (used by the test suite's before hook; also handy in a console).
Class Method Details
.client ⇒ Object
Memoized default client. Most callers use this; tests and multi-tenant producers build their own Client with an explicit config.
56 57 58 |
# File 'lib/equipoise.rb', line 56 def client @client ||= Client.new(configuration) end |
.configuration ⇒ Object
The process-wide configuration. Built
lazily from ENV so a bare require "equipoise" is side-effect-free.
44 45 46 |
# File 'lib/equipoise.rb', line 44 def configuration @configuration ||= Configuration.new end |
.configure {|configuration| ... } ⇒ Object
48 49 50 51 52 |
# File 'lib/equipoise.rb', line 48 def configure yield(configuration) if block_given? @client = nil # a re-configure invalidates the memoized client configuration end |
.configured? ⇒ Boolean
60 61 62 |
# File 'lib/equipoise.rb', line 60 def configured? !configuration.api_key.to_s.empty? end |
.disable! ⇒ Object
Test-mode kill switch. Put Equipoise.disable! in
a producer's rails_helper (or set test env) so no spec can make a live call
even if EQUIPOISE_API_KEY leaks into the environment. Calls become no-ops
returning a benign Response.
68 69 70 |
# File 'lib/equipoise.rb', line 68 def disable! configuration.enabled = false end |
.disabled? ⇒ Boolean
76 77 78 |
# File 'lib/equipoise.rb', line 76 def disabled? configuration.disabled? end |
.enable! ⇒ Object
72 73 74 |
# File 'lib/equipoise.rb', line 72 def enable! configuration.enabled = true end |
.reset! ⇒ Object
Reset global state (used by the test suite's before hook; also handy in a console).
82 83 84 85 |
# File 'lib/equipoise.rb', line 82 def reset! @configuration = nil @client = nil end |