# CRP The **C**entral **R**eview **P**latform is a platform to review user uploaded data. This gem wraps the CRP API in a more Ruby like syntax. ## Installation The CRP gem is Ruby 1.9.x and 2.0.x compatible and hosted on [RubyGems](https://rubygems.org/gems/crp). Add this line to your application's Gemfile: gem 'crp' And then execute: $ bundle Or install it yourself as: $ gem install crp ## Usage Create a new review: ```` ruby require "crp" => true review_poster = CRP::ReviewPoster.new("crp.example.com", "client", "key", "username", "password") => # review_response = review_poster.new_description_review("I'm looking for that special someone.", "123ABC", :male, "davy22", 55) => #> review_response.successful? => true review_response.internal_id => "123ABC" review_response.external_id => "ABCD1234" ```` The `client` and `key` variables are used to authenticate against the API, the `username` and `password` variables are the credentials for the basic auth used on the CRP server. You can skip the host, client and key parameters and specify the `ENV['CRP_HOST']`, `ENV['CRP_CLIENT']` and `ENV['CRP_KEY']`, `ENV['CRP_USERNAME']`, `ENV['CRP_PASSWORD']` environment variable for convenience. Parse the callback received from CRP: ```` ruby require "crp" => true review_callback = CRP::ReviewCallbackRequest.new(callback_request) => review_callback.internal_id => "123" review_callback.external_id => "4321" review_callback.result_code => 1 review_callback.result_message => "Approved" ```` **WARNING** You are responsible for listening for the callback, the gem does not handle that in any way. Note that CRP expects to see an `ok` body when sending its callback or it will keep sending the same callback over and over again. You can inspect the errors when the review response fails (status response code is not 200): ```` ruby review_response.raw_errors => {"_rest_"=>["Invalid signature"]} ```` ## Contributing Something missing? Found a bug? Horrified by the code? Open a [github issue](https://github.com/agilewings/crp_gem/issues), write a failing test or add some code using pull requests. Your help is greatly appreciated!