
This adds API V3 endpoints for querying, creating, modifying and
deleting environment variables.
It has no concept of encryption yet and should be considered a work in
progress.
We should also talk about the slightly off-track approach in the
EnvVars::Create service – maybe there's a way to standardise the
querying and rendering for post requests?
☕
14 lines
443 B
Ruby
14 lines
443 B
Ruby
module Travis::API::V3
|
|
class Services::EnvVars::Create < Service
|
|
params :id, prefix: :repository
|
|
params :id, :name, :value, :public, prefix: :env_var
|
|
|
|
def run!
|
|
raise LoginRequired unless access_control.logged_in? or access_control.full_access?
|
|
raise NotFound unless repository = find(:repository)
|
|
env_var = query(:env_vars).create(repository)
|
|
result(:env_var, env_var, status: 201)
|
|
end
|
|
end
|
|
end
|