Rapidly Mapping API Schemas in Ruby

Adam Cuppy

 Abstract

Whether you are using a 3rd party or custom JSON API service, integration into an existing application can be time consuming: Where do you start? How can you build an object relational model that can adapt to changes in the schema?

Description

Whether you are using a 3rd party or custom JSON API service, integration into an existing application can be time consuming: Where do you start? How can you build an object relational model that can adapt to changes in the schema?

In this talk we’ll start with an existing JSON schema and build a Ruby adapter to provide a pure Ruby interface to: consume, modify and re-export that schema into JSON and XML.

Notes

Following the Google Civic API, we will start with a base RubyGem. We are going to setup a fixture of the JSON schema, provided at https://developers.google.com/civic-information/docs/using_api. I’m going to walk through steps for:

  • Integrating RESTful interface;
  • Parsing the payload for root nodes, has many and belongs to relationships, side-loading;
  • How to keep objects flexible and handle errors when there are changes to the schema;
  • Integrating the authentication tokens; and,
  • Developing a base adapter for other types of representations (i.e.: XML, YAML, etc…)
  • Gems being used during the talk: ** Faraday ** Webmock ** MultiJson ** RSpec ** Representable

At the end of the talk, they should have a strong understanding of how to integrate new public or private APIs into their applications using a object oriented Ruby based interface.

The intended audience is Intermediate level developers who maintain applications that would be using public or private API services.

Edit proposal