entp-multipass 1.0.1 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/VERSION.yml +1 -1
  2. data/lib/multipass.rb +21 -4
  3. metadata +2 -2
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 1
3
- :minor: 0
3
+ :minor: 1
4
4
  :patch: 1
data/lib/multipass.rb CHANGED
@@ -2,10 +2,25 @@ require 'ezcrypto'
2
2
  require 'time'
3
3
 
4
4
  class MultiPass
5
- class Invalid < StandardError; end
6
- class ExpiredError < Invalid; end
7
- class JSONError < Invalid; end
8
- class DecryptError < Invalid; end
5
+ class Invalid < StandardError
6
+ @@message = "The MultiPass token is invalid."
7
+
8
+ def message
9
+ @@message
10
+ end
11
+
12
+ alias to_s message
13
+ end
14
+
15
+ class ExpiredError < Invalid
16
+ @@message = "The MultiPass token has expired."
17
+ end
18
+ class JSONError < Invalid
19
+ @@message = "The decrypted MultiPass token is not valid JSON."
20
+ end
21
+ class DecryptError < Invalid
22
+ @@message = "The MultiPass token was not able to be decrypted."
23
+ end
9
24
 
10
25
  def self.encode(site_key, api_key, options = {})
11
26
  new(site_key, api_key).encode(options)
@@ -55,6 +70,8 @@ class MultiPass
55
70
  end
56
71
 
57
72
  options
73
+ rescue OpenSSL::CipherError
74
+ raise MultiPass::DecryptError
58
75
  end
59
76
 
60
77
  private
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: entp-multipass
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - rick
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-19 00:00:00 -07:00
12
+ date: 2009-05-20 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15