blob: 3719b502b9348ebbfa77ff0c06c42d4c1399283b (
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# frozen_string_literal: true
module QA
module Resource
class GroupBadge < Base
attributes :id,
:name,
:link_url,
:image_url,
:group
# API get path
#
# @return [String]
def api_get_path
"/groups/#{CGI.escape(group.full_path)}/badges/#{id}"
end
# API post path
#
# @return [String]
def api_post_path
"/groups/#{CGI.escape(group.full_path)}/badges"
end
# Params for label creation
#
# @return [Hash]
def api_post_body
{
link_url: link_url,
image_url: image_url
}
end
# Override base method as this particular resource does not expose a web_url property
#
# @param [Hash] resource
# @return [String]
def resource_web_url(_resource); end
protected
# Return subset of fields for comparing badges
#
# @return [Hash]
def comparable
reload! unless api_response
api_response.slice(
:name,
:link_url,
:image_url
)
end
end
end
end
|