README.md in yandex_cleanweb-0.0.3 vs README.md in yandex_cleanweb-0.0.4
- old
+ new
@@ -1,9 +1,13 @@
# Yandex Cleanweb
+[![Build Status](https://travis-ci.org/evrone/yandex-cleanweb.png?branch=master)](https://travis-ci.org/evrone/yandex-cleanweb)
+
Ruby wrapper for [Yandex Cleanweb](http://api.yandex.ru/cleanweb/) spam detector.
+Unfortunatelly, this gem *is not capable with MRI 1.8.7* because of MRI 1.8.7 doesn't have `URI.encode_www_form` method.
+
## Installation
Add this line to your application's Gemfile:
gem 'yandex_cleanweb'
@@ -28,9 +32,25 @@
YandexCleanweb.spam?(body_plain: "my text", ip: "80.80.40.3")
=> false
YandexCleanweb.spam?(body_html: "some spam <a href='http://spam.com'>spam link</a>")
=> { id: "request id", links: [ ['http://spam.com', true] ] }
+```
+
+More complex example:
+
+```ruby
+
+user_input = "download free porn <a>...</a>"
+if spam_check = YandexCleanweb.spam?(user_input, ip: current_user.ip)
+ captcha = YandexCleanweb.get_captcha(spam_check[:id])
+
+ # now you can show captcha[:url] to user
+ # but remember to write captcha[:captcha] to session
+
+ # to check is captcha enterred by user is valid:
+ captcha_valid = YandexCleanweb.valid_captcha?(result[:id], captcha[:captcha], user_captcha)
+end
```
If you use Yandex Cleanweb in Rails app, we recommend to set up the api key in `config/initializers/yandex_cleanweb.rb`
## Contributing