Class: Meerkat::Resources::Tasks

Inherits:
Base
  • Object
show all
Defined in:
lib/meerkat/resources/tasks.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Meerkat::Resources::Base

Instance Method Details

#create(**attributes) ⇒ Object



20
21
22
# File 'lib/meerkat/resources/tasks.rb', line 20

def create(**attributes)
  client.post("/tasks", body: { task: attributes })
end

#delete(id, permanent: false) ⇒ Object



32
33
34
# File 'lib/meerkat/resources/tasks.rb', line 32

def delete(id, permanent: false)
  client.delete("/tasks/#{id}", params: { permanent: permanent })
end

#events(id, limit: nil) ⇒ Object



52
53
54
# File 'lib/meerkat/resources/tasks.rb', line 52

def events(id, limit: nil)
  client.get("/tasks/#{id}/events", params: { limit: limit }.compact)
end

#list(task_type: nil, status: nil, include_archived: nil, limit: nil, offset: nil) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/meerkat/resources/tasks.rb', line 6

def list(task_type: nil, status: nil, include_archived: nil, limit: nil, offset: nil)
  client.get("/tasks", params: {
    task_type: task_type,
    status: status,
    include_archived: include_archived,
    limit: limit,
    offset: offset
  }.compact)
end

#pause(id) ⇒ Object



40
41
42
# File 'lib/meerkat/resources/tasks.rb', line 40

def pause(id)
  client.post("/tasks/#{id}/pause")
end

#replace(id, **attributes) ⇒ Object



28
29
30
# File 'lib/meerkat/resources/tasks.rb', line 28

def replace(id, **attributes)
  client.put("/tasks/#{id}", body: { task: attributes })
end

#resume(id) ⇒ Object



44
45
46
# File 'lib/meerkat/resources/tasks.rb', line 44

def resume(id)
  client.post("/tasks/#{id}/resume")
end

#retrieve(id) ⇒ Object



16
17
18
# File 'lib/meerkat/resources/tasks.rb', line 16

def retrieve(id)
  client.get("/tasks/#{id}")
end

#run(id, async: true) ⇒ Object



36
37
38
# File 'lib/meerkat/resources/tasks.rb', line 36

def run(id, async: true)
  client.post("/tasks/#{id}/run", params: { async: async })
end

#runs(id, limit: nil) ⇒ Object



48
49
50
# File 'lib/meerkat/resources/tasks.rb', line 48

def runs(id, limit: nil)
  client.get("/tasks/#{id}/runs", params: { limit: limit }.compact)
end

#update(id, **attributes) ⇒ Object



24
25
26
# File 'lib/meerkat/resources/tasks.rb', line 24

def update(id, **attributes)
  client.patch("/tasks/#{id}", body: { task: attributes })
end