Class: FloopFloop::Secrets
- Inherits:
-
Object
- Object
- FloopFloop::Secrets
- Defined in:
- lib/floopfloop/secrets.rb
Instance Method Summary collapse
-
#initialize(client) ⇒ Secrets
constructor
A new instance of Secrets.
-
#list(ref) ⇒ Object
Returns the array of { “name” => …, … } — flattens the { “secrets” => […] } wrapper for callers.
- #remove(ref, name) ⇒ Object
- #set(ref, name, value) ⇒ Object
Constructor Details
#initialize(client) ⇒ Secrets
Returns a new instance of Secrets.
5 6 7 |
# File 'lib/floopfloop/secrets.rb', line 5 def initialize(client) @client = client end |
Instance Method Details
#list(ref) ⇒ Object
Returns the array of { “name” => …, … } — flattens the { “secrets” => […] } wrapper for callers.
11 12 13 14 |
# File 'lib/floopfloop/secrets.rb', line 11 def list(ref) data = @client.request("GET", "/api/v1/projects/#{url_encode(ref)}/secrets") data.is_a?(Hash) ? (data["secrets"] || []) : (data || []) end |
#remove(ref, name) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/floopfloop/secrets.rb', line 25 def remove(ref, name) @client.request( "DELETE", "/api/v1/projects/#{url_encode(ref)}/secrets/#{url_encode(name)}", ) nil end |
#set(ref, name, value) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/floopfloop/secrets.rb', line 16 def set(ref, name, value) @client.request( "POST", "/api/v1/projects/#{url_encode(ref)}/secrets", body: { name: name, value: value }, ) nil end |