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 +4 -4
- data/lib/codelocks/net_code.rb +10 -10
- data/lib/codelocks/version.rb +1 -1
- data/spec/codelocks/net_code_spec.rb +7 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 942e0ab01d08a84e11c8ee88f33e54cbb4b09ce0
|
4
|
+
data.tar.gz: d8b9ccdd9cb3a98d823d8968e189d7e04736bd37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecef1817e171e5eabb3fbb98af6e034a7b1b2b0ed5623cbde5bb42171439caded7f9a2378188386ec45e7650f195a5f7828f6f65b8624c0ba5ed3c912a501f35
|
7
|
+
data.tar.gz: f96d2cb8b885faab9e852f79e12019ee3a26de4b24f41fa26098bdc52ba187541fefd6abd6945ddbbd29f3ad4192b4caaa6d1bf7455ea95957f89930b1c9314d
|
data/lib/codelocks/net_code.rb
CHANGED
@@ -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
|
-
|
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
|
-
#
|
135
|
+
# Return the duration used for URM requests
|
132
136
|
#
|
133
137
|
# @return [Integer]
|
134
138
|
|
135
|
-
def
|
136
|
-
|
137
|
-
19
|
138
|
-
else
|
139
|
-
0
|
140
|
-
end
|
139
|
+
def urm_duration
|
140
|
+
37
|
141
141
|
end
|
142
142
|
end
|
143
143
|
end
|
data/lib/codelocks/version.rb
CHANGED
@@ -139,26 +139,26 @@ describe Codelocks::NetCode do
|
|
139
139
|
let(:urm) { true }
|
140
140
|
|
141
141
|
context "zero duration" do
|
142
|
-
it "
|
142
|
+
it "returns 37" do
|
143
143
|
allow(netcode).to receive(:duration) { 0 }
|
144
|
-
expect(netcode.duration_id).to eq
|
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
|
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
|
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
|
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
|
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
|
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.
|
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-
|
11
|
+
date: 2016-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|