fridge 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fridge/access_token.rb +9 -1
- data/lib/fridge/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e218e44c99f35477998c66a5f0c78bc81d31a4eb
|
4
|
+
data.tar.gz: 884d82c5dfc0c5dfe1a2efb43a7a5accf3e0d2b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0fd5108ef1b8e9a80cf79f918d3091cc3e352ff3d279c90bd6d857e4aedc7a66065e2eee88558e066d871796090146e213b0eeb34f5c5b8262204ce5068d1b0
|
7
|
+
data.tar.gz: 5b6e2a02c965a70d653174ad65eb2e2c436a29071cd2abebcd718b08a435afa9a6a4a6200697debedf5db02e5b1105da33fcd970dbe081055666af25fc6f5da3
|
data/lib/fridge/access_token.rb
CHANGED
@@ -2,11 +2,13 @@ require 'jwt'
|
|
2
2
|
|
3
3
|
module Fridge
|
4
4
|
class AccessToken
|
5
|
-
attr_accessor :id, :issuer, :subject, :scope, :expires_at
|
5
|
+
attr_accessor :id, :issuer, :subject, :scope, :expires_at, :jwt
|
6
6
|
|
7
|
+
# rubocop:disable MethodLength
|
7
8
|
def initialize(jwt_or_options = nil)
|
8
9
|
options = case jwt_or_options
|
9
10
|
when String
|
11
|
+
self.jwt = jwt_or_options
|
10
12
|
validate_public_key!
|
11
13
|
decode_and_verify(jwt_or_options)
|
12
14
|
when Hash then jwt_or_options
|
@@ -16,8 +18,14 @@ module Fridge
|
|
16
18
|
instance_variable_set("@#{key}", value)
|
17
19
|
end
|
18
20
|
end
|
21
|
+
# rubocop:enable MethodLength
|
22
|
+
|
23
|
+
def to_s
|
24
|
+
serialize
|
25
|
+
end
|
19
26
|
|
20
27
|
def serialize
|
28
|
+
return jwt if jwt
|
21
29
|
validate_parameters!
|
22
30
|
validate_private_key!
|
23
31
|
encode_and_sign
|
data/lib/fridge/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fridge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank Macreery
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_config
|