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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 640bc0f13f0393b62ee5de5d1f47e43b9932f513
4
- data.tar.gz: 47c64d6658e5b6f9674c5efde4a071391b6d3116
3
+ metadata.gz: 455539af4c0a83dd3605e27d3904c66bd0125d25
4
+ data.tar.gz: 5a7cc71356433d23a6b3c8ff6bf9f8dd6c998bae
5
5
  SHA512:
6
- metadata.gz: 947c9f2e92959262be33039e4de4c91f5a14b9da7c0f7488d090dadbd4fadfedf235ca96cd1954724d3f1ef0800a324a704ad0310bef95acc036598010f0eee2
7
- data.tar.gz: 5cbea1e70be0616b133011aa5a77acc2b44962074eda994edf56457c62430c165ff452fd3dc3120e57cef637e87389df9542c1074fc3e0260497fd64b138fb2a
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
@@ -40,3 +40,4 @@ require 'castle-rb/models/account'
40
40
  require 'castle-rb/models/event'
41
41
  require 'castle-rb/models/context'
42
42
  require 'castle-rb/models/user'
43
+ require 'castle-rb/models/verification'
@@ -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)
@@ -0,0 +1,5 @@
1
+ module Castle
2
+ class Verification < Model
3
+ instance_post :approve
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module Castle
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
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.0
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-06-21 00:00:00.000000000 Z
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