recaptcha 2.1.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 93857dd1ee9d0a3067af8e75804074f6f06ce25f
4
- data.tar.gz: 66df686d1d1218dd05f46102aeec67a0766d4fe2
3
+ metadata.gz: 31f346568194ea954c4b8df2484084190134af6c
4
+ data.tar.gz: 258ecfbdd4cb80c9f11d423b4f946c94cb770c99
5
5
  SHA512:
6
- metadata.gz: 3612a091d44d54f188ae6a7160337cc00413e9b009030fc18c1d2e609e27af65c953cd559363c326a274eed7fc7b082d70d7204bcae3c8731fd6fdb62359eae9
7
- data.tar.gz: 74a2554d27922dbf8d4e8c612148eb4b181a2fcf79a85e7e171242d21f13a5917698303c87969f33f40ada0b24969be5be67f29d9e13d9f144ef35d7ff4f0958
6
+ metadata.gz: a83bc1cd5216e0fc3cf96788ab2d926239536ead0c144b9ce68e2cb4be013a6696f202944d813f2513cf168cfda860e4396ca16ff38c57beb31885bed4bdb0e3
7
+ data.tar.gz: 0095c46ee9f365bc76a02696f9b505ac623a2383a670c0aed38fa7ee6e854d2e710a233e06c709c8d8a3d5e43353b5e74d445c82a617e4aa5b2fc53a9d54ae59
data/README.md CHANGED
@@ -95,7 +95,7 @@ Some of the options available:
95
95
  | :private_key | Override private API key.
96
96
  | :timeout | The number of seconds to wait for reCAPTCHA servers before give up. (default `3`)
97
97
  | :response | Custom response parameter. (default: params['g-recaptcha-response'])
98
- | :hostname | Expected hostname or a callable that validates the hostname, see [domain validation](https://developers.google.com/recaptcha/docs/domain_validation) and [hostname](https://developers.google.com/recaptcha/docs/verify#api-response) docs. (default: `nil`)
98
+ | :hostname | Expected hostname or a callable that validates the hostname, see [domain validation](https://developers.google.com/recaptcha/docs/domain_validation) and [hostname](https://developers.google.com/recaptcha/docs/verify#api-response) docs. (default: `nil`, but can be changed by setting `config.hostname`)
99
99
 
100
100
  ## I18n support
101
101
  reCAPTCHA passes two types of error explanation to a linked model. It will use the I18n gem
@@ -40,10 +40,9 @@ module Recaptcha
40
40
  configuration.send("#{key}=", value)
41
41
  end
42
42
 
43
- result = yield if block_given?
44
-
43
+ yield if block_given?
44
+ ensure
45
45
  original_config.each { |key, value| configuration.send("#{key}=", value) }
46
- result
47
46
  end
48
47
 
49
48
  def self.get(verify_hash, options)
@@ -28,7 +28,7 @@ module Recaptcha
28
28
  # end
29
29
  #
30
30
  class Configuration
31
- attr_accessor :skip_verify_env, :private_key, :public_key, :proxy, :handle_timeouts_gracefully, :use_ssl_by_default
31
+ attr_accessor :skip_verify_env, :private_key, :public_key, :proxy, :handle_timeouts_gracefully, :use_ssl_by_default, :hostname
32
32
 
33
33
  def initialize #:nodoc:
34
34
  @skip_verify_env = SKIP_VERIFY_ENV
@@ -72,6 +72,8 @@ module Recaptcha
72
72
  end
73
73
 
74
74
  def recaptcha_hostname_valid?(hostname, validation)
75
+ validation ||= Recaptcha.configuration.hostname
76
+
75
77
  case validation
76
78
  when nil, FalseClass then true
77
79
  when String then validation == hostname
@@ -1,3 +1,3 @@
1
1
  module Recaptcha
2
- VERSION = "2.1.0"
2
+ VERSION = "2.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recaptcha
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason L Perry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-19 00:00:00.000000000 Z
11
+ date: 2016-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json