Method: Appwrite::Functions#update_variable

Defined in:
lib/appwrite/services/functions.rb

#update_variable(function_id:, variable_id:, key:, value: nil) ⇒ Variable

Update variable by its unique ID.

Parameters:

  • function_id (String)

    Function unique ID.

  • variable_id (String)

    Variable unique ID.

  • key (String)

    Variable key. Max length: 255 chars.

  • value (String) (defaults to: nil)

    Variable value. Max length: 8192 chars.

Returns:

  • (Variable)


877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
# File 'lib/appwrite/services/functions.rb', line 877

def update_variable(function_id:, variable_id:, key:, value: nil)
    api_path = '/functions/{functionId}/variables/{variableId}'
        .gsub('{functionId}', function_id)
        .gsub('{variableId}', variable_id)

    if function_id.nil?
      raise Appwrite::Exception.new('Missing required parameter: "functionId"')
    end

    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

    api_params = {
        key: key,
        value: value,
    }
    
    api_headers = {
        "content-type": 'application/json',
    }

    @client.call(
        method: 'PUT',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::Variable
    )
end