diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-06-02 20:32:02 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-06-02 20:32:02 +0200 |
commit | 0383b4822562005e20cdda80bca20a5fc11e9f8f (patch) | |
tree | 9f6bdaea50d256ecf58f9ccfd49198019897a196 /lib/api/variables.rb | |
parent | b24651826f249cd1fcbd87d097c42488d0472611 (diff) | |
parent | 11852e16387790c26be7b8d1dd99ed689bf9d45b (diff) | |
download | gitlab-ce-0383b4822562005e20cdda80bca20a5fc11e9f8f.tar.gz |
Merge remote-tracking branch 'origin/master' into zj-job-view-goes-real-time
Diffstat (limited to 'lib/api/variables.rb')
-rw-r--r-- | lib/api/variables.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/api/variables.rb b/lib/api/variables.rb index 5acde41551b..381c4ef50b0 100644 --- a/lib/api/variables.rb +++ b/lib/api/variables.rb @@ -42,6 +42,7 @@ module API params do requires :key, type: String, desc: 'The key of the variable' requires :value, type: String, desc: 'The value of the variable' + optional :protected, type: String, desc: 'Whether the variable is protected' end post ':id/variables' do variable = user_project.variables.create(declared(params, include_parent_namespaces: false).to_h) @@ -59,13 +60,14 @@ module API params do optional :key, type: String, desc: 'The key of the variable' optional :value, type: String, desc: 'The value of the variable' + optional :protected, type: String, desc: 'Whether the variable is protected' end put ':id/variables/:key' do variable = user_project.variables.find_by(key: params[:key]) return not_found!('Variable') unless variable - if variable.update(value: params[:value]) + if variable.update(declared_params(include_missing: false).except(:key)) present variable, with: Entities::Variable else render_validation_error!(variable) |