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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e778b64e5e08eca5fee8b818ddd9ece69f9b6777
4
- data.tar.gz: 06949113737a9413e4cdf04821e9caf33dd94307
3
+ metadata.gz: e218e44c99f35477998c66a5f0c78bc81d31a4eb
4
+ data.tar.gz: 884d82c5dfc0c5dfe1a2efb43a7a5accf3e0d2b5
5
5
  SHA512:
6
- metadata.gz: f8d336321d0f8ed2d749a55d3c58bfcdb467c013d63d9bb869ebff8b9ec498e21ee81a7452a3e0a74257de8acd4a8dbfdd813da136724430e84de384eaf3d367
7
- data.tar.gz: 43e493486f03b0d08196303b8076ef42bc7dc8d7e0b0dc584a287bc88f2bf95782c819f50028e24a548b5fd877bb5a4b73c59f4eeb9c20ac822326aeadba91e0
6
+ metadata.gz: c0fd5108ef1b8e9a80cf79f918d3091cc3e352ff3d279c90bd6d857e4aedc7a66065e2eee88558e066d871796090146e213b0eeb34f5c5b8262204ce5068d1b0
7
+ data.tar.gz: 5b6e2a02c965a70d653174ad65eb2e2c436a29071cd2abebcd718b08a435afa9a6a4a6200697debedf5db02e5b1105da33fcd970dbe081055666af25fc6f5da3
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Fridge
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
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.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-08 00:00:00.000000000 Z
11
+ date: 2014-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_config