rakismet 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NmQ3NDRlYjkxOTBkY2E4Zjk0YzUwMDlmYzI3NDI5NzQ4ZjlkM2NiZQ==
5
+ data.tar.gz: !binary |-
6
+ YTI5NTlkOGYxNTU4MGY5ZjZjYWZhMzg1NDU4NTJkNzJjMTRmZTQyZg==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ ZWY2Yzg3MTkzYzc5YWNjZjllYWE2NDg4ZTYyY2EyZGUyNTVhODY3OTA0ZDBj
10
+ Y2UzZDc0YzM0ZjQ4MzhiODdmNmRmMzQ5ZmNkODBmZWZmZWRhOThmNjQ4MjRj
11
+ OTg1YzdmZGY2ZGI1NmRmYjI0Y2UzYWMwMjY1YTU2OTk1YTIxNTk=
12
+ data.tar.gz: !binary |-
13
+ YjM2YTI3MGQwY2QwNWFmMDYxYWVjMGZhNWRkNjFkZDIwZGZiZjYwMWYxMDNm
14
+ MDhmZTlhNDNjNTY0YjM4ZDQ5NTUwMGY5MjNlODFmZTA0ZGE5MjQ5ZGFiMDBh
15
+ Mjc1ZjI5OTAwZTM0NjM2OWJjNDBlMTdmMzY3Yjk4MTFlNWY0OGQ=
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ = 1.4.0
2
+ * Allow endpoint to be specified with a proc for multitenant applications [Bradly Feeley]
3
+ * Add Akistmet permalink attribute [Eric Hochberger]
1
4
  = 1.3.0
2
5
  * Clean up gemspec and load paths [Steven Harman]
3
6
  * Add Akismet is_test param [Steven Harman]
data/README.md CHANGED
@@ -15,7 +15,13 @@ Compatibility
15
15
  Getting Started
16
16
  ===============
17
17
 
18
- Once you've installed the Rakismet gem and added it to your application's Gemfile,
18
+ Add the Rakismet gem to your Gemfile
19
+
20
+ ```ruby
21
+ gem 'rakismet'
22
+ ```
23
+
24
+ Once you've added the Rakismet gem to your Gemfile and installed it with ``bundle install``,
19
25
  you'll need an API key. Head on over to http://akismet.com/signup/ and sign up
20
26
  for a new username.
21
27
 
@@ -46,6 +52,12 @@ config.rakismet.proxy_host = 'http://yourdomain.com/'
46
52
  config.rakismet.proxy_port = '8080'
