wavefront-sdk 3.7.0 → 3.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e89654234db4200e7ec25767b81eeda772092642cb238d9cf908e38e851a8755
4
- data.tar.gz: 4de9bfd19d39da4b6e2d6b529614cc1962d8c5915ba92c82bfed736737fc7d28
3
+ metadata.gz: f8a2c03d2fff24c9d9c986c89203a60dd5535d93c5df5018fc7fdb9fcd4a50a8
4
+ data.tar.gz: 2957c881c681837d8e90f0c83b635a62e59d5806091f74f9861a4561f8422a83
5
5
  SHA512:
6
- metadata.gz: 34cf2716c935b469ec385e84445b8f2dec33e29679b6bd3cbe5bd11fff459301535c2acaf06fcfc682854df418577a810b20f4a579d1208fd63542af97ea2dee
7
- data.tar.gz: 1d5c66c6b47015f66a07cc64acdef74e8e661fbdda138746028d3885023e36cafb895950ac6d633c27012f5a13c2380f8827072dca2a59afef8a583a2b3a1453
6
+ metadata.gz: 80ffca53940c2d25cdaf6c5248fa0a5eddcbeeed7fc390d1f79405a2bf55fc9b1981624082891aa994e5e243238a37046ddb470829c5eb1140f37fef4dc6a520
7
+ data.tar.gz: 4b68cae0043168eba7232296c15916a5d7e872cec758a217e8824e78a6a4945569d7d8d8e030a999b2cfb83aab2636617eb94fda12352c6985ce532a7206b416
data/HISTORY.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.7.1 (2020-02-09)
4
+ * `Response` object returned by `Wavefront::Write#write` includes a valid HTTP
5
+ code, rather than `nil`.
6
+
3
7
  ## 3.7.0 (2020-01-23)
4
8
  * Add `Account`, `Usage` and `IngestionPolicy` classes.
5
9
  * Allow modification of `Wavefront::Response`'s `response` object.
@@ -2,5 +2,5 @@
2
2
 
3
3
  require 'pathname'
4
4
 
5
- WF_SDK_VERSION = '3.7.0'
5
+ WF_SDK_VERSION = '3.7.1'
6
6
  WF_SDK_LOCATION = Pathname.new(__dir__).parent.parent.parent
@@ -107,12 +107,14 @@ module Wavefront
107
107
  end
108
108
 
109
109
  # Compound the responses of all chunked writes into one. It will
110
- # be 'ok' only if *everything* passed.
110
+ # be 'ok' only if *everything* passed. Returns 400 as the HTTP code on
111
+ # error, regardless of what actual errors occurred.
111
112
  # @param responses [Array[Wavefront::Response]]
112
113
  # @return Wavefront::Response
113
114
  #
114
115
  def composite_response(responses)
115
- result = responses.all?(&:ok?) ? 'OK' : 'ERROR'
116
+ result, code = response_codes(responses)
117
+
116
118
  summary = { sent: 0, rejected: 0, unsent: 0 }
117
119
 
118
120
  %i[sent rejected unsent].each do |k|
@@ -120,7 +122,7 @@ module Wavefront
120
122
  end
121
123
 
122
124
  Wavefront::Response.new(
123
- { status: { result: result, message: nil, code: nil },
125
+ { status: { result: result, message: nil, code: code },
124
126
  response: summary.to_h }.to_json, nil
125
127
  )
126
128
  end
@@ -246,5 +248,13 @@ module Wavefront
246
248
  rescue LoadError
247
249
  raise(Wavefront::Exception::UnsupportedWriter, writer)
248
250
  end
251
+
252
+ def response_codes(responses)
253
+ if responses.all?(&:ok?)
254
+ ['OK', 200]
255
+ else
256
+ ['ERROR', 400]
257
+ end
258
+ end
249
259
  end
250
260
  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.7.0
4
+ version: 3.7.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: 2020-01-23 00:00:00.000000000 Z
11
+ date: 2020-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable