Class: SchwarmCli::Client::SharedAgents

Inherits:
Resource
  • Object
show all
Defined in:
lib/schwarm_cli/client/shared_agents.rb

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from SchwarmCli::Client::Resource

Instance Method Details

#create(**attributes) ⇒ Object



15
16
17
# File 'lib/schwarm_cli/client/shared_agents.rb', line 15

def create(**attributes)
  post("/api/v2/shared_agents", { shared_agent: attributes }).body
end

#destroy(id) ⇒ Object



23
24
25
26
# File 'lib/schwarm_cli/client/shared_agents.rb', line 23

def destroy(id)
  delete("/api/v2/shared_agents/#{id}")
  nil
end

#find(id) ⇒ Object



11
12
13
# File 'lib/schwarm_cli/client/shared_agents.rb', line 11

def find(id)
  get("/api/v2/shared_agents/#{id}").body
end

#list(query: nil, page: nil, per_page: nil) ⇒ Object



6
7
8
9
# File 'lib/schwarm_cli/client/shared_agents.rb', line 6

def list(query: nil, page: nil, per_page: nil)
  params = { q: query, page:, per_page: }.compact
  get("/api/v2/shared_agents", params).body
end

#toggle(id) ⇒ Object



28
29
30
# File 'lib/schwarm_cli/client/shared_agents.rb', line 28

def toggle(id)
  post("/api/v2/shared_agents/#{id}/toggle").body
end

#update(id, **attributes) ⇒ Object



19
20
21
# File 'lib/schwarm_cli/client/shared_agents.rb', line 19

def update(id, **attributes)
  patch("/api/v2/shared_agents/#{id}", { shared_agent: attributes }).body
end