Our great sponsors
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
My goal was to convert an existing, simple Ruby project to Crystal. I didn't have to look far, once I realized Skookum already had a decent-sized Ruby Client API library for the BambooHR API, called Bamboozled. After looking through the project, I was confident it would serve my purpose. And not longer afterward, bamboozled-cr was born.
Like every project you pick up, first understanding how it works is paramount. After a while of reading the Bamboozled source code, I started to put together the basics for my Crystal port. Most of the code is pretty similar to how the Ruby gem works, with the exception of the initial class structure. I tried to keep the library API as close to the original, but made improvements where it made sense.
Crystal provides a built-in test runner and a fully-featured spec library, inspired by Rspec. I tried out the built-in spec library, and it worked pretty well, but found myself reaching for more of what I was used to from the actual Rspec gem. This led me to discover the Spectator shard, which provided most of the Rspec helpers I was used to and made me feel much more productive. I definitely recommend it!
This is somewhat dated now, but when I first started at Method (Skookum at the time), I attended a virtual conference for the Crystal programming language. Afterwards, I presented to Method a quick introduction of the language and some key points from the conference. One of my points was to try Crystal out by converting a Ruby project. My reasoning was because the two languages are so similar, it would be easier to reuse what's already be done and just adopt the missing parts. This post is the result of that reasoning...