nist_randomness_beacon 0.1.4 → 0.1.5

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: cb4c9ab099b786a6582add7da1fc9ddf4856da1b
4
- data.tar.gz: 1305bc7beb04b1b133a901a7b1b727820201dd05
3
+ metadata.gz: 4dca632c09a5bbdf7b85b95bff9c9a181e0b5fc0
4
+ data.tar.gz: c95bd5f406d9b316fb8f8ef920223f4f5cc0a9bd
5
5
  SHA512:
6
- metadata.gz: 325a56d7c0ba18536c74bf713538447cb90dcbc3d699e55cf97f4509289764f04abd7b6b913150e770c99053d94eb49aa9a55b62d512bcc8a28b067c5cd0e59c
7
- data.tar.gz: 5abc9b616f933f00ab2923be2fb33abf60c35ff78a6d9de5df4dfb1fa1a98406fa4768ca3427b627b31b5d3f1c3ac7bd697ba3b8b16ebb4604aa2f1e16570f27
6
+ metadata.gz: eb62047409e49b4dddd809a93cd8635caf9747b614e1c38370533d8159e2d3a52ce444a6f5c4fc59a659920befa914202b848698f1172642d66771d1dd045046
7
+ data.tar.gz: 1f83df04fe6103865b376a34b829edfb2537dd64f10f2e1fb795a34cb5aff8433d61bfcd62930e4b4c3fd77682ecdcc77847c7ed552bf9d035c8f432ae1e5926
@@ -19,8 +19,7 @@ module NISTRandomnessBeacon
19
19
  #
20
20
  def current
21
21
  response = self.class.get("#@uri/#@timestamp")
22
- raise ServiceError, response.body unless response.code.eql? 200
23
- NISTRandomnessBeacon::Record.new(response.parsed_response['record'])
22
+ create_new_record(response)
24
23
  end
25
24
 
26
25
  # Returns the Previous Record
@@ -28,8 +27,7 @@ module NISTRandomnessBeacon
28
27
  #
29
28
  def previous
30
29
  response = self.class.get("#@uri/previous/#@timestamp")
31
- raise ServiceError, response.body unless response.code.eql? 200
32
- NISTRandomnessBeacon::Record.new(response.parsed_response['record'])
30
+ create_new_record(response)
33
31
  end
34
32
 
35
33
  # Returns the Next Record
@@ -37,8 +35,7 @@ module NISTRandomnessBeacon
37
35
  #
38
36
  def next
39
37
  response = self.class.get("#@uri/next/#@timestamp")
40
- raise ServiceError, response.body unless response.code.eql? 200
41
- NISTRandomnessBeacon::Record.new(response.parsed_response['record'])
38
+ create_new_record(response)
42
39
  end
43
40
 
44
41
  # Returns the Last Record
@@ -46,8 +43,7 @@ module NISTRandomnessBeacon
46
43
  #
47
44
  def last
48
45
  response = self.class.get("#@uri/last")
49
- raise ServiceError, response.body unless response.code.eql? 200
50
- NISTRandomnessBeacon::Record.new(response.parsed_response['record'])
46
+ create_new_record(response)
51
47
  end
52
48
 
53
49
  # Returns the Start Chain Record
@@ -55,7 +51,13 @@ module NISTRandomnessBeacon
55
51
  #
56
52
  def start_chain
57
53
  response = self.class.get("#@uri/start-chain/#@timestamp")
58
- raise ServiceError, response.body unless response.code.eql? 200
54
+ create_new_record(response)
55
+ end
56
+
57
+ private
58
+
59
+ def create_new_record response, response_code=200
60
+ raise ServiceError, response.body unless response.code.eql? response_code
59
61
  NISTRandomnessBeacon::Record.new(response.parsed_response['record'])
60
62
  end
61
63
  end
@@ -1,3 +1,3 @@
1
1
  module NISTRandomnessBeacon
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nist_randomness_beacon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chase Southard
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-01-13 00:00:00.000000000 Z
12
+ date: 2015-01-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler