diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2017-06-01 07:25:48 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2017-06-01 07:25:48 +0000 |
commit | 3cc138d824df039af2d7dae2ae04c30e98b51af1 (patch) | |
tree | e7b16ba807cad3231b69457bcc71ccbb1b74c4ce /lib/api/entities.rb | |
parent | 17c926313a242c6ad988a7ffd55aa6330c8aacfd (diff) | |
parent | dd0f8b8ccc3b5f61e31703f7391a919b702934a5 (diff) | |
download | gitlab-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.rb | 22 |
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 |