castle-rb 1.2.0 → 1.2.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.
- checksums.yaml +4 -4
- data/README.md +0 -18
- data/lib/castle-rb.rb +1 -0
- data/lib/castle-rb/client.rb +8 -1
- data/lib/castle-rb/models/verification.rb +5 -0
- data/lib/castle-rb/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 455539af4c0a83dd3605e27d3904c66bd0125d25
|
4
|
+
data.tar.gz: 5a7cc71356433d23a6b3c8ff6bf9f8dd6c998bae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2d14f859cc2d6dbcf75460eb65a864997bff985b593d58cc892cbbe5de5d2c24315c08c801bc2234e2ca6a9615a13d20c5b6d213eabc96d43b9c276af0d2043
|
7
|
+
data.tar.gz: c25cee5ff6f94ee5906c51fdab8d00f80673b481dd96c1ee6865326eb51036229b7a37fcff092186e8d9ac64b74ca5105bde347dd7d9792ebe8b7cd050996a4a
|
data/README.md
CHANGED
@@ -67,24 +67,6 @@ castle.track(
|
|
67
67
|
|
68
68
|
- `$login`: The submitted email or username from when the user attempted to log in or reset their password. Useful when there is no `user_id` available.
|
69
69
|
|
70
|
-
## Secure mode
|
71
|
-
|
72
|
-
Avoid client-side spoofing by having your backend sign the user data with `secure_encode`.
|
73
|
-
|
74
|
-
```erb
|
75
|
-
_castle('setUser', '<%= Castle.secure_encode({
|
76
|
-
id: current_user.id,
|
77
|
-
email: current_user.email }) %>');
|
78
|
-
```
|
79
|
-
|
80
|
-
This will use your API Secret to encode the data into [JWT](http://jwt.io) format, for example:
|
81
|
-
|
82
|
-
```javascript
|
83
|
-
_castle('setUser', 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1...y4PCIXrz1Ejs');
|
84
|
-
```
|
85
|
-
|
86
|
-
**Important:** Make sure you enable **Secure mode** in the [Castle dashboard](https://dashboard.castle.io/settings/general).
|
87
|
-
|
88
70
|
## Exceptions
|
89
71
|
|
90
72
|
`Castle::Error` will be thrown if the Castle API returns a 400 or a 500 level HTTP response. You can also choose to catch a more [finegrained error](https://github.com/castle/castle-ruby/blob/master/lib/castle-rb/errors.rb).
|
data/lib/castle-rb.rb
CHANGED
data/lib/castle-rb/client.rb
CHANGED
@@ -17,10 +17,17 @@ module Castle
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def track(opts = {})
|
20
|
-
# Castle::Event.post('/v1/events', opts)
|
21
20
|
Castle::Event.create(opts)
|
22
21
|
end
|
23
22
|
|
23
|
+
def verify(opts = {})
|
24
|
+
Castle::Verification.create(opts)
|
25
|
+
end
|
26
|
+
|
27
|
+
def approve(opts = {})
|
28
|
+
Castle::Verification.new('$current').approve
|
29
|
+
end
|
30
|
+
|
24
31
|
private
|
25
32
|
|
26
33
|
def extract_cookies(request, response)
|
data/lib/castle-rb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: castle-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Johan Brissmyr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: her
|
@@ -197,6 +197,7 @@ files:
|
|
197
197
|
- lib/castle-rb/models/event.rb
|
198
198
|
- lib/castle-rb/models/model.rb
|
199
199
|
- lib/castle-rb/models/user.rb
|
200
|
+
- lib/castle-rb/models/verification.rb
|
200
201
|
- lib/castle-rb/request.rb
|
201
202
|
- lib/castle-rb/support/cookie_store.rb
|
202
203
|
- lib/castle-rb/support/padrino.rb
|