wavefront-sdk 5.2.1 → 5.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e623522f872c4204c1e723ee5a399c513251933e64445f6f5b65ff66d2fbffc
4
- data.tar.gz: 6f55f44177169c24d4c0aa89490464097a6fe2278e24a1e3b83e5f7520757dfd
3
+ metadata.gz: 9589c220f3c1cb86c7e3c4e3f051315508358580656e61e61d716a756568e9a4
4
+ data.tar.gz: 03b24e65b9617170af9b03eadae0d7cbd9d78cea99f1be60f8452ef79989d81d
5
5
  SHA512:
6
- metadata.gz: 58bb998cc92b36c369497631f766af8844a692fbd10508962ee7bd30f4fbe65d222bc512d06b63feb19ca94cdcc4e8429b8c61f6227e4ff1041cd6ffff141758
7
- data.tar.gz: 198dfadd7561b5c3772211716d23f9653ace3bbf472e41d12fa8b64d744ed16567bb11796ef3aff252054bc0945200ea71e454b5989824656c178e74503b4675
6
+ metadata.gz: 9ea8ef64251bb430053390d991a16024f1d1545524fe36479a5369c94dcf87669bb77a1cfab92395e2cdd6e23d10fa6c38738fe7227a6e572e0630f35830afca
7
+ data.tar.gz: b85aa3b9a03e338b4db8fc702bb0b03532d1eaa7618e044f10a7dbc9a973ffebdeaa4891f4a02c717e7c59db280cee551b8765d6cf8dee2f8fe630f6d5bb4201
@@ -2,9 +2,9 @@ language: ruby
2
2
  cache: bundler
3
3
  rvm:
4
4
  - 2.4.9
5
- - 2.5.7
6
- - 2.6.5
7
- - 2.7.0
5
+ - 2.5.8
6
+ - 2.6.6
7
+ - 2.7.2
8
8
  before_install: gem install bundler --no-document
9
9
  deploy:
10
10
  provider: rubygems
@@ -14,7 +14,7 @@ deploy:
14
14
  on:
15
15
  tags: true
16
16
  repo: snltd/wavefront-sdk
17
- ruby: 2.6.5
17
+ ruby: 2.6.6
18
18
  notifications:
19
19
  email: false
20
20
  slack:
data/HISTORY.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.3.0 (2020-10-10)
4
+ * Add `Wavefront::Proxy#shutdown` which can shut down a proxy via the API.
5
+
3
6
  ## 5.2.1 (2020-09-18)
4
7
  * Remove necessity for user to `require 'pathname'`
5
8
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  require 'pathname'
4
4
 
5
- WF_SDK_VERSION = '5.2.1'
5
+ WF_SDK_VERSION = '5.3.0'
6
6
  WF_SDK_LOCATION = Pathname.new(__dir__).parent.parent.parent
@@ -50,7 +50,7 @@ module Wavefront
50
50
  def body_as(desired, args, index = 1)
51
51
  body = args[index]
52
52
 
53
- return args if body.class == desired
53
+ return args if body.instance_of?(desired)
54
54
 
55
55
  args[index] = body_as_json(body)
56
56
  args
@@ -86,5 +86,15 @@ module Wavefront
86
86
  wf_proxy_id?(id)
87
87
  api.put(id, payload)
88
88
  end
89
+
90
+ # Shutdown a proxy. Requires proxy >=5.x. Might not be effective if you
91
+ # have something like systemd or SMF restarting a failed proxy.
92
+ # @param id [String] ID of the proxy
93
+ # @return [Wavefront::Response]
94
+ #
95
+ def shutdown(id)
96
+ wf_proxy_id?(id)
97
+ api.put(id, { shutdown: true }, 'application/json')
98
+ end
89
99
  end
90
100
  end
@@ -23,7 +23,7 @@ module Wavefront
23
23
  # @raise Wavefront::InvalidTimestamp
24
24
  #
25
25
  def parse_time(time, in_ms = false)
26
- return relative_time(time, in_ms) if time.to_s =~ /^[\-+]/
26
+ return relative_time(time, in_ms) if time.to_s.match?(/^[\-+]/)
27
27
 
28
28
  ParseTime.new(time, in_ms).parse!
29
29
  end
@@ -34,7 +34,7 @@ module Wavefront
34
34
  # @return [Fixnum] timestamp
