rakismet 1.5.2 → 1.5.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NzdlODJkNzk5YjAxYTgyNjkxZmMzYjc1NjMxZGQ3ZGY4OTFlZTMwMQ==
5
- data.tar.gz: !binary |-
6
- Y2FhOTZjNzg5NDEyMWFmOGM2MTYwYzQ0NWJmM2ViNWM5OGVlZTA0YQ==
2
+ SHA1:
3
+ metadata.gz: cf228545419704714621f2ae6e6e1cc37e702eb6
4
+ data.tar.gz: 6f39f292c5ac67f57ddc6f499237ef7b339f1523
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- MzY2YWU3N2E2NmNjNzU1MTBkNmYxNDAwNDdiM2ZhZmE4ODU2Y2ZkZTliNmFl
10
- MGNjOWIwYmRhYWRhZGNmMDk5ZDdmYjQ0OTE3YjI3YWRjZTQzY2VhYzU2NTFl
11
- N2EwNTFmNDRlZTY5ODE0ZDY2MTQ3M2JlNjA5MDQ0MGQyNTM1MDE=
12
- data.tar.gz: !binary |-
13
- N2U0MmUzNTM0NTZmNjE3YjhjMDFjYmZmNmVhMmY2NjY4MjJiMmZhY2RlYmFi
14
- ZjNmYzJlYzc5MzE2MDg1ZTgwMWE4NDg2NWNlOTBhY2Y1OTYzNjEwMGFhZmI5
15
- NmE5ZDViZGMzZWFlMTBhZjhkY2NlYWVmMWY5YWQ0OWExM2Y2ZjE=
6
+ metadata.gz: 33a9d267a17332f49b7f0500841bd777bc741185c64ae37ba1f53d3e4f0229fb8eaa1a7606a1c8c76aa4704470ada00b5720e1117cf0bb6e82acc5dd28daafc3
7
+ data.tar.gz: 1a5ec9899dbebca1877cffb018e81302bccc928eef49dfa9cd8e3e4f1df56111e9aafd4b22ac6241b5a838321e699364c662687703510dd0fc35836f54e4398a
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ = 1.5.3
2
+ * Use HTTPS to connect to Akismet [Christian Wesselhoeft]
1
3
  = 1.5.2
2
4
  * Don't try to send Rails.version unless it's actually defined [Brett Bender]
3
5
  = 1.5.1
@@ -54,7 +54,7 @@ module Rakismet
54
54
  def validate_key
55
55
  validate_config
56
56
  akismet = URI.parse(verify_url)
57
- response = Net::HTTP::Proxy(proxy_host, proxy_port).start(akismet.host) do |http|
57
+ response = Net::HTTP.start(akismet.host, use_ssl: true, p_addr: proxy_host, p_port: proxy_port) do |http|
58
58
  data = "key=#{Rakismet.key}&blog=#{Rakismet.url}"
59
59
  http.post(akismet.path, data, Rakismet.headers)
60
60
  end
@@ -69,7 +69,7 @@ module Rakismet
69
69
  validate_config
70
70
  args.merge!(:blog => Rakismet.url, :is_test => Rakismet.test_mode)
71
71
  akismet = URI.parse(call_url(function))
72
- response = Net::HTTP::Proxy(proxy_host, proxy_port).start(akismet.host) do |http|
72
+ response = Net::HTTP.start(akismet.host, use_ssl: true, p_addr: proxy_host, p_port: proxy_port) do |http|
73
73
  params = args.map do |k,v|
74
74
  param = v.class < String ? v.to_str : v.to_s # for ActiveSupport::SafeBuffer and Nil, respectively
75
75
  "#{k}=#{CGI.escape(param)}"
@@ -82,11 +82,11 @@ module Rakismet
82
82
  protected
83
83
 
84
84
  def verify_url
85
- "http://#{Rakismet.host}/1.1/verify-key"
85
+ "https://#{Rakismet.host}/1.1/verify-key"
86
86
  end
87
87
 
88
88
  def call_url(function)
89
- "http://#{Rakismet.key}.#{Rakismet.host}/1.1/#{function}"
89
+ "https://#{Rakismet.key}.#{Rakismet.host}/1.1/#{function}"
90
90
  end
91
91
 
92
92
  def validate_config
@@ -1,3 +1,3 @@
1
1
  module Rakismet
2
- VERSION = "1.5.2"
2
+ VERSION = "1.5.3"
3
3
  end
@@ -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 = "2016-02-26"
13
+ s.date = "2016-06-12"
14
14
 
15
15
  s.rubyforge_project = "rakismet"
16
16
  s.add_development_dependency "rake"
@@ -11,6 +11,10 @@ describe Rakismet do
11
11
  Rakismet.key = 'dummy-key'
12
12
  Rakismet.url = 'test.localhost'
13
13
  Rakismet.host = 'endpoint.localhost'
14
+ Rakismet.proxy_host = nil
15
+ Rakismet.proxy_port = nil
16
+
17
+ @test_url = "#{Rakismet.key}.#{Rakismet.host}"
14
18
  end
15
19
 
16
20
  describe "proxy host" do
@@ -50,27 +54,24 @@ describe Rakismet do
50
54
  end
51
55
 
52
56
  describe ".validate_key" do
