Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'qa/qa/resource/group_ci_variable.rb')
-rw-r--r--qa/qa/resource/group_ci_variable.rb47
1 files changed, 47 insertions, 0 deletions
diff --git a/qa/qa/resource/group_ci_variable.rb b/qa/qa/resource/group_ci_variable.rb
new file mode 100644
index 00000000000..f78d11b6c11
--- /dev/null
+++ b/qa/qa/resource/group_ci_variable.rb
@@ -0,0 +1,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