module Akismet
{Akismet} provides convenience methods that instantiate a {Akismet::Client} and invoke the Akismet
API in one call. Before calling these methods, set {api_key} and {app_url}.
Constants
- VERSION
The version of the
Akismet
gem.
Attributes
api_key[RW]
The API key obtained at akismet.com. Set before calling the {Akismet} class methods. @return [String]
app_name[RW]
The name of the application making the request @return [String]
app_url[RW]
A URL that identifies the application making the request. Set before calling the {Akismet} class methods. @return [String]
app_version[RW]
The version of the application making the request @return [String]
Public Class Methods
check(user_ip, user_agent, params = {})
click to toggle source
(see Client#check
)
# 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 = {})
click to toggle source
(see Client#ham
)
# 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(&block)
click to toggle source
(see Client.open
)
# File lib/akismet.rb, line 55 def open(&block) with_client(&block) end
spam(user_ip, user_agent, params = {})
click to toggle source
(see Client#spam
)
# 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 = {})
click to toggle source
(see Client#spam?
)
# File lib/akismet.rb, line 40 def spam?(user_ip, user_agent, params = {}) with_client { |client| client.spam? user_ip, user_agent, params } end
Private Class Methods
with_client(&block)
click to toggle source
# File lib/akismet.rb, line 61 def with_client(&block) raise "Set Akismet.api_key" unless api_key raise "Set Akismet.app_url" unless app_url Akismet::Client.open api_key, app_url, app_name: app_name, app_version: app_version, &block end