Class: Ribbon::Intercom::Client
- Inherits:
-
Object
- Object
- Ribbon::Intercom::Client
- Defined in:
- lib/ribbon/intercom/client.rb,
lib/ribbon/intercom/client/sdk.rb,
lib/ribbon/intercom/client/mock_sdk.rb
Defined Under Namespace
Instance Method Summary collapse
- #[](handle) ⇒ Object
- #config(&block) ⇒ Object
-
#mock_safe ⇒ Object
Return a mock safe version of this client.
- #preload_sdks ⇒ Object
Instance Method Details
#[](handle) ⇒ Object
16 17 18 |
# File 'lib/ribbon/intercom/client.rb', line 16 def [](handle) _load_sdk(handle) end |
#config(&block) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/ribbon/intercom/client.rb', line 8 def config(&block) (@__config ||= Ribbon::Config.new).tap { |config| if block_given? config.define(&block) end } end |
#mock_safe ⇒ Object
Return a mock safe version of this client.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ribbon/intercom/client.rb', line 22 def mock_safe dup.tap { |client| client.preload_sdks # Make SDK instances mock safe client.sdk_instances = Hash[ client.sdk_instances.map { |service, sdk| [service, sdk.mock_safe] } ] } end |
#preload_sdks ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/ribbon/intercom/client.rb', line 33 def preload_sdks if config.service? config.service.each { |name, *args| _load_sdk(name) } end end |