summaryrefslogtreecommitdiff
path: root/lib/api/entities.rb
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2017-06-01 07:25:48 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2017-06-01 07:25:48 +0000
commit3cc138d824df039af2d7dae2ae04c30e98b51af1 (patch)
treee7b16ba807cad3231b69457bcc71ccbb1b74c4ce /lib/api/entities.rb
parent17c926313a242c6ad988a7ffd55aa6330c8aacfd (diff)
parentdd0f8b8ccc3b5f61e31703f7391a919b702934a5 (diff)
downloadgitlab-ce-3cc138d824df039af2d7dae2ae04c30e98b51af1.tar.gz
Merge branch 'master' into '24196-protected-variables'
# Conflicts: # db/schema.rb
Diffstat (limited to 'lib/api/entities.rb')
-rw-r--r--lib/api/entities.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 620e3409d6f..8d9de8c388d 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -754,6 +754,28 @@ module API
expose :impersonation
end
+ class FeatureGate < Grape::Entity
+ expose :key
+ expose :value
+ end
+
+ class Feature < Grape::Entity
+ expose :name
+ expose :state
+ expose :gates, using: FeatureGate do |model|
+ model.gates.map do |gate|
+ value = model.gate_values[gate.key]
+
+ # By default all gate values are populated. Only show relevant ones.
+ if (value.is_a?(Integer) && value.zero?) || (value.is_a?(Set) && value.empty?)
+ next
+ end
+
+ { key: gate.key, value: value }
+ end.compact
+ end
+ end
+
module JobRequest
class JobInfo < Grape::Entity
expose :name, :stage