How we used Ruby to deliver integration layer with reservation systems - case study

Paweł Muszyński - Senior Ruby on Rails Developer

Ruby is long known for its versatility and reliability. One of Ruby’s many use cases and something we can find in most of the projects is integration with external services via a provided API. In this case study, we’ll go through the details of a project where we built an external API integration for a camping platform.

The challenge

Our client provides web and mobile apps that help travelers find campsites around the US. Our task was to enable real estate owners who had already been using a Property Management System to list their estates for rent in the client’s app.

In order to achieve that we needed to integrate the client’s application with Property Management Systems. In technical terms, our job was to enable storing certain properties in our database and using them to make reservations of properties.

At first sight, the task sounded clear and pretty straightforward. We’d have to fetch the data, apply some operations, and add push requests to external APIs to claim reservations. However, we also realized that we’d have to find a way to keep static data on our side and ensure consistency between our database and the external service.

Storing static data in our database

We had to encode the data that was sent to and received from API endpoints. The static data consisted of predefined dictionary values used by PMSs, such as a list of property types, amenities, etc. But apart from fetching this data, we had to bear in mind that it will change and therefore be updated.

Even though storing the data in the database and updating it regularly may seem like the best and simplest solution, in this case, we decided to cache the data in Redis. Why? The speed – of processing data in the cache memory is much more time-effective than processing the same data from other storage solutions.

At the same time, the documentation suggests updating static data every 3 months, and we wanted to have the possibility to adjust the data expiration time based on our client’s business needs.

Keeping consistency between our and the external databases

The second challenge we were facing – the one related to ensuring data consistency between the databases – was more interesting for our team. The business requirement for the application was to have information about a campsite’s availability in a requested date range and the price for a selected period. The information in our database had to match the corresponding data in the PMS.

Theoretically, we could schedule some workers to check for updates regularly, for example, every hour, and that way we would keep our database updated – but that’s not enough. The reality of the travel industry is much more dynamic than that. In one hour, a property could be double-booked, the price could have changed, etc. Therefore, providing updated information and double-checking it right before substantial operations, such as booking a cabin or an RV, was essential.

The Property Management Systems we were working with, provided live notification systems. We implemented a feature based on these PMS updates. After subscribing to them, our app received messages about whether the data was up to the minute or it had changed. We saved each message that came to our system and then called Sidekiq workers that consumed that message and updated or created records based on the data from the relevant message.

External API implementation - 3 things to consider

API integrations help drive revenue across many high-performance businesses by keeping data in sync, enhancing productivity, and enabling revenue generation. Based on our experience in this and our other projects, we came up with a list of three important aspects to consider when dealing with an external API implementation:

  1. Get familiar with the API documentation and carefully assess its possibilities. Well-written documentation should answer most of your questions and provide you with the information you need to make decisions about whether it’s the right choice for your need.
  2. Prepare a data parsing mechanism to make sure that the received data strings get converted into the right type of data.
  3. Think which data could be stored in the cache.

Need a hand in an API integration?

At iRonin.IT, we have a number of years under our belt integrating our client’s products with external services via APIs. Contact us to cut down your software development time and budget by integrating with external API systems.

Let’s get in touch
Author's Bio
Paweł Muszyński

Senior Ruby on Rails Developer

A developer focused mainly on Ruby, but also a huge frontend fan. Self-development is what makes me a better programmer. Seeing that my code is getting more and more qualitative every day makes my daily work even more satisfying.

Similar articles

Bulletproof your development with remote team augmentation

Read how
This page is best viewed in portrait mode
Our websites and web services use cookies. We use cookies and collected data to enhance your experience, provide additional communication channels, improve marketing materials and enhance our offer. IRONIN SP. Z O.O. SP. K. is committed to protecting all the data that we collect or process in any way, especially data of personal nature. By accepting these terms you agree to our usage of cookies and processing your data, according to our Privacy Policy, and you declare that your browser settings reflect your preferences. Read more You have the right to revoke this agreement at any time, based on the terms of our Privacy Policy. You can change cookies settings in your browser. If you do not agree with us using cookies and processing your data, please change your cookies settings in your web browser and reject these terms. You can find more information about cookies, your data privacy This site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies. data processing, and your rights in our Privacy Policy.