Class: Leash::Integrations::Caller

Inherits:
Object
  • Object
show all
Defined in:
lib/leash/integrations/base.rb

Overview

Generic escape hatch — call any provider action without a typed wrapper. Returned by ‘leash.integrations.provider(name)`.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(transport, name) ⇒ Caller

Returns a new instance of Caller.



30
31
32
33
# File 'lib/leash/integrations/base.rb', line 30

def initialize(transport, name)
  @transport = transport
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



43
44
45
# File 'lib/leash/integrations/base.rb', line 43

def name
  @name
end

Instance Method Details

#call(action, body: nil) ⇒ Object

Invoke ‘<provider>/<action>` with an optional JSON body.

Parameters:

  • action (String)

    the wire action (e.g. ‘’post_message’‘)

  • body (Hash, nil) (defaults to: nil)

    JSON body forwarded to the platform



39
40
41
# File 'lib/leash/integrations/base.rb', line 39

def call(action, body: nil)
  @transport.call(@name, action, body)
end