• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ninoseki / mihari / 7248022748

18 Dec 2023 12:25PM UTC coverage: 93.908% (-0.6%) from 94.504%
7248022748

push

github

web-flow
Merge pull request #880 from ninoseki/renew-service-classess-commands

refactor: renew service classes & comamnds

73 of 100 new or added lines in 12 files covered. (73.0%)

1 existing line in 1 file now uncovered.

3376 of 3595 relevant lines covered (93.91%)

84.14 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

65.0
/lib/mihari/web/endpoints/tags.rb
1
# frozen_string_literal: true
2

3
module Mihari
4✔
4
  module Web
4✔
5
    module Endpoints
4✔
6
      #
7
      # Tag API endpoint
8
      #
9
      class Tags < Grape::API
4✔
10
        namespace :tags do
4✔
11
          desc "List tags", {
8✔
12
            is_array: true,
13
            success: Entities::Tags,
14
            summary: "List tags"
15
          }
16
          get "/" do
8✔
17
            tags = Mihari::Models::Tag.distinct.pluck(:name)
8✔
18
            present({ tags: tags }, with: Entities::Tags)
8✔
19
          end
20

21
          desc "Delete a tag", {
8✔
22
            success: { code: 204, model: Entities::Message },
23
            failure: [{ code: 404, model: Entities::Message }],
24
            summary: "Delete a tag"
25
          }
26
          params do
8✔
27
            requires :id, type: Integer
8✔
28
          end
29
          delete "/:id" do
8✔
30
            status 204
×
31

32
            id = params[:id].to_i
×
NEW
33
            result = Services::TagDestroyer.result(id)
×
34
            return present({ message: "" }, with: Entities::Message) if result.success?
×
35

36
            case result.failure
×
37
            when ActiveRecord::RecordNotFound
38
              error!({ message: "ID:#{id} is not found" }, 404)
×
39
            end
40
            raise result.failure
×
41
          end
42
        end
43
      end
44
    end
45
  end
46
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc