Module: Spamster

Defined in:
lib/spamster.rb,
lib/spamster/model.rb,
lib/spamster/version.rb,
lib/spamster/model/proxy.rb,
lib/spamster/rack/middleware.rb

Defined Under Namespace

Modules: Model, Rack

Constant Summary collapse

VERSION =
"1.0.1"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.api_hostObject

Returns the value of attribute api_host.



11
12
13
# File 'lib/spamster.rb', line 11

def api_host
  @api_host
end

.blogObject

Returns the value of attribute blog.



11
12
13
# File 'lib/spamster.rb', line 11

def blog
  @blog
end

.debug_outputObject

Returns the value of attribute debug_output.



11
12
13
# File 'lib/spamster.rb', line 11

def debug_output
  @debug_output
end

.keyObject

Returns the value of attribute key.



11
12
13
# File 'lib/spamster.rb', line 11

def key
  @key
end

.request_paramsObject

Returns the value of attribute request_params.



11
12
13
# File 'lib/spamster.rb', line 11

def request_params
  @request_params
end

Class Method Details

.ham!(params) ⇒ Object



43
44
45
# File 'lib/spamster.rb', line 43

def ham!(params)
  perform_spam_post("submit-ham", params)
end

.key_valid?Boolean

Returns:

  • (Boolean)


26
27
28
29
30
# File 'lib/spamster.rb', line 26

def key_valid?
  params = {:blog => blog, :key => key}
  response = perform_post("http://#{api_host}/1.1/verify-key", params)
  response.body == 'valid'
end

.spam!(params) ⇒ Object



38
39
40
# File 'lib/spamster.rb', line 38

def spam!(params)
  perform_spam_post("submit-spam", params)
end

.spam?(params) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/spamster.rb', line 33

def spam?(params)
  perform_spam_post("comment-check", params) == 'true'
end

.use_akismet(key, blog) ⇒ Object



13
14
15
16
17
# File 'lib/spamster.rb', line 13

def use_akismet(key, blog)
  self.api_host = "rest.akismet.com"
  self.blog = blog
  self.key = key
end

.use_typepad(key, blog) ⇒ Object



19
20
21
22
23
# File 'lib/spamster.rb', line 19

def use_typepad(key, blog)
  self.api_host = "api.antispam.typepad.com"
  self.blog = blog
  self.key = key
end