47
53
  ```
48
54
 
55
+ If your Rails app is a multitenant application, you can specify your Rakismet url as a proc:
56
+
57
+ ```ruby
58
+ config.rakismet.url = Proc.new { ApplicationController.current_tenant.url }
59
+ ```
60
+
49
61
  Checking For Spam
50
62
  -----------------
51
63
 
data/lib/rakismet.rb CHANGED
@@ -19,6 +19,10 @@ module Rakismet
19
19
  @request ||= Request.new
20
20
  end
21
21
 
22
+ def url
23
+ @url.is_a?(Proc) ? @url.call : @url
24
+ end
25
+
22
26
  def set_request_vars(env)
23
27
  request.user_ip, request.user_agent, request.referrer =
24
28
  env['REMOTE_ADDR'], env['HTTP_USER_AGENT'], env['HTTP_REFERER']
@@ -14,7 +14,7 @@ module Rakismet
14
14
  module ClassMethods
15
15
  def rakismet_attrs(args={})
16
16
  self.akismet_attrs ||= {}
17
- [:comment_type, :author, :author_url, :author_email, :content, :user_role].each do |field|
17
+ [:comment_type, :author, :author_url, :author_email, :content, :user_role, :permalink].each do |field|
18
18
  # clunky, but throwing around +type+ will break your heart
19
19
  fieldname = field.to_s =~ %r(^comment_) ? field : "comment_#{field}".intern
20
20
  self.akismet_attrs[fieldname] = args.delete(field) || field
@@ -64,7 +64,7 @@ module Rakismet
64
64
  elsif !mapped_field.nil? && respond_to?(mapped_field)
65
65
  send(mapped_field)
66
66
  elsif not [:comment_type, :author, :author_email,
67
- :author_url, :content, :user_role,
67
+ :author_url, :content, :user_role, :permalink,
68
68
  :user_ip, :referrer,
69
69
  :user_agent].include?(mapped_field)
70
70
  # we've excluded any fields that appear to
@@ -1,3 +1,3 @@
1
1
  module Rakismet
2
- VERSION = "1.3.0"
2
+ VERSION = "1.4.0"
3
3
  end
data/rakismet.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.homepage = "http://github.com/joshfrench/rakismet"
11
11
  s.summary = "Akismet and TypePad AntiSpam integration for Rails."
12
12
  s.description = "Rakismet is the easiest way to integrate Akismet or TypePad's AntiSpam into your Rails app."
13
- s.date = "2012-08-04"
13
+ s.date = "2013-09-22"
14
14
 
15
15
  s.rubyforge_project = "rakismet"
16
16
  s.add_development_dependency "rake"
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  MAPPED_PARAMS = { :comment_type => :type2, :author => :author2, :content => :content2,
4
4
  :author_email => :author_email2, :author_url => :author_url2,
5
- :user_role => :user_role2 }
5
+ :user_role => :user_role2, :permalink => :permalink2 }
6
6
 
7
7
  class CustomAkismetModel
8
8
  include Rakismet::Model
@@ -12,7 +12,7 @@ end
12
12
 
13
13
  describe CustomAkismetModel do
14
14
  it "should override default mappings" do
15
- [:comment_type, :author, :author_url, :author_email, :content, :user_role].each do |field|
15
+ [:comment_type, :author, :author_url, :author_email, :content, :user_role, :permalink].each do |field|
16
16
  fieldname = field.to_s =~ %r(^comment_) ? field : "comment_#{field}".intern
17
17
  CustomAkismetModel.akismet_attrs[fieldname].should eql(MAPPED_PARAMS[field])
18
18
  end
@@ -8,7 +8,7 @@ describe AkismetModel do
8
8
  end
9
9
 
10
10
  it "should have default mappings" do
11
- [:comment_type, :author, :author_email, :author_url, :content, :user_role].each do |field|
11
+ [:comment_type, :author, :author_email, :author_url, :content, :user_role, :permalink].each do |field|
12
12
  fieldname = field.to_s =~ %r(^comment_) ? field : "comment_#{field}".intern
13
13
  AkismetModel.akismet_attrs[fieldname].should eql(field)
14
14
  end
@@ -20,6 +20,18 @@ describe Rakismet do
20
20
  end
21
21
  end
22
22
 
23
+ describe "url" do
24
+ it "should allow url to be a string" do
25
+ Rakismet.url = "string.example.com"
26
+ Rakismet.url.should eql("string.example.com")
27
+ end
28
+
29
+ it "should allow url to be a proc" do
30
+ Rakismet.url = Proc.new { "proc.example.com" }
31
+ Rakismet.url.should eql("proc.example.com")
32
+ end
33
+ end
34
+
23
35
  describe ".validate_config" do
24
36
  it "should raise an error if key is not found" do
25
37
  Rakismet.key = ''
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rakismet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
5
- prerelease:
4
+ version: 1.4.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Josh French
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-08-04 00:00:00.000000000 Z
11
+ date: 2013-09-22 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rspec
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -75,27 +70,26 @@ files:
75
70
  - spec/spec_helper.rb
76
71
  homepage: http://github.com/joshfrench/rakismet
77
72
  licenses: []
73
+ metadata: {}
78
74
  post_install_message:
79
75
  rdoc_options: []
80
76
  require_paths:
81
77
  - lib
82
78
  required_ruby_version: !ruby/object:Gem::Requirement
83
- none: false
84
79
  requirements:
85
80
  - - ! '>='
86
81
  - !ruby/object:Gem::Version
87
82
  version: '0'
88
83
  required_rubygems_version: !ruby/object:Gem::Requirement
89
- none: false
90
84
  requirements:
91
85
  - - ! '>='
92
86
  - !ruby/object:Gem::Version
93
87
  version: '0'
94
88
  requirements: []
95
89
  rubyforge_project: rakismet
96
- rubygems_version: 1.8.22
90
+ rubygems_version: 2.0.2
97
91
  signing_key:
98
- specification_version: 3
92
+ specification_version: 4
99
93
  summary: Akismet and TypePad AntiSpam integration for Rails.
100
94
  test_files:
101
95
  - spec/models/block_params_spec.rb