35
35
  #
36
36
  def parse_time_string
37
- return t.to_i if t =~ /^\d+$/
37
+ return t.to_i if t.match?(/^\d+$/)
38
38
 
39
39
  @t = Time.parse("#{t} #{Time.now.getlocal.zone}")
40
40
  parse_time_time
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require_relative '../spec_helper'
5
+ require_relative '../../lib/wavefront-sdk/defs/version'
6
+
7
+ # Tests for things that aren't in the SDK itself.
8
+ #
9
+ class WavefrontMiscTest < MiniTest::Test
10
+ # Check the latest version mentioned in the changelog is the version the SDK
11
+ # defines itself as.
12
+ #
13
+ def test_version_vs_history
14
+ history_file = WF_SDK_LOCATION + 'HISTORY.md'
15
+ history_vers = IO.read(history_file).match(/^## (\d+\.\d+\.\d+) \(/)
16
+ assert_equal(WF_SDK_VERSION, history_vers.captures.first)
17
+ end
18
+ end
@@ -21,6 +21,12 @@ class WavefrontProxyTest < WavefrontTestBase
21
21
  assert_raises(ArgumentError) { wf.rename }
22
22
  end
23
23
 
24
+ def test_shutdown
25
+ assert_puts("/api/v2/proxy/#{id}", { shutdown: true }.to_json, :json) do
26
+ wf.shutdown(id)
27
+ end
28
+ end
29
+
24
30
  private
25
31
 
26
32
  def api_class
@@ -23,16 +23,16 @@ Gem::Specification.new do |gem|
23
23
  gem.bindir = 'bin'
24
24
 
25
25
  gem.add_dependency 'addressable', '~> 2.7'
26
- gem.add_dependency 'faraday', '~> 1.0'
26
+ gem.add_dependency 'faraday', '~> 1.1'
27
27
  gem.add_dependency 'inifile', '~> 3.0'
28
28
  gem.add_dependency 'map', '~> 6.6'
29
29
 
30
30
  gem.add_development_dependency 'minitest', '~> 5.14'
31
31
  gem.add_development_dependency 'rake', '~> 13.0'
32
- gem.add_development_dependency 'rubocop', '0.91.0'
32
+ gem.add_development_dependency 'rubocop', '1.0'
33
33
  gem.add_development_dependency 'simplecov', '~> 0.18'
34
34
  gem.add_development_dependency 'spy', '1.0.0'
35
- gem.add_development_dependency 'webmock', '~> 3.8'
35
+ gem.add_development_dependency 'webmock', '~> 3.9'
36
36
  gem.add_development_dependency 'yard', '~> 0.9'
37
37
 
38
38
  gem.required_ruby_version = Gem::Requirement.new('>= 2.4.0')
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: 5.2.1
4
+ version: 5.3.0
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-09-19 00:00:00.000000000 Z
11
+ date: 2020-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.0'
33
+ version: '1.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.0'
40
+ version: '1.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: inifile
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: 0.91.0
103
+ version: '1.0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - '='
109
109
  - !ruby/object:Gem::Version
110
- version: 0.91.0
110
+ version: '1.0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: simplecov
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -142,14 +142,14 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '3.8'
145
+ version: '3.9'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '3.8'
152
+ version: '3.9'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: yard
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -276,6 +276,7 @@ files:
276
276
  - spec/wavefront-sdk/message_spec.rb
277
277
  - spec/wavefront-sdk/metric_helper_spec.rb
278
278
  - spec/wavefront-sdk/metric_spec.rb
279
+ - spec/wavefront-sdk/misc_spec.rb
279
280
  - spec/wavefront-sdk/notificant_spec.rb
280
281
  - spec/wavefront-sdk/paginator/base_spec.rb
281
282
  - spec/wavefront-sdk/paginator/post_spec.rb
@@ -373,6 +374,7 @@ test_files:
373
374
  - spec/wavefront-sdk/message_spec.rb
374
375
  - spec/wavefront-sdk/metric_helper_spec.rb
375
376
  - spec/wavefront-sdk/metric_spec.rb
377
+ - spec/wavefront-sdk/misc_spec.rb
376
378
  - spec/wavefront-sdk/notificant_spec.rb
377
379
  - spec/wavefront-sdk/paginator/base_spec.rb
378
380
  - spec/wavefront-sdk/paginator/post_spec.rb