Wrapping Rest APIs with Ruby

At PipelineDeals, we have a growing number of satellite apps—we still have one main monolithic Rails app (which we’ve started calling p.core), but ever so slowly, we have ported bits & pieces of functionality out to smaller, separate apps. These apps communicate with p.core and each other in a couple of ways: A pubsub messaging system we built ourselves Our own APIs! Essentially, our main Rails app (p.core) broadcasts events that happen in the system to any satellite app that pays attention. So, for instance, if a person’s email address was updated, we would send a pubsub message like person:updated:123456 and the payload would include information about the attributes that changed. Conversely, when a satellite app needs to make a change to a model in p.core, the satellite app will use our public api to write changes. When using our own APIs, we’ve grown into a pattern for wrapping them with Ruby classes that feels very clean and predictable to us. »