Class: Zavudev::Resources::Agents::Senders
- Inherits:
-
Object
- Object
- Zavudev::Resources::Agents::Senders
- Defined in:
- lib/zavudev/resources/agents/senders.rb,
sig/zavudev/resources/agents/senders.rbs
Instance Method Summary collapse
-
#connect(agent_id, sender_id:, request_options: {}) ⇒ Zavudev::Models::Agents::SenderConnectResponse
Make the agent answer on this sender.
-
#disconnect(sender_id, agent_id:, request_options: {}) ⇒ nil
Stop the agent answering on this sender.
-
#initialize(client:) ⇒ Senders
constructor
private
A new instance of Senders.
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.
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.
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, = 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: ) 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.
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, = 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: ) end |