Sha256: 1765169363663156cd23c389f540dcc16a8527a82dcd245541cb07b940b33bba

Contents?: true

Size: 1.98 KB

Versions: 1

Compression:

Stored size: 1.98 KB

Contents

# 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")
 => #<CRP::ReviewPoster:0x007fa2c1119110 @host="crp.example.com", @client="client", @key="key">
review_response = review_poster.new_description_review("I'm looking for that special someone.", "123ABC", :male, "davy22", 55)
 => #<CRP::ReviewResponse:0x007fa87c1fd020 @response=#<Net::HTTPOK 200 OK readbody=true>>
review_response.successful?
 => true
review_response.internal_id
 => "123ABC"
review_response.external_id
 => "ABCD1234"
````

You can skip the host, client and key parameters and specify the `ENV['CRP_HOST']`, `ENV['CRP_CLIENT']` and `ENV['CRP_KEY']` environment variable for convenience.

Parse the callback received from CRP:

```` ruby
require "crp"
 => true
review_callback_response = CRP::ReviewCallbackResponse.new(callback_response)
 =>
review_callback_response.successful?
 => true
review_callback_response.internal_id
 => "123"
review_callback_response.external_id
 => "4321"
review_callback_response.result_code
 => 1
review_callback_response.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.

## 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!

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
crp-0.0.3 README.md