castle-rb 1.2.11 → 1.2.12
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 +3 -64
- data/lib/castle-rb/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 31540e9160fdebfa32408ff4eb628d66735a44a9
|
|
4
|
+
data.tar.gz: 86de8e3b76a4cfe72541a9932081bd42af13ab1e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 296f0c509c04e4f671ec62dac7329b972d494342437247875bcf76cacdf0e27c5f04da61017bcfadc18b8f98898423f0b807fcd35eb1f2af4187d0ead6506a0f
|
|
7
|
+
data.tar.gz: 063acc0eb147a34c4b37a0fd3b3e69cbd52f3ed79bd5c80babb2f5ed28d7278be451e7a8162500f2b42d5df98b270923f8cd0bf611d9ef93a80170fa608160c2
|
data/README.md
CHANGED
|
@@ -21,72 +21,11 @@ Load and configure the library with your Castle API secret in an initializer or
|
|
|
21
21
|
Castle.api_secret = 'YOUR_API_SECRET'
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
A Castle client instance will
|
|
24
|
+
A Castle client instance will be made available as `castle` in your Rails, Sinatra or Padrino controllers. The client will automatically configure the [request context](https://api.castle.io/docs#request-context) for each request.
|
|
25
25
|
|
|
26
|
-
##
|
|
26
|
+
## Documentation
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
```ruby
|
|
31
|
-
castle.identify(user.id, {
|
|
32
|
-
created_at: user.created_at,
|
|
33
|
-
email: user.email,
|
|
34
|
-
name: user.name,
|
|
35
|
-
custom_attributes: {
|
|
36
|
-
company_name: 'Acme',
|
|
37
|
-
age: 28
|
|
38
|
-
}
|
|
39
|
-
})
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Read more about the available fields in the [API docs](https://api.castle.io/docs#users).
|
|
43
|
-
|
|
44
|
-
## Tracking events
|
|
45
|
-
|
|
46
|
-
`track` lets you record the security-related actions your users perform. The more actions you track, the more accurate Castle is in identifying fraudsters.
|
|
47
|
-
|
|
48
|
-
Event names and detail properties that have semantic meaning are prefixed `$`, and we handle them in special ways.
|
|
49
|
-
|
|
50
|
-
When you have access to a **logged in user**, set `user_id` to the same user identifier as when you initiated Castle.js.
|
|
51
|
-
|
|
52
|
-
```ruby
|
|
53
|
-
castle.track(
|
|
54
|
-
name: '$login.succeeded',
|
|
55
|
-
user_id: user.id)
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
When you **don't** have access to a logged in user just omit `user_id`, typically when tracking `$login.failed` and `$password_reset.requested`. Instead, whenever you have access to the user-submitted form value, add this to the event details as `$login`.
|
|
59
|
-
|
|
60
|
-
```ruby
|
|
61
|
-
castle.track(
|
|
62
|
-
name: '$login.failed',
|
|
63
|
-
details: {
|
|
64
|
-
'$login' => 'johan@castle.io'
|
|
65
|
-
})
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### Supported events
|
|
69
|
-
|
|
70
|
-
- `$login.succeeded`: Record when a user attempts to log in.
|
|
71
|
-
- `$login.failed`: Record when a user logs out.
|
|
72
|
-
- `$logout.succeeded`: Record when a user logs out.
|
|
73
|
-
- `$registration.succeeded`: Capture account creation, both when a user signs up as well as when created manually by an administrator.
|
|
74
|
-
- `$registration.failed`: Record when an account failed to be created.
|
|
75
|
-
- `$email_change.requested`: An attempt was made to change a user’s email.
|
|
76
|
-
- `$email_change.succeeded`: The user completed all of the steps in the email address change process and the email was successfully changed.
|
|
77
|
-
- `$email_change.failed`: Use to record when a user failed to change their email address.
|
|
78
|
-
- `$challenge.requested`: Record when a user is prompted with additional verification, such as two-factor authentication or a captcha.
|
|
79
|
-
- `$challenge.succeeded`: Record when additional verification was successful.
|
|
80
|
-
- `$challenge.failed`: Record when additional verification failed.
|
|
81
|
-
- `$password_reset.requested`: An attempt was made to reset a user’s password.
|
|
82
|
-
- `$password_reset.succeeded`: The user completed all of the steps in the password reset process and the password was successfully reset. Password resets **do not** required knowledge of the current password.
|
|
83
|
-
- `$password_reset.failed`: Use to record when a user failed to reset their password.
|
|
84
|
-
- `$password_change.succeeded`: Use to record when a user changed their password. This event is only logged when users change their **own** password.
|
|
85
|
-
- `$password_change.failed`: Use to record when a user failed to change their password.
|
|
86
|
-
|
|
87
|
-
### Supported detail properties
|
|
88
|
-
|
|
89
|
-
- `$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.
|
|
28
|
+
[Official Castle docs](https://castle.io/docs)
|
|
90
29
|
|
|
91
30
|
## Exceptions
|
|
92
31
|
|
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.12
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Johan Brissmyr
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-02-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: her
|