It’s all very good documented here for Ruby:
In PHP we implemented this into Drupal in just under 2 hours.