rails-captchme 1.0.6 → 1.0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0042ff95f27dec4f8aa2424e73cf908e97b7144e
4
- data.tar.gz: 48c869da0719e15096523165094fb5d378580a42
3
+ metadata.gz: f4239951900a5c4ba222e4b2e9e056060788425a
4
+ data.tar.gz: 320e4b8dc3d21d2b6ca2c447f2de789e2cf4ec7c
5
5
  SHA512:
6
- metadata.gz: c863ca3f820b9d781dfd4e46f55e6da7eaa08ac581b56c5e857dcf7bbfc85dad1dc8bf9aeb35e17d9e29c16145f066ad2f4352c92023bd1fd6dcb682f106ee19
7
- data.tar.gz: 85aa1197152cd68ed206e8fd0b0a8a557db7991474d49ed7075254d1cfa2326b11fe85cea8a38832ad520f3060d356ed9f90c8cd72ef11428a3f37543393d69d
6
+ metadata.gz: b2364320cb9ec155c3ef88b6682c0bf9cb8d273a56aa79a7379767dee5d090b9bd8cf339403e2513b38d5aa9ac11ee6483fc77cab9a27d668727a8ee5857e99e
7
+ data.tar.gz: d8c16aa9e70f673e082710eac65e209a3cfd49fbc08d9b36e7e0db327d85559e437b9e29485eaf85724fdfc83eac22b20fe730fe0b10bca3fb8379c98f1a5432
@@ -0,0 +1,31 @@
1
+ require "captchme/version"
2
+
3
+ module CAPTCHME
4
+ require 'net/http'
5
+ require "uri"
6
+
7
+ class Captchme
8
+ def initialize(private_key, params, ip_client)
9
+ @private_key = private_key
10
+ @data = "private_key=" + @private_key + "&challenge_key="+
11
+ params["captchme_challenge_field"] + "&response=" +
12
+ params["captchme_response_field"] + "&user_ip=" + ip_client;
13
+ @headers = {
14
+ "Content-Type" => "application/x-www-form-urlencoded",
15
+ "Content-length" => @data.length.to_s,
16
+ "Connection" => "close"
17
+ }
18
+ @uri = URI("http://api.captchme.net/api/verify")
19
+ @http = Net::HTTP.new(@uri.host, @uri.port)
20
+ end
21
+
22
+ def request
23
+ @response = @http.post(@uri.path, @data, @headers).body.split
24
+ end
25
+
26
+ def is_valid?
27
+ @response[0] == 'true'
28
+ end
29
+ end
30
+
31
+ end
@@ -0,0 +1,3 @@
1
+ module CAPTCHME
2
+ VERSION = "1.0.7"
3
+ end
@@ -1,11 +1,11 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'rails/captchme/version'
4
+ require 'captchme/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "rails-captchme"
8
- spec.version = Rails::CAPTCHME::VERSION
8
+ spec.version = CAPTCHME::VERSION
9
9
  spec.authors = ["Martin Debrunne"]
10
10
  spec.email = ["martin.debrunne@gmail.com"]
11
11
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-captchme
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Debrunne
@@ -55,8 +55,8 @@ files:
55
55
  - Rakefile
56
56
  - bin/console
57
57
  - bin/setup
58
- - lib/rails/captchme.rb
59
- - lib/rails/captchme/version.rb
58
+ - lib/captchme.rb
59
+ - lib/captchme/version.rb
60
60
  - rails-captchme-1.0.0.gem
61
61
  - rails-captchme-1.0.1.gem
62
62
  - rails-captchme.gemspec
@@ -1,33 +0,0 @@
1
- require "rails/captchme/version"
2
-
3
- module Rails
4
- module CAPTCHME
5
- require 'net/http'
6
- require "uri"
7
-
8
- class Captchme
9
- def initialize(private_key, params, ip_client)
10
- @private_key = private_key
11
- @data = "private_key=" + @private_key + "&challenge_key="+
12
- params["captchme_challenge_field"] + "&response=" +
13
- params["captchme_response_field"] + "&user_ip=" + ip_client;
14
- @headers = {
15
- "Content-Type" => "application/x-www-form-urlencoded",
16
- "Content-length" => @data.length.to_s,
17
- "Connection" => "close"
18
- }
19
- @uri = URI("http://api.captchme.net/api/verify")
20
- @http = Net::HTTP.new(@uri.host, @uri.port)
21
- end
22
-
23
- def request
24
- @response = @http.post(@uri.path, @data, @headers).body.split
25
- end
26
-
27
- def is_valid?
28
- @response[0] == 'true'
29
- end
30
- end
31
-
32
- end
33
- end
@@ -1,5 +0,0 @@
1
- module Rails
2
- module CAPTCHME
3
- VERSION = "1.0.6"
4
- end
5
- end