This Rails engine provides utility for creating models & controllers that can easily speak to each other between all the SublimeVideo web apps.
Depends on her
, responders
& kaminari
gems.
- Include
SublimeVideoPrivateApi::Model
in your model - Define the app that holds the records with
uses_private_api :app_subdomain
class Foo
include SublimeVideoPrivateApi::Model
uses_private_api :www # SV app subdomain where model is located.
end
Add your controllers in app/controllers/private_api/
this way:
class PrivateApi::FoosController < SublimeVideoPrivateApiController
def index
expires_in 2.minutes, public: true # enable caching
@foos = Foo.page(params[:page])
respond_with(@foos)
end
def show
expires_in 2.minutes, public: true # enable caching
@foo = Foo.find(params[:id])
respond_with(@foo) if stale?(@foo)
end
# ...
end
and in your config/routes.rb
:
namespace :private_api do
resources :foos
end
Deployment to http://gemfury.com
Update VERSION
in lib/sublime_video_layout/version.rb
to X.Y.Z
and then run the following commands:
$ bi
$ be rake build
sublime_video_private_api X.Y.Z built to pkg/sublime_video_private_api-X.Y.Z.gem
$ be fury push pkg/sublime_video_private_api-X.Y.Z.gem
Copyright (c) 2010 - 2013 Jilion(r) - SublimeVideo and Jilion are registered trademarks.