blob: f3699e4d0ee01647eb4c3d6ea8911820e04fbcab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# frozen_string_literal: true
module Atlassian
module JiraConnect
module Serializers
class EnvironmentEntity < Grape::Entity
format_with(:string, &:to_s)
expose :id, format_with: :string
expose :display_name, as: :displayName
expose :type
private
alias_method :environment, :object
delegate :project, to: :object
def display_name
"#{project.name}/#{environment.name}"
end
def type
case environment.name
when /prod/i
'production'
when /test/i
'testing'
when /staging/i
'staging'
when /(dev|review)/i
'development'
else
'unmapped'
end
end
end
end
end
end
|