userbin 1.4.3 → 1.4.4

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: 213cb349e7987434937ef6fd4483b78ae0f5b4b7
4
- data.tar.gz: 9f61c2eeb48ff12e2b9c22daf81dcab435699a53
3
+ metadata.gz: bfd28539bb9186bc657716210bd030988b426fc6
4
+ data.tar.gz: a96543da7ea30326ab56c7f44decfa1900fd34e4
5
5
  SHA512:
6
- metadata.gz: 87aaede95dd81c178b522c0b9a39e77d67803f7164106c825db47b07da2c3619860e758778c29c7c915a3e1ad7b0bff2ec5145ae81e11d3d7641f88bf729f9e7
7
- data.tar.gz: c3e27530f507731571a97320a75683bd16e13698118eadf2b16fb23ad8b7bfbf7759ef47bac05acc579e528a1f3f2431b3fb15d4dab4a7a6f7fae66f0f165381
6
+ metadata.gz: 5088cf23603aef48e2a00bd3ee2210a79c5da474ca972779bdcb5d44b94b2b97283441096487e024e5420b2c75e750500e6a9f59c4a008de9afc9907c7ee7daa
7
+ data.tar.gz: c55e51b05eada68f32b5a4ef52747b57e8d652090ed6e87432e97cb16a0ab8fa8395564caf53c59dcfd97a6a85cbc40943b355c5f69c6f6ac170d2349111fa7f
@@ -156,5 +156,8 @@ module Userbin
156
156
  session_token ? session_token.needs_challenge? : false
157
157
  end
158
158
 
159
+ def has_default_pairing?
160
+ session_token ? session_token.has_default_pairing? : false
161
+ end
159
162
  end
160
163
  end
@@ -23,7 +23,7 @@ module Userbin
23
23
  attr_accessor :request_timeout
24
24
 
25
25
  def initialize
26
- self.request_timeout = 2.0
26
+ self.request_timeout = 30.0
27
27
  end
28
28
 
29
29
  def api_secret
@@ -1,5 +1,12 @@
1
1
  require 'her'
2
2
 
3
+ class Her::Collection
4
+ # Call the overridden to_json in Userbin::Model
5
+ def to_json
6
+ self.map { |m| m.to_json }
7
+ end
8
+ end
9
+
3
10
  module Userbin
4
11
  class Model
5
12
  include Her::Model
@@ -11,6 +18,15 @@ module Userbin
11
18
  super(args)
12
19
  end
13
20
 
21
+ # Remove the auto-generated embedded User model to prevent recursion
22
+ def to_json
23
+ attrs = attributes
24
+ if attrs['user'] && attrs['user']['id'] == 'current'
25
+ attrs.delete 'user'
26
+ end
27
+ attrs.to_json
28
+ end
29
+
14
30
  METHODS.each do |method|
15
31
  class_eval <<-RUBY, __FILE__, __LINE__ + 1
16
32
  def self.instance_#{method}(action)
@@ -31,5 +31,9 @@ module Userbin
31
31
  def device_trusted?
32
32
  @jwt.payload['tru'] == 1
33
33
  end
34
+
35
+ def has_default_pairing?
36
+ @jwt.payload['dpr'] == 1
37
+ end
34
38
  end
35
39
  end
@@ -1,3 +1,3 @@
1
1
  module Userbin
2
- VERSION = "1.4.3"
2
+ VERSION = "1.4.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: userbin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3
4
+ version: 1.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-17 00:00:00.000000000 Z
11
+ date: 2014-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: her