Class: Appwrite::Project
- Defined in:
- lib/appwrite/services/project.rb
Instance Method Summary collapse
-
#create_variable(variable_id:, key:, value:, secret: nil) ⇒ Variable
Create a new project environment variable.
-
#delete_variable(variable_id:) ⇒ Object
Delete a variable by its unique ID.
-
#get_variable(variable_id:) ⇒ Variable
Get a variable by its unique ID.
-
#initialize(client) ⇒ Project
constructor
A new instance of Project.
-
#list_variables(queries: nil, total: nil) ⇒ VariableList
Get a list of all project environment variables.
-
#update_variable(variable_id:, key: nil, value: nil, secret: nil) ⇒ Variable
Update variable by its unique ID.
Constructor Details
#initialize(client) ⇒ Project
Returns a new instance of Project.
6 7 8 |
# File 'lib/appwrite/services/project.rb', line 6 def initialize(client) @client = client end |
Instance Method Details
#create_variable(variable_id:, key:, value:, secret: nil) ⇒ Variable
Create a new project environment variable. These variables can be accessed by all functions and sites in the project.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/appwrite/services/project.rb', line 45 def create_variable(variable_id:, key:, value:, secret: nil) api_path = '/project/variables' if variable_id.nil? raise Appwrite::Exception.new('Missing required parameter: "variableId"') end if key.nil? raise Appwrite::Exception.new('Missing required parameter: "key"') end if value.nil? raise Appwrite::Exception.new('Missing required parameter: "value"') end api_params = { variableId: variable_id, key: key, value: value, secret: secret, } api_headers = { "content-type": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::Variable ) end |
#delete_variable(variable_id:) ⇒ Object
Delete a variable by its unique ID.
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/appwrite/services/project.rb', line 148 def delete_variable(variable_id:) api_path = '/project/variables/{variableId}' .gsub('{variableId}', variable_id) if variable_id.nil? raise Appwrite::Exception.new('Missing required parameter: "variableId"') end api_params = { } api_headers = { "content-type": 'application/json', } @client.call( method: 'DELETE', path: api_path, headers: api_headers, params: api_params, ) end |
#get_variable(variable_id:) ⇒ Variable
Get a variable by its unique ID.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/appwrite/services/project.rb', line 85 def get_variable(variable_id:) api_path = '/project/variables/{variableId}' .gsub('{variableId}', variable_id) if variable_id.nil? raise Appwrite::Exception.new('Missing required parameter: "variableId"') end api_params = { } api_headers = { } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::Variable ) end |
#list_variables(queries: nil, total: nil) ⇒ VariableList
Get a list of all project environment variables.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/appwrite/services/project.rb', line 16 def list_variables(queries: nil, total: nil) api_path = '/project/variables' api_params = { queries: queries, total: total, } api_headers = { } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::VariableList ) end |
#update_variable(variable_id:, key: nil, value: nil, secret: nil) ⇒ Variable
Update variable by its unique ID.
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/appwrite/services/project.rb', line 116 def update_variable(variable_id:, key: nil, value: nil, secret: nil) api_path = '/project/variables/{variableId}' .gsub('{variableId}', variable_id) if variable_id.nil? raise Appwrite::Exception.new('Missing required parameter: "variableId"') end api_params = { key: key, value: value, secret: secret, } api_headers = { "content-type": 'application/json', } @client.call( method: 'PUT', path: api_path, headers: api_headers, params: api_params, response_type: Models::Variable ) end |