The Ruby and Rails community linklog
Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!
Submit a post
Note: Only the first pargraph is shown on the front page and overly long paragraphs may be broken up.
In this post we’ll get started building a simple chatbot that can respond to different keywords over WhatsApp, sending back pictures about dogs or cats based on the message you send it. We’ll use Sinatra and the Twilio API for WhatsApp to build ourselves a chatbot.
Firing off one request is not enough to interact with APIs in production. If you are not willing to add the boilerplate code to add the necessary robustness - please use a library [more inside]
We’ve all worked with tightly-coupled code. If a butterfly flaps its wings in China, the unit tests break. Maintaining a system like this is…unpleasant. In this article, Jonathan Miles dives into the origins of tight-coupling. He demonstrates how you can use dependency injection (DI) to decouple code. Then he introduces a novel decoupling technique based on delegation that can be useful when DI is not an option. https://www.honeybadger.io/blog/decoupling-ruby-delegation-dependency-injection/
Hello, I’ve put together a new date formatter gem that lets you format dates e.g. “January 02, 2006” using an example as a format string e.g “January 02, 2006” instead of the classic strftime format specifier e.g. “%B %d, %Y”. The date by example adds: String#to_strfime, Date#format, Time#format, DateTime#format, NilClass#format to the built-in classes for easy use. Happy date and time formatting. Cheers. Prost.
https://github.com/igorkasyanchuk/fake_api this gem I 100% sure is the fastest way how you can build an API in your Rails application. See the demo in the readme!