Class: RailsMarkup::External::AnnotationsController

Inherits:
ActionController::API
  • Object
show all
Defined in:
app/controllers/rails_markup/external/annotations_controller.rb

Instance Method Summary collapse

Instance Method Details

#acknowledgeObject

PATCH /external/:id/acknowledge



25
26
27
28
# File 'app/controllers/rails_markup/external/annotations_controller.rb', line 25

def acknowledge
  @annotation.acknowledge!
  render json: @annotation.as_api_json
end

#dismissObject

PATCH /external/:id/dismiss



37
38
39
40
# File 'app/controllers/rails_markup/external/annotations_controller.rb', line 37

def dismiss
  @annotation.dismiss!(reason: params[:reason])
  render json: @annotation.as_api_json
end

#pendingObject

GET /external/pending



14
15
16
17
# File 'app/controllers/rails_markup/external/annotations_controller.rb', line 14

def pending
  annotations = Annotation.pending.recent.limit(50)
  render json: { annotations: annotations.map(&:as_api_json) }
end

#replyObject

PATCH /external/:id/reply



43
44
45
46
47
48
# File 'app/controllers/rails_markup/external/annotations_controller.rb', line 43

def reply
  return render json: { error: "message is required" }, status: :unprocessable_entity if params[:message].blank?

  @annotation.add_reply!(message: params[:message], role: "agent")
  render json: @annotation.as_api_json
end

#resolveObject

PATCH /external/:id/resolve



31
32
33
34
# File 'app/controllers/rails_markup/external/annotations_controller.rb', line 31

def resolve
  @annotation.resolve!(summary: params[:summary])
  render json: @annotation.as_api_json
end

#showObject

GET /external/:id



20
21
22
# File 'app/controllers/rails_markup/external/annotations_controller.rb', line 20

def show
  render json: @annotation.as_api_json
end