Module: Akismet
- Defined in:
- lib/akismet.rb,
lib/akismet/error.rb,
lib/akismet/client.rb,
lib/akismet/version.rb
Overview
Akismet provides convenience methods that instantiate a Client and invoke the Akismet API in one call. Before calling these methods, set Akismet.api_key and Akismet.app_url.
Defined Under Namespace
Constant Summary collapse
- VERSION =
The version of the Akismet gem.
'3.0.0'
Class Attribute Summary collapse
-
.api_key ⇒ String
The API key obtained at akismet.com.
-
.app_name ⇒ String
The name of the application making the request.
-
.app_url ⇒ String
A URL that identifies the application making the request.
-
.app_version ⇒ String
The version of the application making the request.
Class Method Summary collapse
-
.check(user_ip, user_agent, params = {}) ⇒ (Boolean, Boolean)
Checks whether a comment is spam and whether it is “blatant.”.
-
.ham(user_ip, user_agent, params = {}) ⇒ void
Submits a comment that has been identified as not-spam (ham).
-
.open {|client| ... } ⇒ Object
Initializes a client, opens it, yields it to the given block, and closes it when the block returns.
-
.spam(user_ip, user_agent, params = {}) ⇒ void
Submits a comment that has been identified as spam.
-
.spam?(user_ip, user_agent, params = {}) ⇒ Boolean
Checks whether a comment is spam.
Class Attribute Details
.api_key ⇒ String
The API key obtained at akismet.com. Set before calling the Akismet class methods.
19 20 21 |
# File 'lib/akismet.rb', line 19 def api_key @api_key end |
.app_name ⇒ String
The name of the application making the request
28 29 30 |
# File 'lib/akismet.rb', line 28 def app_name @app_name end |
.app_url ⇒ String
A URL that identifies the application making the request. Set before calling the Akismet class methods.
24 25 26 |
# File 'lib/akismet.rb', line 24 def app_url @app_url end |
.app_version ⇒ String
The version of the application making the request
32 33 34 |
# File 'lib/akismet.rb', line 32 def app_version @app_version end |
Class Method Details
.check(user_ip, user_agent, params = {}) ⇒ (Boolean, Boolean)
Checks whether a comment is spam and whether it is “blatant.”
35 36 37 |
# File 'lib/akismet.rb', line 35 def check(user_ip, user_agent, params = {}) with_client { |client| client.check user_ip, user_agent, params } end |
.ham(user_ip, user_agent, params = {}) ⇒ void
This method returns an undefined value.
Submits a comment that has been identified as not-spam (ham).
50 51 52 |
# File 'lib/akismet.rb', line 50 def ham(user_ip, user_agent, params = {}) with_client { |client| client.ham user_ip, user_agent, params } end |
.open {|client| ... } ⇒ Object
Initializes a client, opens it, yields it to the given block, and closes it when the block returns. Allows you to perform several operations over a single TCP connection.
55 56 57 |
# File 'lib/akismet.rb', line 55 def open(&block) with_client(&block) end |
.spam(user_ip, user_agent, params = {}) ⇒ void
This method returns an undefined value.
Submits a comment that has been identified as spam.
45 46 47 |
# File 'lib/akismet.rb', line 45 def spam(user_ip, user_agent, params = {}) with_client { |client| client.spam user_ip, user_agent, params } end |
.spam?(user_ip, user_agent, params = {}) ⇒ Boolean
Checks whether a comment is spam.
40 41 42 |
# File 'lib/akismet.rb', line 40 def spam?(user_ip, user_agent, params = {}) with_client { |client| client.spam? user_ip, user_agent, params } end |