re_captcha 0.1.1 → 0.1.2

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: 11c1f2dd7960632efe95b32dd4f8f97011618221
4
- data.tar.gz: aaffea5bf4341dbdf3066e28aa2291463d36d21b
3
+ metadata.gz: a1eba206968dce044b36e2eaafa4d9c8634b042a
4
+ data.tar.gz: de66b0441b7098cb3ccc63dcfa4c491b01356f0e
5
5
  SHA512:
6
- metadata.gz: 9d8ec1ad825085efd0e1ee643896b597c048fde69dfc3753b49c81c7805901a506db0692a648abc6cd1e1b2296235720e6264fd8957ad3b9a5ef773d7f335346
7
- data.tar.gz: e3a324b779f626d82963a990c35bc1bb2edfa024f2d6b0e5ee767f0c56cbf270d78ae64c997ecf3d83d7983b99bea8a48e21400333a4bbf5dd120d401823b7d6
6
+ metadata.gz: 392cd5eb41b0490225884e757f866bba25117d00b9954a244b4f59371d76ac5fb5620710eb998b3139b3e706a9948a8fe872f64b420f3226dd7d8795e4c40d18
7
+ data.tar.gz: 0432cefb448559c917bbeacbcc901eb8878dd49e2816459b87d0d68df354206e14a045d30d535b383f1e2ece04964d55289f30536b681db84afae673ebec91d0
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - "2.2"
4
+ - "2.1"
5
+ - "2.0"
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015 David Jeusette
3
+ Copyright (c) 2015 TextMaster SA
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -8,7 +8,7 @@ Run console with preloaded library with ``` rake console ```
8
8
 
9
9
  ## Getting started
10
10
 
11
- You first need to configure the gem.
11
+ You may need to configure the gem with non default values:
12
12
 
13
13
  ```
14
14
  ReCaptcha.configure do |config|
@@ -18,7 +18,9 @@ end
18
18
 
19
19
  ```
20
20
 
21
- Other options are:
21
+ The options are:
22
+ - private_key (default: ENV['RECAPTCHA_PRIVATE_KEY'])
23
+ - public_key (default: ENV['RECAPTCHA_PUBLIC_KEY'])
22
24
  - api_endpoint (default: https://www.google.com/recaptcha/)
23
25
  - skipped_env (default: ['test', 'cucumber'])
24
26
  - language_table: the table to map locale with language code
@@ -44,27 +46,15 @@ The default language table is the following:
44
46
 
45
47
  ## Display
46
48
 
47
- To access the helpers in the views, make sure to include them in a Helper class
48
- such as ApplicationHelper (Rails)
49
+ The view helpers are automatically included in a Rails app. If you're not using Rails, include the helpers with ```include ReCaptcha::Helpers```.
49
50
 
50
- ```
51
- module ApplicationHelper
52
- include ReCaptcha::Helper
53
- end
54
- ```
51
+ The available helper methods are the following:
55
52
 
56
- Then include the script tag using this helper method in your view:
57
- ```
58
- recaptcha_script(language: nil)
59
- ```
60
- language is one of the locale defined in the language table.
53
+ - ```recaptcha_script(language: nil)``` includes the script tag in the view. Language is one of the locale defined in the language table.
61
54
 
62
- You can now add the reCaptcha box in your forms:
63
- ```
64
- recaptcha_tags(options = {})
65
- ```
55
+ - ```recaptcha_tags(options = {})``` adds the reCaptcha box in the view.
66
56
 
67
- The options are the following:
57
+ The options are the following (the default value is given):
68
58
  - theme: 'light'
69
59
  - type: 'image'
70
60
  - size: 'normal'
@@ -76,11 +66,9 @@ Check the reCaptcha doc for the available values (https://developers.google.com/
76
66
 
77
67
  ## Verification
78
68
 
79
- Assuming that your application uses Rails, verify the reCaptcha response using the method below:
80
- ```
81
- recaptcha_valid?(response, remote_ip: nil, model: nil, message: nil)
82
- ```
69
+ Assuming that your application uses Rails, verify the reCaptcha response in your controller using the method ```recaptcha_valid?(model: nil, message: nil)```.
70
+
71
+ model and message are optional and enables you to set an error message on the :base attribute of the provided model.
83
72
 
84
- This method can be called like this in a controller: ```ReCaptcha.client.recaptcha_valid?(...)```
85
73
 
86
- The response should be retrieved with ```params.fetch(:"g-recaptcha-response", "")```. Optional args model and message allow to add an error with the given message on the :base attr of the provided model.
74
+ If you're not using Rails, this method can be called like this: ```ReCaptcha.client.recaptcha_valid?(response, remote_ip: nil)```. No model nor message can be provided.
@@ -14,7 +14,7 @@ module ReCaptcha
14
14
  private
15
15
 
16
16
  def add_error_on_model(model, message)
17
- model.errors.add :base, message if model && message
17
+ model.errors.add(:base, message) if model && message
18
18
  end
19
19
  end
20
20
  end
@@ -1,3 +1,3 @@
1
1
  module ReCaptcha
2
- VERSION = '0.1.1'.freeze
2
+ VERSION = '0.1.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: re_captcha
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Jeusette
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-17 00:00:00.000000000 Z
11
+ date: 2015-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -75,6 +75,7 @@ extra_rdoc_files: []
75
75
  files:
76
76
  - ".gitignore"
77
77
  - ".rubocop.yml"
78
+ - ".travis.yml"
78
79
  - CHANGELOG.md
79
80
  - Gemfile
80
81
  - LICENSE