Module: Legion::Extensions::Rfp::Review::Runners::Comments

Extended by:
Helpers::Client
Includes:
Helpers::Lex
Included in:
Client
Defined in:
lib/legion/extensions/rfp/review/runners/comments.rb

Instance Method Summary collapse

Methods included from Helpers::Client

client

Instance Method Details

#add_comment(workflow_id:, section_name:, author:, body:, type: :general) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/legion/extensions/rfp/review/runners/comments.rb', line 11

def add_comment(workflow_id:, section_name:, author:, body:, type: :general, **)
  comment = {
    id:          generate_comment_id,
    workflow_id: workflow_id,
    section:     section_name,
    author:      author,
    body:        body,
    type:        type.to_sym,
    created_at:  Time.now.iso8601
  }
  { result: comment }
end

#list_comments(workflow_id:, section_name: nil) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/legion/extensions/rfp/review/runners/comments.rb', line 24

def list_comments(workflow_id:, section_name: nil, **)
  {
    result:      [],
    workflow_id: workflow_id,
    section:     section_name,
    error:       'Persistence requires legion-data'
  }
end

#request_revision(workflow_id:, section_name:, author:, reason:) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/legion/extensions/rfp/review/runners/comments.rb', line 44

def request_revision(workflow_id:, section_name:, author:, reason:, **)
  comment = add_comment(
    workflow_id:  workflow_id,
    section_name: section_name,
    author:       author,
    body:         reason,
    type:         :revision_request
  )

  {
    result: {
      comment:     comment[:result],
      section:     section_name,
      new_status:  :revision_requested,
      workflow_id: workflow_id
    }
  }
end

#resolve_comment(comment_id:, resolved_by:) ⇒ Object



33
34
35
36
37
38
39
40
41
42
# File 'lib/legion/extensions/rfp/review/runners/comments.rb', line 33

def resolve_comment(comment_id:, resolved_by:, **)
  {
    result: {
      id:          comment_id,
      resolved:    true,
      resolved_by: resolved_by,
      resolved_at: Time.now.iso8601
    }
  }
end