Class: Zavudev::Resources::Agents::Senders

Inherits:
Object
  • Object
show all
Defined in:
lib/zavudev/resources/agents/senders.rb,
sig/zavudev/resources/agents/senders.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Senders

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Senders.

Parameters:



64
65
66
# File 'lib/zavudev/resources/agents/senders.rb', line 64

def initialize(client:)
  @client = client
end

Instance Method Details

#connect(agent_id, sender_id:, request_options: {}) ⇒ Zavudev::Models::Agents::SenderConnectResponse

Make the agent answer on this sender. An agent can serve several senders; a sender answers with at most one agent, so connecting one that is already in use returns 400 naming the agent that holds it.

Parameters:

  • agent_id (String) —

    Agent ID.

  • sender_id (String) —

    Sender to connect.

  • request_options (Zavudev::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



22
23
24
25
26
27
28
29
30
31
# File 'lib/zavudev/resources/agents/senders.rb', line 22

def connect(agent_id, params)
  parsed, options = Zavudev::Agents::SenderConnectParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["v1/agents/%1$s/senders", agent_id],
    body: parsed,
    model: Zavudev::Models::Agents::SenderConnectResponse,
    options: options
  )
end

#disconnect(sender_id, agent_id:, request_options: {}) ⇒ nil

Stop the agent answering on this sender. The agent's primary sender is part of the agent itself and cannot be disconnected here.

Parameters:

  • sender_id (String)
  • agent_id (String) —

    Agent ID.

  • request_options (Zavudev::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (nil)

See Also:



47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/zavudev/resources/agents/senders.rb', line 47

def disconnect(sender_id, params)
  parsed, options = Zavudev::Agents::SenderDisconnectParams.dump_request(params)
  agent_id =
    parsed.delete(:agent_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: ["v1/agents/%1$s/senders/%2$s", agent_id, sender_id],
    model: NilClass,
    options: options
  )
end