Class: SchwarmCli::Client::RepositoryAgents

Inherits:
Resource
  • Object
show all
Defined in:
lib/schwarm_cli/client/repository_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/repository_agents.rb', line 15

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

#destroy(id) ⇒ Object



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

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

#find(id) ⇒ Object



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

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

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



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

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

#run_now(id) ⇒ Object



32
33
34
# File 'lib/schwarm_cli/client/repository_agents.rb', line 32

def run_now(id)
  post("/api/v2/repository_agents/#{id}/run_now").body
end

#toggle(id) ⇒ Object



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

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

#update(id, **attributes) ⇒ Object



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

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