wavefront-sdk 3.3.0 → 3.3.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/HISTORY.md +3 -0
- data/lib/wavefront-sdk/defs/version.rb +1 -1
- data/lib/wavefront-sdk/query.rb +20 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2bbfb49f0c6292fa72ed5496a636e5627fc0a6a06df639f737703acff90600a9
|
4
|
+
data.tar.gz: 676f628b99a7618736f547c8de353b323a0bb0e0978a9a9aee42bc58c53abbae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bc53c1bab53f1a274dc225cadcedc4db619b3ecd6b6b26c89b55013b1829e805f45757d570413468bd347c1739b386a33fbdbe18a8f0890642fb16be7397b78
|
7
|
+
data.tar.gz: f9479dcefc166eb4a1463e06b8ad496fc90e18ebada48c69dce636942da4492bf9dd414b19bf1d03fdec744ff5294a52dcf122e886848eadb60d19997c7954c5
|
data/HISTORY.md
CHANGED
data/lib/wavefront-sdk/query.rb
CHANGED
@@ -76,9 +76,16 @@ module Wavefront
|
|
76
76
|
# Fake a response which looks like we get from all the other
|
77
77
|
# paths. The default response is a single array.
|
78
78
|
#
|
79
|
+
# I don't know if something has changed in the API, but sending
|
80
|
+
# a complete nonsense query like 'st("some.series")' returns an
|
81
|
+
# error message, but with a 200 code. So we fudge a 400 if we
|
82
|
+
# see a message.
|
83
|
+
#
|
79
84
|
def response_shim(body, status)
|
80
85
|
resp, err_msg = parsed_response(body)
|
81
86
|
|
87
|
+
status = 400 if status == 200 && !err_msg.empty?
|
88
|
+
|
82
89
|
{ response: resp,
|
83
90
|
status: { result: status == 200 ? 'OK' : 'ERROR',
|
84
91
|
message: err_msg,
|
@@ -87,11 +94,23 @@ module Wavefront
|
|
87
94
|
|
88
95
|
# A bad query doesn't send back a JSON object. It sends back a
|
89
96
|
# string with an embedded message.
|
97
|
+
# @return [Array] [parsed body of response, error_message]. One
|
98
|
+
# or the other
|
90
99
|
#
|
91
100
|
def parsed_response(body)
|
92
101
|
[JSON.parse(body), '']
|
93
102
|
rescue JSON::ParserError
|
94
|
-
['', body
|
103
|
+
['', extract_error_message(body)]
|
104
|
+
end
|
105
|
+
|
106
|
+
# There ought to be a message= block in the response, but
|
107
|
+
# sometimes there isn't. So far it seems that in this second
|
108
|
+
# case, the message is on its own line.
|
109
|
+
#
|
110
|
+
def extract_error_message(body)
|
111
|
+
body.match(/message='([^']+)'/).captures.first
|
112
|
+
rescue StandardError
|
113
|
+
body.lines.last.strip
|
95
114
|
end
|
96
115
|
end
|
97
116
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wavefront-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Fisher
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|