This is a client to consume data from microservices built upon APIcasso. It makes PORO classes supercharged by injecting Rails-like behavior through the methods:
find()
all()
where()
save
Instead of translating those calls into ORM APIcasso Brush retrieves it's data from your configured service. This makes it possible to make a convergent application, that gets data from multiple API sources.
To start consuming from your services just create a class inheriting from Apicasso::Brush
and declare how APIcasso should stroke the brush. First declare the base for current class, which is a index action from your API for the given resource, then pass a token that has access into that resource.
class ModelFromService < Apicasso::Brush
brush_on 'http://my.service.com/model',
token: '5e1057e7a51ee7a55',
include: :a_relation, :a_method # Optional
end
You can also by default include relations or methods that should get built into your ModelFromService
objects.
Add this line to your application's Gemfile:
gem 'apicasso_brush'
And then execute:
$ bundle
Or install it yourself as:
$ gem install apicasso_brush
The gem is available as open source under the terms of the MIT License.