Class: PairProgrammer::Api::Coder

Inherits:
Object
  • Object
show all
Defined in:
lib/pairprogrammer/api/coder.rb

Class Method Summary collapse

Class Method Details

.add_user_message(id, message) ⇒ Object



44
45
46
47
48
49
50
# File 'lib/pairprogrammer/api/coder.rb', line 44

def self.add_user_message(id, message)
    body = {
        id: id,
        message: message
    }
    Client.new.post('/api/v1/coder/user_message', body)
end

.append_exception(id, e) ⇒ Object



52
53
54
55
56
57
58
59
# File 'lib/pairprogrammer/api/coder.rb', line 52

def self.append_exception(id, e)
    body = {
        exception: e.class.to_s,
        exception_message: e.message,
        id: id
    }
    Client.new.post('/api/v1/coder/append_exception', body)
end

.append_output(id, output) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/pairprogrammer/api/coder.rb', line 32

def self.append_output(id, output)
    body = {
        id: id,
        output: output
    }
    Client.new.post('/api/v1/coder/append_output', body)
end

.create(tasks, context, requirements) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/pairprogrammer/api/coder.rb', line 6

def self.create(tasks, context, requirements)
    body = {
        tasks: tasks,
        context: context,
        requirements: requirements,
    }
    response = Client.new.post('/api/v1/coder', body)
    response["id"]
end

.create_from_planner(planner_id) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/pairprogrammer/api/coder.rb', line 16

def self.create_from_planner(planner_id)
    body = {
        from_planner: true,
        planner_id: planner_id
    }
    response = Client.new.post('/api/v1/coder', body)
    response["id"]
end

.listObject



40
41
42
# File 'lib/pairprogrammer/api/coder.rb', line 40

def self.list
    Client.new.get('/api/v1/coder/list', {})
end

.run(id) ⇒ Object



25
26
27
28
29
30
# File 'lib/pairprogrammer/api/coder.rb', line 25

def self.run(id)
    body = {
        id: id
    }
    Client.new.post('/api/v1/coder/run', body)
end