sigil 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sigil (1.0.3)
4
+ sigil (1.1.0)
5
5
  activesupport (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -1,9 +1,11 @@
1
1
  module Sigil
2
2
  class Base
3
+
3
4
  attr_reader :params, :key, :signature
4
5
 
5
6
  def initialize(params, key)
6
7
  raise Sigil::Error, "Params must be a Hash" unless params.kind_of?(Hash)
8
+
7
9
  @params = params.to_options!
8
10
  @key = key.to_s
9
11
  @signature = nil
@@ -17,6 +19,7 @@ module Sigil
17
19
  unless @signature
18
20
  @signature = self.class.sign(self.to_query, @key).to_s
19
21
  end
22
+
20
23
  @signature
21
24
  end
22
25
 
@@ -31,5 +34,14 @@ module Sigil
31
34
 
32
35
  signature == provided_signature
33
36
  end
37
+
38
+ def verify!(provided_signature)
39
+ verified = verify(provided_signature)
40
+
41
+ raise Sigil::Error, "Signature does not match" unless verified
42
+
43
+ true
44
+ end
45
+
34
46
  end
35
- end
47
+ end
@@ -1,3 +1,4 @@
1
1
  module Sigil
2
- class Error < StandardError; end
3
- end
2
+ class Error < StandardError
3
+ end
4
+ end
@@ -1,3 +1,3 @@
1
1
  module Sigil
2
- VERSION = "1.0.3"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sigil
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-03-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &70188918963180 !ruby/object:Gem::Requirement
16
+ requirement: &70215850260340 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70188918963180
24
+ version_requirements: *70215850260340
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &70188918962460 !ruby/object:Gem::Requirement
27
+ requirement: &70215850259820 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 2.1.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70188918962460
35
+ version_requirements: *70215850259820
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
- requirement: &70188918961980 !ruby/object:Gem::Requirement
38
+ requirement: &70215850259340 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: 1.0.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70188918961980
46
+ version_requirements: *70215850259340
47
47
  description: Signs and verifies a set of parameters
48
48
  email:
49
49
  - steve@seven.net.nz