codelocks 2.0.1 → 2.0.2

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: d27e94bc57da8ea83bbcf63e794be0d0c6f5d1e5
4
- data.tar.gz: bf495fb04c611c200233b473a60d855acb4eeaf4
3
+ metadata.gz: 942e0ab01d08a84e11c8ee88f33e54cbb4b09ce0
4
+ data.tar.gz: d8b9ccdd9cb3a98d823d8968e189d7e04736bd37
5
5
  SHA512:
6
- metadata.gz: 95f48d22e4d2979efca633bbf8001fd44e91d6c903d95ad1173fd778320da837f225150497be7596b8a79cdaad69f378717930f28c9d80f528bbdff9aa16252b
7
- data.tar.gz: 9561d1c9d6f07376d2eb1da3119a894d14c23870cb800ef2fbccf9b26e111d68eefaafc41cad3dec42133240fe32ca0e6f823607f5b62f411c72fe7b4dcfd31b
6
+ metadata.gz: ecef1817e171e5eabb3fbb98af6e034a7b1b2b0ed5623cbde5bb42171439caded7f9a2378188386ec45e7650f195a5f7828f6f65b8624c0ba5ed3c912a501f35
7
+ data.tar.gz: f96d2cb8b885faab9e852f79e12019ee3a26de4b24f41fa26098bdc52ba187541fefd6abd6945ddbbd29f3ad4192b4caaa6d1bf7455ea95957f89930b1c9314d
@@ -60,7 +60,7 @@ module Codelocks
60
60
  # @return [String]
61
61
 
62
62
  def start_date
63
- start.strftime("%Y-%m-%d")
63
+ start.strftime("%Y-%m-%d") unless start.nil?
64
64
  end
65
65
 
66
66
  # String representing the start time. Hour has a leading zero
@@ -71,7 +71,7 @@ module Codelocks
71
71
  if urm? && duration_id >= 31 # URM enabled and >= 24 hours duration
72
72
  "00:00"
73
73
  else
74
- start.strftime("%H:%M")
74
+ start.strftime("%H:%M") unless start.nil? unless start.nil? unless start.nil? unless start.nil?
75
75
  end
76
76
  end
77
77
 
@@ -88,7 +88,11 @@ module Codelocks
88
88
  # @return [Integer]
89
89
 
90
90
  def duration_id
91
- base_duration + urm_offset
91
+ if urm?
92
+ urm_duration
93
+ else
94
+ base_duration
95
+ end
92
96
  end
93
97
 
94
98
  # Are URM codes enabled?
@@ -128,16 +132,12 @@ module Codelocks
128
132
  end
129
133
  end
130
134
 
131
- # Convert a URM enabled boolean to a NetCode duration offset
135
+ # Return the duration used for URM requests
132
136
  #
133
137
  # @return [Integer]
134
138
 
135
- def urm_offset
136
- if urm?
137
- 19
138
- else
139
- 0
140
- end
139
+ def urm_duration
140
+ 37
141
141
  end
142
142
  end
143
143
  end
@@ -1,3 +1,3 @@
1
1
  module Codelocks
2
- VERSION = "2.0.1"
2
+ VERSION = "2.0.2"
3
3
  end
@@ -139,26 +139,26 @@ describe Codelocks::NetCode do
139
139
  let(:urm) { true }
140
140
 
141
141
  context "zero duration" do
142
- it "return 19" do
142
+ it "returns 37" do
143
143
  allow(netcode).to receive(:duration) { 0 }
144
- expect(netcode.duration_id).to eq 19
144
+ expect(netcode.duration_id).to eq 37
145
145
  end
146
146
  end
147
147
 
148
148
  context "up to half a day" do
149
- it "returns 19 minus one from the duration" do
149
+ it "returns 37" do
150
150
  (1..12).each do |i|
151
151
  allow(netcode).to receive(:duration) { i }
152
- expect(netcode.duration_id).to eq 19 + i - 1
152
+ expect(netcode.duration_id).to eq 37
153
153
  end
154
154
  end
155
155
  end
156
156
 
157
157
  context "whole days" do
158
- it "returns number of days counting from 30" do
158
+ it "returns 37" do
159
159
  (1..7).each do |i|
160
160
  allow(netcode).to receive(:duration) { i * 24 }
161
- expect(netcode.duration_id).to eq 19 + 11 + i
161
+ expect(netcode.duration_id).to eq 37
162
162
  end
163
163
  end
164
164
  end
@@ -166,7 +166,7 @@ describe Codelocks::NetCode do
166
166
  context "over 7 days" do
167
167
  it "returns 37" do
168
168
  allow(netcode).to receive(:duration) { 8 * 24 }
169
- expect(netcode.duration_id).to eq 19 + 18
169
+ expect(netcode.duration_id).to eq 37
170
170
  end
171
171
  end
172
172
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codelocks
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert May
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-03 00:00:00.000000000 Z
11
+ date: 2016-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler