blob: f78d11b6c1112c8d85969c157271da83092fc867 (
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
|
# frozen_string_literal: true
module QA
module Resource
class GroupCiVariable < Base
attr_accessor :key, :value, :masked, :protected
attribute :group do
QA::Resource::Group.fabricate_via_api!
end
def initialize
@masked = false
@protected = false
end
def fabricate_via_api!
resource_web_url(api_get)
rescue ResourceNotFoundError
super
end
def resource_web_url(resource)
super
rescue ResourceURLMissingError
# this particular resource does not expose a web_url property
end
def api_get_path
"/groups/#{group.id}/variables/#{key}"
end
def api_post_path
"/groups/#{group.id}/variables"
end
def api_post_body
{
key: key,
value: value,
masked: masked,
protected: protected
}
end
end
end
end
|