wavefront-sdk 2.0.0 → 2.0.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: 78759a49a05aded24a69a8759c648c10c7e8f52857597a51ce73c3703d24b42a
4
- data.tar.gz: cb66061865a11ecef526e726cb804ca2ab1f2a75ba72224be1c6c20ca2dabfc9
3
+ metadata.gz: 16241d55b6fb10f87108746dc4af0a6d431a4af460c0d22298560cee4bd87bae
4
+ data.tar.gz: fd0744dee1842f0b216cfb2ebbf4050de3ccbc850a21960bc31ee609a440def6
5
5
  SHA512:
6
- metadata.gz: 6be149c21dd32ce4a6f8dd56843331fe08f8b508fd0894139bf6d09279a0061fbb280553cdb35f33e546c3124f4d4ebfa4eca7bedfa26ef1489a4d5f178ca238
7
- data.tar.gz: 41c617f4c39afd7e21965afe89521f17c2e8713c402c18259ca907b7dab09c29ba053f4497c14cbba5ec0601874a6aa37e18a81c5f26178dd85d737ef4d5df08
6
+ metadata.gz: 41986bead8043774efc06103d7d3ac577a311a94edf46d841bbed6d6959222babd6332aa9673a83abd3bb31ee6254b8781f693ee4d1bcc6190a90cbfccd4fc05
7
+ data.tar.gz: bbcdaf7a2b65c86c207a3b602f9eda625458520bf783490aa7a05c2c81ee6d1202fed397ee24927b2f9a51840f09bff46fa22b5c8b3db050b8e8a40b18bbe6f3
data/HISTORY.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Changelog
2
2
 
3
- ## 2.0.0
3
+ ## 2.0.1 (22/10/2018)
4
+ * Bugfix on response types.
5
+
6
+ ## 2.0.0 (20/10/2018)
4
7
  * Remove `#everything` method from all classes. (Breaking change.)
5
8
  * Calling any method which takes the `limit` argument with `limit`
6
9
  set to `:all` will automatically handle pagination, fetching all
@@ -38,6 +41,10 @@
38
41
  a hash of proxy *and* API credentials. This is useful for passing
39
42
  to `Wavefront::Write` as it means all writers will work without
40
43
  modifying your code.
44
+ * Make `Wavefront::Response#next_item` work with sources. (Or any
45
+ future class which uses a cursor rather than an offset.)
46
+ * Make `Wavefront::User` return a response object containing an
47
+ `items` element, like every other class.
41
48
 
42
49
  ## 1.6.2 (22/08/2018)
43
50
  * Drop log priority of write class messages.
@@ -66,14 +66,19 @@ module Wavefront
66
66
  def more_items?
67
67
  return false unless response.key?(:moreItems)
68
68
  !!response.moreItems
69
+ rescue StandardError
70
+ false
69
71
  end
70
72
 
71
- # On paginated output, the offset of the next item, or nil.
72
- # @return [Integer, Nil]
73
+ # On paginated output, the offset of the next item, or nil. For
74
+ # classes which use a cursor rather than an offset (Source),
75
+ # that.
76
+ # @return [Integer,String,Nil]
73
77
  #
74
78
  def next_item
75
79
  return nil unless more_items?
76
- reponse.offset + response.limit
80
+ return response.cursor if response.respond_to?(:cursor)
81
+ response.offset + response.limit
77
82
  rescue StandardError
78
83
  nil
79
84
  end
@@ -1 +1 @@
1
- WF_SDK_VERSION = '2.0.0'.freeze
1
+ WF_SDK_VERSION = '2.0.1'.freeze
@@ -58,9 +58,9 @@ module Wavefront
58
58
  def limit_and_offset(args)
59
59
  ret = { offset: nil, limit: nil }
60
60
 
61
- args.select { |a| a.is_a?(Hash) }.each_with_object(ret) do |arg|
62
- ret[:limit] = arg[:limit] if arg.key?(:limit)
63
- ret[:offset] = arg[:offset] if arg.key?(:offset)
61
+ args.select { |a| a.is_a?(Hash) }.each_with_object(ret) do |arg, a|
62
+ a[:limit] = arg[:limit] if arg.key?(:limit)
63
+ a[:offset] = arg[:offset] if arg.key?(:offset)
64
64
  end
65
65
  end
66
66
 
@@ -88,7 +88,13 @@ module Wavefront
88
88
  # consistent with others in the future.
89
89
  #
90
90
  def response_shim(body, status)
91
- { response: JSON.parse(body),
91
+ items = JSON.parse(body)
92
+
93
+ { response: { items: items,
94
+ offset: 0,
95
+ limit: items.size,
96
+ totalItems: items.size,
97
+ modeItems: false },
92
98
  status: { result: status == 200 ? 'OK' : 'ERROR',
93
99
  message: '',
94
100
  code: status } }.to_json
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: 2.0.0
4
+ version: 2.0.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: 2018-10-21 00:00:00.000000000 Z
11
+ date: 2018-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -240,7 +240,6 @@ files:
240
240
  - lib/wavefront-sdk/writers/socket.rb
241
241
  - lib/wavefront-sdk/writers/summary.rb
242
242
  - lib/wavefront_sdk.rb
243
- - pkg/wavefront-client-3.5.0.gem
244
243
  - spec/.rubocop.yml
245
244
  - spec/spec_helper.rb
246
245
  - spec/wavefront-sdk/alert_spec.rb