53
- before (:each) do
54
- @proxy = double(Net::HTTP)
55
- Net::HTTP.stub(:Proxy).and_return(@proxy)
56
- end
57
-
58
57
  it "should use proxy host and port" do
59
58
  Rakismet.proxy_host = 'proxy_host'
60
59
  Rakismet.proxy_port = 'proxy_port'
61
- @proxy.stub(:start).and_return(mock_response('valid'))
62
- Net::HTTP.should_receive(:Proxy).with('proxy_host', 'proxy_port').and_return(@proxy)
60
+
61
+ Net::HTTP.should_receive(:start).with(Rakismet.host, use_ssl: true, p_addr: 'proxy_host', p_port: 'proxy_port')
62
+ .and_return(mock_response('valid'))
63
+
63
64
  Rakismet.validate_key
64
65
  end
65
66
 
66
67
  it "should set @@valid_key = true if key is valid" do
67
- @proxy.stub(:start).and_return(mock_response('valid'))
68
+ Net::HTTP.stub(:start).and_return(mock_response('valid'))
68
69
  Rakismet.validate_key
69
70
  Rakismet.valid_key?.should be_truthy
70
71
  end
71
72
 
72
73
  it "should set @@valid_key = false if key is invalid" do
73
- @proxy.stub(:start).and_return(mock_response('invalid'))
74
+ Net::HTTP.stub(:start).and_return(mock_response('invalid'))
74
75
  Rakismet.validate_key
75
76
  Rakismet.valid_key?.should be_falsey
76
77
  end
@@ -78,7 +79,7 @@ describe Rakismet do
78
79
  it "should build url with host" do
79
80
  host = "api.antispam.typepad.com"
80
81
  Rakismet.host = host
81
- @proxy.should_receive(:start).with(host).and_yield(http)
82
+ Net::HTTP.should_receive(:start).with(host, use_ssl: true, p_addr: nil, p_port: nil).and_yield(http)
82
83
  Rakismet.validate_key
83
84
  end
84
85
  end
@@ -91,23 +92,23 @@ describe Rakismet do
91
92
 
92
93
  describe ".akismet_call" do
93
94
  before do
94
- @proxy = double(Net::HTTP)
95
- Net::HTTP.stub(:Proxy).and_return(@proxy)
96
- @proxy.stub(:start).and_yield(http)
95
+ Net::HTTP.stub(:start).and_yield(http)
97
96
  end
98
97
 
99
98
  it "should use proxy host and port" do
100
99
  Rakismet.proxy_host = 'proxy_host'
101
100
  Rakismet.proxy_port = 'proxy_port'
102
- @proxy.stub(:start).and_return(mock_response('valid'))
103
- Net::HTTP.should_receive(:Proxy).with('proxy_host', 'proxy_port').and_return(@proxy)
101
+
102
+ Net::HTTP.should_receive(:start).with(@test_url, use_ssl: true, p_addr: 'proxy_host', p_port: 'proxy_port')
103
+ .and_return(mock_response('valid'))
104
+
104
105
  Rakismet.send(:akismet_call, 'bogus-function')
105
106
  end
106
107
 
107
108
  it "should build url with API key for the correct host" do
108
109
  host = 'api.antispam.typepad.com'
109
110
  Rakismet.host = host
110
- @proxy.should_receive(:start).with("#{Rakismet.key}.#{host}")
111
+ Net::HTTP.should_receive(:start).with("#{Rakismet.key}.#{host}", use_ssl: true, p_addr: nil, p_port: nil)
111
112
  Rakismet.send(:akismet_call, 'bogus-function')
112
113
  end
113
114
 
@@ -2,7 +2,8 @@ require File.expand_path "lib/rakismet"
2
2
  require 'ostruct'
3
3
 
4
4
  RSpec.configure do |config|
5
- config.mock_with :rspec
5
+ config.mock_with(:rspec) { |c| c.syntax = :should }
6
+ config.expect_with(:rspec) { |c| c.syntax = :should }
6
7
  end
7
8
 
8
9
  class AkismetModel
@@ -39,4 +40,4 @@ def empty_request
39
40
  :user_agent => nil,
40
41
  :referrer => nil,
41
42
  :http_headers => nil)
42
- end
43
+ end
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rakismet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.2
4
+ version: 1.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh French
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-26 00:00:00.000000000 Z
11
+ date: 2016-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '2.11'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '2.11'
41
41
  description: Rakismet is the easiest way to integrate Akismet or TypePad's AntiSpam
@@ -46,7 +46,7 @@ extensions: []
46
46
  extra_rdoc_files:
47
47
  - README.md
48
48
  files:
49
- - .gitignore
49
+ - ".gitignore"
50
50
  - CHANGELOG
51
51
  - Gemfile
52
52
  - MIT-LICENSE
@@ -77,17 +77,17 @@ require_paths:
77
77
  - lib
78
78
  required_ruby_version: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  required_rubygems_version: !ruby/object:Gem::Requirement
84
84
  requirements:
85
- - - ! '>='
85
+ - - ">="
86
86
  - !ruby/object:Gem::Version
87
87
  version: '0'
88
88
  requirements: []
89
89
  rubyforge_project: rakismet
90
- rubygems_version: 2.4.1
90
+ rubygems_version: 2.5.1
91
91
  signing_key:
92
92
  specification_version: 4
93
93
  summary: Akismet and TypePad AntiSpam integration for Rails.