devise_latcheable 0.0.4 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9ff21ed48bbdb0853e49b4b49c588d1d22892b72
4
- data.tar.gz: 3d07d83c85858dec2d3fe2bfdb255d2ec68a7548
3
+ metadata.gz: 379693f10790abde6f4cf2e9599df5c81067d950
4
+ data.tar.gz: 77c901493d78beccf714f2c7aa54530b396fedf0
5
5
  SHA512:
6
- metadata.gz: 8fdc0cfb3deecc44fd40d1eb97f30dfbd05cc9b371ac428e7313a496e6031bd8abc3103f7c3ac126797b28c209c4b040824579f19da758439e18f4e10c274487
7
- data.tar.gz: 807430b08f84c521611996d214a1d55eb18927d2b5db2266d63e7afed312f8492fdd775627d34f86da19c66b8c6605e65ecfb49659f9e7b09f0fbb4c9544e1d1
6
+ metadata.gz: 73e7a69efcb758dbc818b930312c67ea66e38ab00c0f43495ce8f1fe6e0e47b900c89365a387eab6435bd31660a483e35bcf0d2e6f033095b47da1b3fd92e000
7
+ data.tar.gz: 4ab0b88692b79965c2e594b64ac32fdcdfc588344f60bf1c9332bd5b15650dedd815aaabb16ff1e629c34b5f47a6fe0113a9a896b4296b896be0ff7198443a5c
data/README.md CHANGED
@@ -107,6 +107,27 @@ user = User.find_by name: 'Test'
107
107
  user.latch_account_id
108
108
  ```
109
109
 
110
+ ### Methods on the users model
111
+
112
+ #### latch_pair!
113
+ Pairs an user with the server.
114
+ If an error occurs, it copies the error at errors base
115
+ so you can access it with model_instance.errors
116
+ On success, it sets latch_account_id to the value that
117
+ latch server sent on its response
118
+ @returns true on success, false otherwise
119
+
120
+ ### latch_unpair!
121
+ Removes the pairing from latch
122
+ If an error occurs, it copies the error at errors base
123
+ so you can access it with model_instance.errors
124
+ @returns true on success, false otherwise
125
+
126
+ ### latch_unlocked?
127
+ Checks if the app lock is open
128
+ @returns true if the latch is unlocked
129
+ @returns false if the latch is locked or if there was an error
130
+
110
131
  ## Demo
111
132
  There is a app already configured with devise and devise\_latcheable at
112
133
  [this repo](https://github.com/CarlosRdrz/latch_app) for demo and
@@ -7,7 +7,11 @@ module Devise
7
7
  resource = mapping.to.find_by(authentication_hash)
8
8
 
9
9
  if resource && validate(resource) { resource.latch_unlocked? }
10
- pass
10
+ if ::DeviseLatcheable.config['latch_only'] == true
11
+ success! resource
12
+ else
13
+ pass
14
+ end
11
15
  else
12
16
  fail 'Latch is locked. Unlock and try again.'
13
17
  end
@@ -1,3 +1,3 @@
1
1
  module DeviseLatcheable
2
- VERSION = "0.0.4".freeze
2
+ VERSION = "0.1.0".freeze
3
3
  end
@@ -1,3 +1,4 @@
1
1
  app_id: 'YOUR_APP_ID'
2
2
  app_secret: 'YOUR_APP_SECRET'
3
- always_enabled: true
3
+ always_enabled: true
4
+ latch_only: false
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise_latcheable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Rodriguez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-12 00:00:00.000000000 Z
11
+ date: 2015-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: devise