numerousapp 1.2.0 → 1.2.1
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/numerousapp.rb +26 -5
- 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: 2cb812bb5dd0b6ff8eff69717086072183b6f403
|
4
|
+
data.tar.gz: f597ff55c83c748b333c715552540ae42d4c04e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62356ae9378340d0e2b3d82c617804a6bda4c5ed538da960202ce49d38acd349c9d4e8c201e6666cd2e638cbd5ccddc5317285d857192d40efd848dcecd43f3f
|
7
|
+
data.tar.gz: 4162109867626e763f8a70cb6e8176ffe504904f186c90c1f416c0f4a8332545a5e55f8568b91b480cc4ff5c54609a939008a306ef96e58d26cd5cf24d4d7f31
|
data/lib/numerousapp.rb
CHANGED
@@ -131,16 +131,16 @@ class NumerousClientInternals
|
|
131
131
|
apiKey = Numerous.numerousKey()
|
132
132
|
end
|
133
133
|
|
134
|
-
@serverName = server
|
135
134
|
@auth = { user: apiKey, password: "" }
|
136
135
|
u = URI.parse("https://"+server)
|
137
|
-
@
|
138
|
-
@
|
136
|
+
@serverName = server
|
137
|
+
@serverPort = u.port
|
139
138
|
|
140
139
|
@agentString = "NW-Ruby-NumerousClass/" + VersionString +
|
141
140
|
" (Ruby #{RUBY_VERSION}) NumerousAPI/v2"
|
142
141
|
|
143
142
|
@filterDuplicates = true # see discussion elsewhere
|
143
|
+
@need_restart = true # port will be opened in simpleAPI
|
144
144
|
|
145
145
|
# throttling.
|
146
146
|
# The arbitraryMaximum is just that: under no circumstances will we retry
|
@@ -212,7 +212,7 @@ class NumerousClientInternals
|
|
212
212
|
|
213
213
|
protected
|
214
214
|
|
215
|
-
VersionString = '
|
215
|
+
VersionString = '20150617-1.2.1'
|
216
216
|
|
217
217
|
MethMap = {
|
218
218
|
GET: Net::HTTP::Get,
|
@@ -373,7 +373,29 @@ class NumerousClientInternals
|
|
373
373
|
@statistics[:serverRequests] += 1
|
374
374
|
t0 = Time.now
|
375
375
|
begin
|
376
|
+
|
377
|
+
# see note immediately below re "need_restart"
|
378
|
+
# this is where the very FIRST start() happens but
|
379
|
+
# also where subsequent starts might be re-done after errors
|
380
|
+
|
381
|
+
if @need_restart or not @http.started?()
|
382
|
+
|
383
|
+
# starting a session turns on keep-alive...
|
384
|
+
@http = Net::HTTP.new(@serverName, @serverPort)
|
385
|
+
@http.use_ssl = true # always required by NumerousApp
|
386
|
+
@http = @http.start()
|
387
|
+
end
|
388
|
+
|
389
|
+
# A note on this need_restart true/false dance:
|
390
|
+
# I have to admit I'm not sure if this is necessary or if
|
391
|
+
# it is even a good/bad/irrelevant idea, but the concept
|
392
|
+
# here is that if an error is encountered we'll ditch
|
393
|
+
# the current start() session and make a new one next time
|
394
|
+
|
395
|
+
@need_restart = true # will redo session if raise out
|
376
396
|
resp = @http.request(rq)
|
397
|
+
@need_restart = false
|
398
|
+
|
377
399
|
rescue StandardError => e
|
378
400
|
# it's PDB (pretty bogus) that we have to rescue
|
379
401
|
# StandardError but the underlying http library can just throw
|
@@ -1332,7 +1354,6 @@ class NumerousMetric < NumerousClientInternals
|
|
1332
1354
|
val = self['value']
|
1333
1355
|
rslt += "'#{self['label']}' [#@id] = #{val}>"
|
1334
1356
|
rescue NumerousError => x
|
1335
|
-
puts(x.code)
|
1336
1357
|
if x.code == 400
|
1337
1358
|
rslt += "**INVALID-ID** '#@id'>"
|
1338
1359
|
elsif x.code == 404
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: numerousapp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Neil Webber
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Classes implementing the NumerousApp REST APIs for metrics. Requires
|
14
14
|
Ruby 2.x
|