turnstiled 0.1.0 → 0.1.1

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +42 -16
  3. data/lib/turnstiled/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: da753c2bafbc45fa1b878958ab03e1131979c8cfa0299a0bb2cbdd48594da72b
4
- data.tar.gz: 7f6a09f9e461ca65f612d1a5e1dc3259b6a88d70f6c542f42a85ad13b3b93845
3
+ metadata.gz: ed188fe3df0cb80cc0c7dccd9d16f757c911997357c3e203588cfb4b6a9034bd
4
+ data.tar.gz: 156a94a657896e935cd94dcdb03a1172838697fe078f2caa2dd57e96410926ba
5
5
  SHA512:
6
- metadata.gz: 99c3f6895fa3817093d3a3eb35da430d0877b49dcaf0e80b6a08524bb9552920fcdff7d7355525d5513ca370fba4a74cc8405a65d68951a0710a3c0aa53521bd
7
- data.tar.gz: 802b6644f991b9fa2875bff02422f0865bdab972b320472c09cb4d50df3fcb85834c5b720cf1538e2f4f598fd2be3a45733e2727ce2b4ce9961c320ca5679d98
6
+ metadata.gz: '0483bcfdf269c1bd3a3a03d28487d191f689cc3144269383330b6266a62e5290ab9dbbf1295b9e74f453df3a6162d88651656a59c5b991cba6a415c53472447d'
7
+ data.tar.gz: d5011bde496d6bd7578dbfaff2d830c25acd3309bc9b4f793045ec3f627fe3f7a7f725ecaa1086c65454ecd7e25e34078c643df7732541dd5fd4606e5f1d81fc
data/README.md CHANGED
@@ -1,28 +1,54 @@
1
- # Turnstiled
2
- Short description and motivation.
1
+ Turnstiled
2
+ ==========
3
3
 
4
- ## Usage
5
- How to use my plugin.
4
+ Turnstiled makes it easy to add the Cloudflare Turnstile Captcha to your Rails app.
6
5
 
7
- ## Installation
8
- Add this line to your application's Gemfile:
6
+ For development, it even inlucdes a Mock widget.
9
7
 
10
- ```ruby
8
+ Getting Usage
9
+ -------------
10
+
11
+ ### Installation
12
+
13
+ First install the gem by adding this line to your application's Gemfile:
14
+
15
+ ``` ruby
11
16
  gem "turnstiled"
12
17
  ```
13
18
 
14
- And then execute:
15
- ```bash
19
+ And executing:
20
+
21
+ ``` bash
16
22
  $ bundle
17
23
  ```
18
24
 
19
- Or install it yourself as:
20
- ```bash
21
- $ gem install turnstiled
25
+ ### Configuration
26
+
27
+ Create a file called `config/initializers/turnstiled.rb` and add the following:
28
+
29
+ ``` ruby
30
+ Turnstiled.configure do |config|
31
+ config.api_key = "YOUR_API_KEY"
32
+ config.api_secret = "YOUR_API_SECRET"
33
+ end
22
34
  ```
23
35
 
24
- ## Contributing
25
- Contribution directions go here.
36
+ In your layout, add the widget to the head of the document:
37
+
38
+ ``` erb
39
+ <%= turnstiled_javascript_tag %>
40
+ ```
41
+
42
+ In test and development, it will include a mock widget that fires the callback after 2 seconds.
43
+
44
+ The mock widget will send the `cf-turnstile-response` parameter with a value of `1`.
45
+
46
+ In your controller, you also need to verify the response with the following:
47
+
48
+ ``` ruby
49
+ class PostsController < ApplicationController
50
+ verify_turnstile_requwst only: %i[create]
51
+ end
52
+ ```
26
53
 
27
- ## License
28
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
54
+ The `verify_turnstile_requwst` takes the same options as a `before_action` method call.
@@ -1,3 +1,3 @@
1
1
  module Turnstiled
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turnstiled
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Displayful