secretkey 1.1.0 → 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0badd0f70b5fd49d957918cfe2dcf5af65593288
4
- data.tar.gz: ce0587fcae07f03a4a7e8433812d7976bf8e9304
3
+ metadata.gz: cf61f7a13fe998dff0ca4b77cfb653c7eb8f7592
4
+ data.tar.gz: 9151480d9ceb538176ccd2ad2464c0a716ed57a1
5
5
  SHA512:
6
- metadata.gz: d5a6bea7288a1b38a7f6b5afb02a149a733d2edd87f2a0847d41f6b61285659dddd703298826c2de8a5e348e1188328c0f6c5b6d647faafbedafd86250635520
7
- data.tar.gz: 219a23ec4cb8543a1bbc06a8e0568852e15973b618ddc412741ba7973f8532b9c3cf66fa792f309d45267f087a03d5f82d31501668d971341549675ac2504073
6
+ metadata.gz: d38a85d3aee4bc2097858df5406ba82fafd1771d0135a1c2c308c8286d33b46a7207effab7a929d0cd68eb26c2d964e90aac1e13b26b807a325c1d7677fdad2b
7
+ data.tar.gz: 12b0fb63bfd3a469d94d0a0517a13220bc768fe456310d6fd01ffd3f011779e9e01e66aa78c53d7fa150d987a2934a9417867f67162a3592e37fdf61225290f6
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- secretkey (1.1.0)
4
+ secretkey (1.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/Readme.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # SecretKey
2
2
 
3
+ [![Code Climate](https://codeclimate.com/github/jobready/secretkey/badges/gpa.svg)](https://codeclimate.com/github/jobready/secretkey)
4
+ [![Test Coverage](https://codeclimate.com/github/jobready/secretkey/badges/coverage.svg)](https://codeclimate.com/github/jobready/secretkey)
5
+
3
6
  Ruby Gem for generating a unique access token when provided with an application id, application secret and timestamp
4
7
 
5
8
  ## Installation
@@ -40,11 +43,6 @@ Where:
40
43
  * `secret` - application secret
41
44
  * `timestamp` - an epoch timestamp in seconds i.e. 2014-07-24 14:03:30 +1000 would be 1406174610 in epoch format
42
45
 
43
-
44
- ## Development Guidelines
45
-
46
- * https://jobready.atlassian.net/wiki/display/DEV/Development+Guidelines
47
-
48
46
  ## Style guidelines
49
47
 
50
48
  We try to adhere to the following coding style guidelines
@@ -59,4 +57,4 @@ We try to adhere to the following coding style guidelines
59
57
  2. Create your feature branch (`git checkout -b my-new-feature`)
60
58
  3. Commit your changes (`git commit -am 'Add some feature'`)
61
59
  4. Push to the branch (`git push origin my-new-feature`)
62
- 5. Create new Pull Request
60
+ 5. Create new Pull Request
@@ -2,28 +2,18 @@ require 'digest'
2
2
 
3
3
  module SecretKey
4
4
  class SecretKey
5
+ attr_reader :key, :secret, :timestamp
6
+
7
+ def initialize(key, secret, timestamp: Time.now.to_i)
8
+ raise ArgumentError, 'Time Stamp is not a valid integer.' unless timestamp.is_a? Integer
5
9
 
6
- def initialize(key, secret, options={})
7
10
  @key = key
8
11
  @secret = secret
9
- @options = options
10
-
11
- extract_options!
12
+ @timestamp = timestamp
12
13
  end
13
14
 
14
15
  def token
15
- raise ArgumentError, 'Time Stamp is not a valid integer.' unless @timestamp.is_a? Integer
16
- Digest::SHA1.hexdigest("#{@key}:#{@secret}:#{@timestamp}")
17
- end
18
-
19
- def timestamp
20
- @timestamp ||= Time.now.to_i
21
- end
22
-
23
- private
24
-
25
- def extract_options!
26
- @timestamp = @options.fetch(:timestamp, timestamp)
16
+ Digest::SHA1.hexdigest("#{key}:#{secret}:#{timestamp}")
27
17
  end
28
18
  end
29
- end
19
+ end
@@ -1,3 +1,3 @@
1
1
  module SecretKey
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
@@ -31,9 +31,9 @@ describe SecretKey::SecretKey do
31
31
  let(:timestamp) { 'askdfjlakshfdkjasd' }
32
32
 
33
33
  it 'produces an Argument Error' do
34
- expect(lambda { secret_key.token }).to raise_error(ArgumentError, 'Time Stamp is not a valid integer.')
34
+ expect{ secret_key.token }.to raise_error(ArgumentError, 'Time Stamp is not a valid integer.')
35
35
  end
36
36
  end
37
37
  end
38
38
  end
39
- end
39
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: secretkey
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dinusha Bodhinayake
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-24 00:00:00.000000000 Z
11
+ date: 2014-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec