
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?
☕
22 lines
427 B
Ruby
22 lines
427 B
Ruby
module Travis::API::V3
|
|
class Queries::EnvVar < Query
|
|
params :id, :name, :value, :public, prefix: :env_var
|
|
|
|
def find(repository)
|
|
repository.env_vars.find(id)
|
|
end
|
|
|
|
def update(repository)
|
|
if env_var = find(repository)
|
|
env_var.update(env_var_params)
|
|
repository.save!
|
|
env_var
|
|
end
|
|
end
|
|
|
|
def delete(repository)
|
|
repository.env_vars.destroy(id)
|
|
end
|
|
end
|
|
end
|