Module: Devise::Latch
- Defined in:
- lib/devise_latcheable/adapter.rb
Class Method Summary collapse
- .config ⇒ Object
-
.pair(code) ⇒ Object
> Pairs an user with the server.
-
.unlocked?(account_id) ⇒ Boolean
> Checks if the app lock is open.
-
.unpair(account_id) ⇒ Object
> Removes the pairing from lath.
Class Method Details
.config ⇒ Object
30 31 32 |
# File 'lib/devise_latcheable/adapter.rb', line 30 def self.config @yaml_config end |
.pair(code) ⇒ Object
> Pairs an user with the server.
@returns Account ID on success and nil on failure
8 9 10 11 12 |
# File 'lib/devise_latcheable/adapter.rb', line 8 def self.pair(code) res = @latch_instance.pair code return nil if res.data.nil? res.data['accountId'] end |
.unlocked?(account_id) ⇒ Boolean
> Checks if the app lock is open
15 16 17 18 19 20 21 22 |
# File 'lib/devise_latcheable/adapter.rb', line 15 def self.unlocked?(account_id) res = @latch_instance.status account_id return false unless res.error.nil? key = res.data['operations'].keys.first status = res.data['operations'][key]['status'] status == 'on' end |
.unpair(account_id) ⇒ Object
> Removes the pairing from lath
25 26 27 28 |
# File 'lib/devise_latcheable/adapter.rb', line 25 def self.unpair(account_id) res = @latch_instance.unpair account_id res.error.nil? ? true : false end |