itriagetestrail 1.0.31 → 1.0.36

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
  SHA256:
3
- metadata.gz: ddb1242abc0ff09697334bb9ad6e3470cf09ef0e294f5a3b2547a1a6720cb2d3
4
- data.tar.gz: 99b08bd93f90d1b1f38cc8cee408fdcb301d5d4ff6f25cd3a53ed6792f304a7b
3
+ metadata.gz: 7d3fb08d0333d280c30606a5cd177b439f668a94a8683bf0099c47dac4b563cc
4
+ data.tar.gz: 9dd89450a238a488c46783754df2ca4c312301e2e9dd807b31d30f01b80430e7
5
5
  SHA512:
6
- metadata.gz: 21bbeeda1120f7154bbafd46c01c5215e1ea61d12ee80d4c0e85226d072f030ab57296bfc6b1d329ec979385646b8e7d7e125df86d3f5b6906c6df1252b77cd5
7
- data.tar.gz: 2613c0fc5457c8d58bed52887dc3d1d4362c5d1540b900f52fb425f541447814345a14d6dc71dab2e8fe212a09ad321d37458a0b3dd9aab944b5fb668309fab8
6
+ metadata.gz: 64729b306598a415b93d91869a57d0be086772f39fe235159be11b17ea3e88c48186189207fe125ab0d93d9d9640db9de0da1817a829e210de94c89c4e41ce6d
7
+ data.tar.gz: ed2d5d73ea6c95e07d56f0b8355e0ec73b9d09420c083517e92f7500efa10f9971bc1822c96daf8d8b94834f272b393d33c986659251151bcfeacfe2d99e2db9
@@ -49,7 +49,7 @@ module Itriagetestrail
49
49
  # This is the very first call to TestRail
50
50
  make_connection
51
51
  projects
52
- if @client.response_code == '200'
52
+ if @client.response_code == '200' || @client.response_code.nil?
53
53
  true
54
54
  else
55
55
  puts "**** TESTRAIL IS OFFLINE for maintenance or other reason with status code #{@client.response_code}"
@@ -133,7 +133,7 @@ module TestRail
133
133
  _error_check(response, result)
134
134
 
135
135
  if write_cache
136
- cache_to_file(url, result)
136
+ cache_to_file(uri, result)
137
137
  end
138
138
 
139
139
  result
@@ -146,39 +146,40 @@ module TestRail
146
146
  file.write("#{Time.now},#{endpoint}\n")
147
147
  file.close
148
148
  end
149
- end
150
149
 
151
- def cache_to_file(url, content)
152
- Dir.mkdir('./tmp') unless File.exist?('./tmp')
153
- filename = sanitize_filename(url)
154
- file = File.open("./tmp/#{filename}", 'w')
155
- file.write(content)
156
- file.close
157
- end
150
+ def cache_to_file(url, content)
151
+ payload = {'response' => content}
152
+ Dir.mkdir('./tmp') unless File.exist?('./tmp')
153
+ filename = sanitize_filename(url)
154
+ file = File.open("./tmp/#{filename}", 'w')
155
+ file.write(payload.to_json)
156
+ file.close
157
+ end
158
158
 
159
- def read_cache(url)
160
- filename = sanitize_filename(url)
161
- return unless File.exist?("./tmp/#{filename}")
162
- file = File.open("./tmp/#{filename}", 'r')
163
- content = JSON.parse(file.read, :symbolize_names => true)
164
- file.close
165
- content
166
- end
159
+ def read_cache(url)
160
+ filename = sanitize_filename(url)
161
+ return unless File.exist?("./tmp/#{filename}")
162
+ file = File.open("./tmp/#{filename}", 'r')
163
+ content = JSON.parse(file.read)
164
+ file.close
165
+ content[:response]
166
+ end
167
167
 
168
- def sanitize_filename(filename)
169
- # Split the name when finding a period which is preceded by some
170
- # character, and is followed by some character other than a period,
171
- # if there is no following period that is followed by something
172
- # other than a period (yeah, confusing, I know)
173
- fn = filename.split /(?<=.)\.(?=[^.])(?!.*\.[^.])/m
168
+ def sanitize_filename(filename)
169
+ # Split the name when finding a period which is preceded by some
170
+ # character, and is followed by some character other than a period,
171
+ # if there is no following period that is followed by something
172
+ # other than a period (yeah, confusing, I know)
173
+ fn = filename.split /(?<=.)\.(?=[^.])(?!.*\.[^.])/m
174
174
 
175
- # We now have one or two parts (depending on whether we could find
176
- # a suitable period). For each of these parts, replace any unwanted
177
- # sequence of characters with an underscore
178
- fn.map! { |s| s.gsub /[^a-z0-9\-]+/i, '_' }
175
+ # We now have one or two parts (depending on whether we could find
176
+ # a suitable period). For each of these parts, replace any unwanted
177
+ # sequence of characters with an underscore
178
+ fn.map! { |s| s.gsub /[^a-z0-9\-]+/i, '_' }
179
179
 
180
- # Finally, join the parts with a period and return the result
181
- return fn.join '.'
180
+ # Finally, join the parts with a period and return the result
181
+ return fn.join '.'
182
+ end
182
183
  end
183
184
 
184
185
  class APIError < StandardError
@@ -1,3 +1,3 @@
1
1
  module Itriagetestrail
2
- VERSION = '1.0.31'.freeze
2
+ VERSION = '1.0.36'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itriagetestrail
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.31
4
+ version: 1.0.36
5
5
  platform: ruby
6
6
  authors:
7
7
  - a801069