castle-rb 1.2.5 → 1.2.6

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: af121c5d1d3c642d3435268c16941c87379b2994
4
- data.tar.gz: 5b38a50048cef8e962a8491e9146b8ca61f90ee1
3
+ metadata.gz: 23c20cc08887d01d3640a1c8004710710e9c1b83
4
+ data.tar.gz: 67d047155bedfc36caeaec197dc87de6b46ea2bf
5
5
  SHA512:
6
- metadata.gz: 2819e4740c9cd3b61c10c1d7256ef7e0d1eec0279f23f57820177ad6dd2bd381b149a8fcc31ce37498ffffb0d217f18da57c2216a4cd330be03df92374aaee12
7
- data.tar.gz: 527db83f6d74a97f64e5643653e56cd3b57862d2429dc79a9f6757c879dedfcb63f4a327ce899857324adf7d3708b015015365a83555995ca585481ed89b11fd
6
+ metadata.gz: 24421a993d804166f108cc856632c9efcd32046ae5f74543b69ed59a6b07d7a8294808f7e69dd348fda267f87b74e3ac629ee1db070085c1b35643310fd21f74
7
+ data.tar.gz: ddde41d13106997c4a18a6b606284cad78b39560df254a4cf58b5e8178e34ce328d0b368466ca7b1a102bc40b1931d4103220b0ddf6733a02692d1b5236ca25f
data/README.md CHANGED
@@ -31,10 +31,16 @@ Call `identify` when a user logs in or updates their information.
31
31
  castle.identify(user.id, {
32
32
  created_at: user.created_at,
33
33
  email: user.email,
34
- name: user.name
34
+ name: user.name,
35
+ custom_attributes: {
36
+ company_name: 'Acme',
37
+ age: 28
38
+ }
35
39
  })
36
40
  ```
37
41
 
42
+ Read more about the available fields in the [API docs](https://api.castle.io/docs#users).
43
+
38
44
  ## Tracking events
39
45
 
40
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.
data/lib/castle-rb.rb CHANGED
@@ -37,4 +37,4 @@ require 'castle-rb/models/location'
37
37
  require 'castle-rb/models/user_agent'
38
38
  require 'castle-rb/models/context'
39
39
  require 'castle-rb/models/user'
40
- require 'castle-rb/models/verification'
40
+ require 'castle-rb/models/authentication'
@@ -24,12 +24,12 @@ module Castle
24
24
  Castle::Event.create(opts)
25
25
  end
26
26
 
27
- def verify(opts = {})
28
- Castle::Verification.create(opts)
27
+ def authenticate(user_id)
28
+ Castle::Authentication.create(user_id: user_id)
29
29
  end
30
30
 
31
- def approve(opts = {})
32
- Castle::Verification.new('$current').approve
31
+ def authentication(authentication_id)
32
+ Castle::Authentication.find(authentication_id)
33
33
  end
34
34
 
35
35
  private
@@ -1,7 +1,9 @@
1
1
  module Castle
2
2
  class Authentication < Model
3
- instance_post :ok
4
- instance_post :bad
3
+ has_one :context
4
+
5
+ instance_post :allow
6
+ instance_post :deny
5
7
  instance_post :reset
6
8
  end
7
9
  end
@@ -53,7 +53,7 @@ module Castle
53
53
  # Add method call to instance: user.enable_something
54
54
  #
55
55
  class_eval <<-RUBY, __FILE__, __LINE__ + 1
56
- def #{action}(params={})
56
+ def #{action}!(params={})
57
57
  self.class.#{method}("\#{request_path}/#{action.to_s.delete('!')}", params)
58
58
  end
59
59
  RUBY
@@ -1,3 +1,3 @@
1
1
  module Castle
2
- VERSION = "1.2.5"
2
+ VERSION = "1.2.6"
3
3
  end
@@ -1,6 +1,6 @@
1
- describe Castle::Verification do
1
+ describe Castle::Authentication do
2
2
  it 'extends Castle::Model' do
3
- instance = Castle::Verification.new
3
+ instance = Castle::Authentication.new
4
4
  expect(instance).to be_a Castle::Model
5
5
  end
6
6
  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.5
4
+ version: 1.2.6
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-24 00:00:00.000000000 Z
11
+ date: 2015-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: her
@@ -170,7 +170,6 @@ files:
170
170
  - lib/castle-rb/models/model.rb
171
171
  - lib/castle-rb/models/user.rb
172
172
  - lib/castle-rb/models/user_agent.rb
173
- - lib/castle-rb/models/verification.rb
174
173
  - lib/castle-rb/request.rb
175
174
  - lib/castle-rb/support/cookie_store.rb
176
175
  - lib/castle-rb/support/padrino.rb
@@ -179,12 +178,12 @@ files:
179
178
  - lib/castle-rb/utils.rb
180
179
  - lib/castle-rb/version.rb
181
180
  - spec/models/account_spec.rb
181
+ - spec/models/authentication_spec.rb
182
182
  - spec/models/context_spec.rb
183
183
  - spec/models/event_spec.rb
184
184
  - spec/models/location_spec.rb
185
185
  - spec/models/user_agent_spec.rb
186
186
  - spec/models/user_spec.rb
187
- - spec/models/verification_spec.rb
188
187
  - spec/spec_helper.rb
189
188
  homepage: https://castle.io
190
189
  licenses:
@@ -212,10 +211,10 @@ specification_version: 4
212
211
  summary: Castle
213
212
  test_files:
214
213
  - spec/models/account_spec.rb
214
+ - spec/models/authentication_spec.rb
215
215
  - spec/models/context_spec.rb
216
216
  - spec/models/event_spec.rb
217
217
  - spec/models/location_spec.rb
218
218
  - spec/models/user_agent_spec.rb
219
219
  - spec/models/user_spec.rb
220
- - spec/models/verification_spec.rb
221
220
  - spec/spec_helper.rb
@@ -1,5 +0,0 @@
1
- module Castle
2
- class Verification < Model
3
- instance_post :approve
4
- end
5
- end