itriagetestrail 1.0.31 → 1.0.32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/itriagetestrail/testrail_binding.rb +28 -28
- data/lib/itriagetestrail/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad0376c30783bd5471cea76bb1b157e0b2333a584a7bec83702e87aa514bc852
|
4
|
+
data.tar.gz: ece4be458e080677840d9be9495ba87deb2589c1939c10778261b75f0bffc30e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92e1def1b82318ac9025e9f19f7c854260034d41a881541547e5312810a935cc2542245c8083db7dd101aa588cb46e2f86d18d5dbc41e7513efc1859de96826a
|
7
|
+
data.tar.gz: ccbec882b6cc2eb61c8659a788e2efcce921f38a06e89ae28561d1f260747501eada636f0b59d7af14dca974e89d0e347bf2bd321e031c09c230e18ee739f051
|
@@ -146,39 +146,39 @@ module TestRail
|
|
146
146
|
file.write("#{Time.now},#{endpoint}\n")
|
147
147
|
file.close
|
148
148
|
end
|
149
|
-
end
|
150
149
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
150
|
+
def cache_to_file(url, content)
|
151
|
+
Dir.mkdir('./tmp') unless File.exist?('./tmp')
|
152
|
+
filename = sanitize_filename(url)
|
153
|
+
file = File.open("./tmp/#{filename}", 'w')
|
154
|
+
file.write(content)
|
155
|
+
file.close
|
156
|
+
end
|
158
157
|
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
158
|
+
def read_cache(url)
|
159
|
+
filename = sanitize_filename(url)
|
160
|
+
return unless File.exist?("./tmp/#{filename}")
|
161
|
+
file = File.open("./tmp/#{filename}", 'r')
|
162
|
+
content = JSON.parse(file.read, :symbolize_names => true)
|
163
|
+
file.close
|
164
|
+
content
|
165
|
+
end
|
167
166
|
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
167
|
+
def sanitize_filename(filename)
|
168
|
+
# Split the name when finding a period which is preceded by some
|
169
|
+
# character, and is followed by some character other than a period,
|
170
|
+
# if there is no following period that is followed by something
|
171
|
+
# other than a period (yeah, confusing, I know)
|
172
|
+
fn = filename.split /(?<=.)\.(?=[^.])(?!.*\.[^.])/m
|
174
173
|
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
174
|
+
# We now have one or two parts (depending on whether we could find
|
175
|
+
# a suitable period). For each of these parts, replace any unwanted
|
176
|
+
# sequence of characters with an underscore
|
177
|
+
fn.map! { |s| s.gsub /[^a-z0-9\-]+/i, '_' }
|
179
178
|
|
180
|
-
|
181
|
-
|
179
|
+
# Finally, join the parts with a period and return the result
|
180
|
+
return fn.join '.'
|
181
|
+
end
|
182
182
|
end
|
183
183
|
|
184
184
|
class APIError < StandardError
|