I am using a Clear bit gem. How do I call the external API in the Rails application and send data back forth without the default database to store data.I need to build a form like the Clear bit form and send data back and forth.Do I need a controller and model for the same?
            Asked
            
        
        
            Active
            
        
            Viewed 4,160 times
        
    1 Answers
6
            To call any external url, you should require rest-client gem.
url = "https://...."
body = RestClient.get(url)
JSON.parse(body)
You have to check the rest-client documentation
 
    
    
        Roc Khalil
        
- 1,365
- 6
- 22
- 
                    @neilmartis you need to do it using AJAX requests; you'll need to connect to clearbit using $.ajax (javascript code) that calls the rails code which will return the result to the javascript code - then you'll check whether the user's info is returned or not. Check this link for Async Ajax calls http://stackoverflow.com/questions/18366118/when-to-use-async-false-and-async-true-in-ajax-function-in-jquery and this one to check if the user stopped typing http://stackoverflow.com/questions/4220126/run-javascript-function-when-user-finishes-typing-instead-of-on-key-up – Roc Khalil Feb 26 '17 at 08:18
