Class: Cleanweb
Defined Under Namespace
Modules: Spam, Version Classes: KeyError, NoBodyError, NoSubjectError
Constant Summary collapse
- SPAM_URL =
"http://cleanweb-api.yandex.ru/1.0/check-spam"
- @@api_key =
nil
Constants included from Version
Class Attribute Summary collapse
-
.api_key ⇒ Object
Returns the value of attribute api_key.
Instance Method Summary collapse
- #check_body ⇒ Object
- #check_key ⇒ Object
- #check_params ⇒ Object
- #check_subject ⇒ Object
-
#initialize(params) ⇒ Cleanweb
constructor
A new instance of Cleanweb.
Methods included from Spam
#ask_yandex, #parse_xml, #spam?, #spam_params
Constructor Details
#initialize(params) ⇒ Cleanweb
Returns a new instance of Cleanweb.
29 30 31 32 33 |
# File 'lib/cleanweb.rb', line 29 def initialize params check_key @params = params check_params end |
Class Attribute Details
.api_key ⇒ Object
Returns the value of attribute api_key.
21 22 23 |
# File 'lib/cleanweb.rb', line 21 def api_key @api_key end |
Instance Method Details
#check_body ⇒ Object
49 50 51 52 |
# File 'lib/cleanweb.rb', line 49 def check_body @body = @params[:body] raise NoBodyError if @body.nil? end |
#check_key ⇒ Object
35 36 37 |
# File 'lib/cleanweb.rb', line 35 def check_key raise KeyError if @@api_key.nil? end |
#check_params ⇒ Object
39 40 41 42 |
# File 'lib/cleanweb.rb', line 39 def check_params check_subject check_body end |
#check_subject ⇒ Object
44 45 46 47 |
# File 'lib/cleanweb.rb', line 44 def check_subject @subject = @params[:subject] raise NoSubjectError if @subject.nil? end |