wavefront-sdk 2.5.1 → 3.0.0
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/.rubocop.yml +2 -1
- data/.travis.yml +4 -5
- data/HISTORY.md +10 -0
- data/README.md +1 -1
- data/lib/wavefront-sdk/core/api_caller.rb +29 -5
- data/lib/wavefront-sdk/dashboard.rb +60 -0
- data/lib/wavefront-sdk/defs/version.rb +4 -1
- data/lib/wavefront-sdk/distribution.rb +2 -2
- data/lib/wavefront-sdk/paginator/base.rb +1 -1
- data/lib/wavefront-sdk/search.rb +8 -2
- data/lib/wavefront-sdk/settings.rb +51 -0
- data/lib/wavefront-sdk/types/status.rb +3 -1
- data/lib/wavefront-sdk/validators.rb +2 -2
- data/lib/wavefront-sdk/write.rb +2 -2
- data/spec/wavefront-sdk/core/response_spec.rb +21 -2
- data/spec/wavefront-sdk/dashboard_spec.rb +56 -0
- data/spec/wavefront-sdk/search_spec.rb +3 -0
- data/spec/wavefront-sdk/settings_spec.rb +31 -0
- data/wavefront-sdk.gemspec +3 -6
- metadata +9 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '048989974d0868e696c8f50dc59007960e2456ca0e9ccb64d632b83d854124bf'
|
4
|
+
data.tar.gz: 66bc38c3d72355594b51aa5cbe9b34ab069f158cc133f168c94ba28f25dde79d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4026c3af06d8e8d3de5a13f02cbc006072fe6852d95a04219b91383db003b97516ee56fd12abf1c2f47a34e238a38fd75dd02707e385b1e9c474c7d1acb0dca
|
7
|
+
data.tar.gz: fe902524b8af12691cbe40d50ffcb2f24b3aac5b35472743c9774009a33e464e621d6879e806ac0d41c20f71c1b54d3ebfd30e089ed43b029984afb205f08125
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
language: ruby
|
2
2
|
cache: bundler
|
3
3
|
rvm:
|
4
|
-
- 2.2.10
|
5
4
|
- 2.3.8
|
6
5
|
- 2.4.5
|
7
|
-
- 2.5.
|
8
|
-
- 2.6.
|
9
|
-
before_install: gem install bundler
|
6
|
+
- 2.5.5
|
7
|
+
- 2.6.2
|
8
|
+
before_install: gem install bundler --no-document
|
10
9
|
deploy:
|
11
10
|
provider: rubygems
|
12
11
|
api_key:
|
@@ -15,7 +14,7 @@ deploy:
|
|
15
14
|
on:
|
16
15
|
tags: true
|
17
16
|
repo: snltd/wavefront-sdk
|
18
|
-
ruby: 2.
|
17
|
+
ruby: 2.6.2
|
19
18
|
notifications:
|
20
19
|
email: false
|
21
20
|
slack:
|
data/HISTORY.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
# 3.0.0
|
4
|
+
* Drop support for Ruby 2.2. (Potentially breaking change.)
|
5
|
+
* Add `Wavefront::Settings` class to cover new `settings` API
|
6
|
+
endpoint.
|
7
|
+
* Add ACL methods to `Wavefront::Dashboard` class.
|
8
|
+
* Add `Dashboard#favourite` and `Dashboard#unfavourite` methods, as
|
9
|
+
aliases to `favorite` and `unfavorite`.
|
10
|
+
* Add `sort_field` to `Wavefront::Search` options. Lets user select
|
11
|
+
the field on which to sort results.
|
12
|
+
|
3
13
|
## 2.5.1 (06/03/2019)
|
4
14
|
* Fix messy handling of raw query errors.
|
5
15
|
|
data/README.md
CHANGED
@@ -24,7 +24,7 @@ or to build locally,
|
|
24
24
|
$ gem build wavefront-sdk.gemspec
|
25
25
|
```
|
26
26
|
|
27
|
-
`wavefront-sdk` requires Ruby >= 2.
|
27
|
+
`wavefront-sdk` requires Ruby >= 2.3. All its dependencies are pure
|
28
28
|
Ruby, right the way down, so a compiler should never be required to
|
29
29
|
install it.
|
30
30
|
|
@@ -39,14 +39,17 @@ module Wavefront
|
|
39
39
|
# root of the URI is dynamically derived by the #setup_endpoint
|
40
40
|
# method.
|
41
41
|
#
|
42
|
+
# @param path [String] uri path
|
42
43
|
# @param headers [Hash] additional headers
|
44
|
+
# @param request_opts [Hash] Faraday request parameters
|
43
45
|
# @return [URI::HTTPS]
|
44
46
|
#
|
45
|
-
def mk_conn(path, headers = {})
|
47
|
+
def mk_conn(path, headers = {}, opts = {})
|
46
48
|
url = format('%s://%s%s', net[:scheme], net[:endpoint],
|
47
49
|
[net[:api_base], path].uri_concat)
|
48
|
-
|
49
|
-
|
50
|
+
set_opts = { url: Addressable::URI.encode(url),
|
51
|
+
headers: net[:headers].merge(headers) }
|
52
|
+
Faraday.new(set_opts.merge(opts))
|
50
53
|
end
|
51
54
|
|
52
55
|
# Make a GET call to the Wavefront API and return the result as
|
@@ -55,11 +58,30 @@ module Wavefront
|
|
55
58
|
# @param path [String] path to be appended to the
|
56
59
|
# #net[:api_base] path.
|
57
60
|
# @param query [Hash] optional key-value pairs with will be made
|
58
|
-
# into
|
61
|
+
# into a query string
|
62
|
+
# @param request_opts [Hash] parameters to pass through to
|
63
|
+
# Faraday
|
59
64
|
# @return [Hash] API response
|
60
65
|
#
|
61
66
|
def get(path, query = {})
|
62
|
-
make_call(mk_conn(path), :get, nil, query)
|
67
|
+
make_call(mk_conn(path, {}), :get, nil, query)
|
68
|
+
end
|
69
|
+
|
70
|
+
# Had to introduce this for the Wavefront::Dashboard#acls
|
71
|
+
# method, which uses a query string of multiple id=s. By default
|
72
|
+
# Faraday only uses the last one. You must set the
|
73
|
+
# `params_encoder`. Rather than convolute the existing logic, it
|
74
|
+
# was cleaner to add this method. Parameters are same as #get.
|
75
|
+
#
|
76
|
+
def get_flat_params(path, query = {})
|
77
|
+
conn = mk_conn(path,
|
78
|
+
{},
|
79
|
+
request: {
|
80
|
+
params_encoder: Faraday::FlatParamsEncoder
|
81
|
+
},
|
82
|
+
params: query)
|
83
|
+
|
84
|
+
make_call(conn, :get)
|
63
85
|
end
|
64
86
|
|
65
87
|
# Make a POST call to the Wavefront API and return the result as
|
@@ -162,6 +184,8 @@ module Wavefront
|
|
162
184
|
end
|
163
185
|
|
164
186
|
def make_single_call(conn, method, *args)
|
187
|
+
pp args if debug
|
188
|
+
|
165
189
|
resp = conn.public_send(method, *args)
|
166
190
|
|
167
191
|
if debug
|
@@ -93,6 +93,7 @@ module Wavefront
|
|
93
93
|
wf_dashboard_id?(id)
|
94
94
|
api.post([id, 'favorite'].uri_concat)
|
95
95
|
end
|
96
|
+
alias favourite favorite
|
96
97
|
|
97
98
|
# GET /api/v2/dashboard/id/history
|
98
99
|
# Get the version history of a dashboard.
|
@@ -177,5 +178,64 @@ module Wavefront
|
|
177
178
|
wf_dashboard_id?(id)
|
178
179
|
api.post([id, 'unfavorite'].uri_concat)
|
179
180
|
end
|
181
|
+
alias unfavourite unfavorite
|
182
|
+
|
183
|
+
# GET /api/v2/dashboard/acl
|
184
|
+
# Get list of Access Control Lists for the specified dashboards
|
185
|
+
# @param id_list [Array[String]] array of dashboard IDs
|
186
|
+
# @return [Wavefront::Response]
|
187
|
+
#
|
188
|
+
def acls(id_list)
|
189
|
+
id_list.each { |id| wf_dashboard_id?(id) }
|
190
|
+
api.get_flat_params('acl', id: id_list)
|
191
|
+
end
|
192
|
+
|
193
|
+
# POST /api/v2/dashboard/acl/add
|
194
|
+
# Adds the specified ids to the given dashboards' ACL
|
195
|
+
# @param id [String] ID of dashboard
|
196
|
+
# @param view [Array[Hash]] array of entities allowed to view
|
197
|
+
# the dashboard. Entities may be users or groups, and are
|
198
|
+
# defined as a Hash with keys :id and :name. For users the two
|
199
|
+
# will be the same, for groups, not.
|
200
|
+
# @param modify [Array[Hash]] array of entities allowed to
|
201
|
+
# view and modify the dashboard. Same rules as @view.
|
202
|
+
# @return [Wavefront::Response]
|
203
|
+
#
|
204
|
+
def acl_add(id, view = [], modify = [])
|
205
|
+
api.post(%w[acl add].uri_concat,
|
206
|
+
acl_body(id, view, modify),
|
207
|
+
'application/json')
|
208
|
+
end
|
209
|
+
|
210
|
+
# POST /api/v2/dashboard/acl/remove
|
211
|
+
# Removes the specified ids from the given dashboards' ACL
|
212
|
+
#
|
213
|
+
# Though the API method is 'remove', the acl method names have
|
214
|
+
# been chosen to correspond with the tag methods.
|
215
|
+
#
|
216
|
+
def acl_delete(id, view = [], modify = [])
|
217
|
+
api.post(%w[acl remove].uri_concat,
|
218
|
+
acl_body(id, view, modify),
|
219
|
+
'application/json')
|
220
|
+
end
|
221
|
+
|
222
|
+
# PUT /api/v2/dashboard/acl/set
|
223
|
+
# Set ACL for the specified dashboards
|
224
|
+
#
|
225
|
+
def acl_set(id, view = [], modify = [])
|
226
|
+
api.put(%w[acl set].uri_concat, acl_body(id, view, modify))
|
227
|
+
end
|
228
|
+
|
229
|
+
private
|
230
|
+
|
231
|
+
def acl_body(id, view, modify)
|
232
|
+
wf_dashboard_id?(id)
|
233
|
+
|
234
|
+
raise ArgumentError unless view.is_a?(Array) && modify.is_a?(Array)
|
235
|
+
raise ArgumentError unless view.all? { |h| h.is_a?(Hash) }
|
236
|
+
raise ArgumentError unless modify.all? { |h| h.is_a?(Hash) }
|
237
|
+
|
238
|
+
[{ entityId: id, viewAcl: view, modifyAcl: modify }]
|
239
|
+
end
|
180
240
|
end
|
181
241
|
end
|
@@ -59,8 +59,8 @@ module Wavefront
|
|
59
59
|
array2dist(dist[:value]),
|
60
60
|
dist[:path] || raise,
|
61
61
|
dist.fetch(:source, HOSTNAME),
|
62
|
-
dist[:tags]
|
63
|
-
opts[:tags]
|
62
|
+
dist[:tags]&.to_wf_tag,
|
63
|
+
opts[:tags]&.to_wf_tag).squeeze(' ').strip
|
64
64
|
rescue StandardError
|
65
65
|
raise Wavefront::Exception::InvalidDistribution
|
66
66
|
end
|
data/lib/wavefront-sdk/search.rb
CHANGED
@@ -53,13 +53,19 @@ module Wavefront
|
|
53
53
|
q.tap { |iq| iq[:matchingMethod] ||= 'CONTAINS' }
|
54
54
|
end
|
55
55
|
|
56
|
-
ret[:sort] =
|
57
|
-
ascending: !options[:desc] || true }
|
56
|
+
ret[:sort] = sort_field(options, query)
|
58
57
|
end
|
59
58
|
|
60
59
|
ret
|
61
60
|
end
|
62
61
|
|
62
|
+
def sort_field(options, query)
|
63
|
+
field = options[:sort_field] || [query].flatten.first[:key]
|
64
|
+
|
65
|
+
{ field: field,
|
66
|
+
ascending: !options[:desc] || true }
|
67
|
+
end
|
68
|
+
|
63
69
|
# POST /api/v2/search/entity
|
64
70
|
# POST /api/v2/search/entity/deleted
|
65
71
|
# Run a search query. This single method maps to many API paths.
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require_relative 'core/api'
|
2
|
+
|
3
|
+
module Wavefront
|
4
|
+
#
|
5
|
+
# Manage and query Wavefront customer settings. Corresponds to the
|
6
|
+
# "system preferences" page in the UI.
|
7
|
+
#
|
8
|
+
class Settings < CoreApi
|
9
|
+
def api_base
|
10
|
+
'/customer'
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET /api/v2/customer/permissions
|
14
|
+
# Get all permissions
|
15
|
+
#
|
16
|
+
def permissions
|
17
|
+
api.get(:permissions)
|
18
|
+
end
|
19
|
+
|
20
|
+
# GET /api/v2/customer/preferences
|
21
|
+
# Get customer preferences
|
22
|
+
#
|
23
|
+
def preferences
|
24
|
+
api.get(:preferences)
|
25
|
+
end
|
26
|
+
|
27
|
+
# POST /api/v2/customer/preferences
|
28
|
+
# Update selected fields of customer preferences
|
29
|
+
#
|
30
|
+
# @param body [Hash] See the API documentation for the model
|
31
|
+
# schema. At the time of writing, permissible fields are
|
32
|
+
# showQuerybuilderByDefault [Bool]
|
33
|
+
# hideTSWhenQuerybuilderShown [Bool]
|
34
|
+
# landingDashboardSlug [String]
|
35
|
+
# showOnboarding [Bool]
|
36
|
+
# grantModifyAccessToEveryone [Bool]
|
37
|
+
# defaultUserGroups: [Array[String]]
|
38
|
+
# invitePermissions: [Array[String]]
|
39
|
+
#
|
40
|
+
def update_preferences(body)
|
41
|
+
api.post(:preferences, body, 'application/json')
|
42
|
+
end
|
43
|
+
|
44
|
+
# GET /api/v2/customer/preferences/defaultUserGroups
|
45
|
+
# Get default user groups customer preferences
|
46
|
+
#
|
47
|
+
def default_user_groups
|
48
|
+
api.get('/preferences/defaultUserGroups')
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -162,7 +162,7 @@ module Wavefront
|
|
162
162
|
#
|
163
163
|
def wf_version?(version)
|
164
164
|
version = version.to_i if version.is_a?(String) && version =~ /^\d+$/
|
165
|
-
return true if version.is_a?(Integer) && version
|
165
|
+
return true if version.is_a?(Integer) && version.positive?
|
166
166
|
raise Wavefront::Exception::InvalidVersion
|
167
167
|
end
|
168
168
|
|
@@ -503,7 +503,7 @@ module Wavefront
|
|
503
503
|
# count is not valid
|
504
504
|
#
|
505
505
|
def wf_distribution_count?(count)
|
506
|
-
return true if count.is_a?(Integer) && count
|
506
|
+
return true if count.is_a?(Integer) && count.positive?
|
507
507
|
raise Wavefront::Exception::InvalidDistributionCount
|
508
508
|
end
|
509
509
|
end
|
data/lib/wavefront-sdk/write.rb
CHANGED
@@ -182,8 +182,8 @@ module Wavefront
|
|
182
182
|
point[:value] || raise,
|
183
183
|
point.fetch(:ts, nil),
|
184
184
|
point.fetch(:source, HOSTNAME),
|
185
|
-
point[:tags]
|
186
|
-
opts[:tags]
|
185
|
+
point[:tags]&.to_wf_tag,
|
186
|
+
opts[:tags]&.to_wf_tag]
|
187
187
|
end
|
188
188
|
|
189
189
|
private
|
@@ -13,15 +13,19 @@ BAD_RESP = "error='not_found'
|
|
13
13
|
message='resource cannot be found'
|
14
14
|
trackingId=eca22ddc-848b-4e67-876a-366145c8a759".freeze
|
15
15
|
|
16
|
-
|
16
|
+
ERR_RESP = { error: 'HTTP 415 Unsupported Media Type',
|
17
|
+
trackingId: 'ce231eaf-8d0e-4138-a82d-12725376a3b0' }.to_json
|
18
|
+
|
19
|
+
# Unit tests for Response class. Also indirectly tests the Status
|
17
20
|
# type.
|
18
21
|
#
|
19
22
|
class WavefrontResponseTest < MiniTest::Test
|
20
|
-
attr_reader :wfg, :wfb
|
23
|
+
attr_reader :wfg, :wfb, :wfe
|
21
24
|
|
22
25
|
def setup
|
23
26
|
@wfg = Wavefront::Response.new(GOOD_RESP, 200)
|
24
27
|
@wfb = Wavefront::Response.new(BAD_RESP, 404)
|
28
|
+
@wfe = Wavefront::Response.new(ERR_RESP, 415)
|
25
29
|
end
|
26
30
|
|
27
31
|
def test_initialize_good_data
|
@@ -57,6 +61,21 @@ class WavefrontResponseTest < MiniTest::Test
|
|
57
61
|
refute wfb.next_item
|
58
62
|
end
|
59
63
|
|
64
|
+
def test_initialize_err_data
|
65
|
+
assert_instance_of(Wavefront::Response, wfe)
|
66
|
+
assert_respond_to(wfe, :status)
|
67
|
+
assert_respond_to(wfe, :response)
|
68
|
+
refute_respond_to(wfe, :to_a)
|
69
|
+
refute_respond_to(wfe.response, :items)
|
70
|
+
assert_instance_of(Wavefront::Type::Status, wfe.status)
|
71
|
+
assert_equal(415, wfe.status.code)
|
72
|
+
assert_equal('ERROR', wfe.status.result)
|
73
|
+
assert_equal('HTTP 415 Unsupported Media Type', wfe.status.message)
|
74
|
+
refute wfe.ok?
|
75
|
+
refute wfe.more_items?
|
76
|
+
refute wfe.next_item
|
77
|
+
end
|
78
|
+
|
60
79
|
# This is a private method, so we test its public interface
|
61
80
|
#
|
62
81
|
def test_build_response
|
@@ -22,6 +22,11 @@ DASHBOARD_BODY = {
|
|
22
22
|
]
|
23
23
|
}.freeze
|
24
24
|
|
25
|
+
U_ACL_1 = { name: 'someone@example.com', id: 'someone@example.com' }.freeze
|
26
|
+
U_ACL_2 = { name: 'other@elsewhere.com', id: 'other@elsewhere.com' }.freeze
|
27
|
+
GRP_ACL = { name: 'example group',
|
28
|
+
id: 'f8dc0c14-91a0-4ca9-8a2a-7d47f4db4672' }.freeze
|
29
|
+
|
25
30
|
# Unit tests for dashboard class
|
26
31
|
#
|
27
32
|
class WavefrontDashboardTest < WavefrontTestBase
|
@@ -61,6 +66,8 @@ class WavefrontDashboardTest < WavefrontTestBase
|
|
61
66
|
def test_favorite
|
62
67
|
should_work(:favorite, DASHBOARD, ["#{DASHBOARD}/favorite",
|
63
68
|
nil], :post, POST_HEADERS)
|
69
|
+
should_work(:favourite, DASHBOARD, ["#{DASHBOARD}/favorite",
|
70
|
+
nil], :post, POST_HEADERS)
|
64
71
|
should_be_invalid(:favorite)
|
65
72
|
end
|
66
73
|
|
@@ -82,6 +89,55 @@ class WavefrontDashboardTest < WavefrontTestBase
|
|
82
89
|
def test_unfavorite
|
83
90
|
should_work(:unfavorite, DASHBOARD, ["#{DASHBOARD}/unfavorite",
|
84
91
|
nil], :post, POST_HEADERS)
|
92
|
+
should_work(:unfavourite, DASHBOARD, ["#{DASHBOARD}/unfavorite",
|
93
|
+
nil], :post, POST_HEADERS)
|
85
94
|
should_be_invalid(:unfavorite)
|
86
95
|
end
|
96
|
+
|
97
|
+
def test_acls
|
98
|
+
should_work(:acls, [%w[dash1 dash2]], 'acl?id=dash1&id=dash2')
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_acl_add
|
102
|
+
should_work(:acl_add, [DASHBOARD, [U_ACL_1, U_ACL_2], [GRP_ACL]],
|
103
|
+
'acl/add', :post, {}, acl_body(DASHBOARD,
|
104
|
+
[U_ACL_1, U_ACL_2],
|
105
|
+
[GRP_ACL]))
|
106
|
+
|
107
|
+
should_work(:acl_add, [DASHBOARD, [U_ACL_1, U_ACL_2]],
|
108
|
+
'acl/add', :post, {}, acl_body(DASHBOARD,
|
109
|
+
[U_ACL_1, U_ACL_2]))
|
110
|
+
assert_raises(ArgumentError) { wf.acl_add(DASHBOARD, U_ACL_1) }
|
111
|
+
assert_raises(ArgumentError) do
|
112
|
+
wf.acl_add(DASHBOARD, [U_ACL_1], GRP_ACL)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_acl_remove
|
117
|
+
should_work(:acl_delete, [DASHBOARD, [U_ACL_1, U_ACL_2], [GRP_ACL]],
|
118
|
+
'acl/remove', :post, {}, acl_body(DASHBOARD,
|
119
|
+
[U_ACL_1, U_ACL_2],
|
120
|
+
[GRP_ACL]))
|
121
|
+
|
122
|
+
should_work(:acl_delete, [DASHBOARD, [U_ACL_1, U_ACL_2]],
|
123
|
+
'acl/remove', :post, {}, acl_body(DASHBOARD,
|
124
|
+
[U_ACL_1, U_ACL_2]))
|
125
|
+
assert_raises(ArgumentError) { wf.acl_delete(DASHBOARD, U_ACL_1) }
|
126
|
+
end
|
127
|
+
|
128
|
+
def test_acl_set
|
129
|
+
should_work(:acl_set, [DASHBOARD, [U_ACL_1, U_ACL_2], [GRP_ACL]],
|
130
|
+
'acl/set', :put, {}, acl_body(DASHBOARD,
|
131
|
+
[U_ACL_1, U_ACL_2],
|
132
|
+
[GRP_ACL]))
|
133
|
+
|
134
|
+
should_work(:acl_set, [DASHBOARD, [U_ACL_1, U_ACL_2]],
|
135
|
+
'acl/set', :put, {}, acl_body(DASHBOARD,
|
136
|
+
[U_ACL_1, U_ACL_2]))
|
137
|
+
assert_raises(ArgumentError) { wf.acl_set(DASHBOARD, U_ACL_1) }
|
138
|
+
end
|
139
|
+
|
140
|
+
def acl_body(id, view = [], modify = [])
|
141
|
+
[{ entityId: id, viewAcl: view, modifyAcl: modify }].to_json
|
142
|
+
end
|
87
143
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require_relative '../spec_helper'
|
4
|
+
|
5
|
+
SETTINGS_BODY = { showQuerybuilderByDefault: true,
|
6
|
+
hideTSWhenQuerybuilderShown: true }.freeze
|
7
|
+
|
8
|
+
# Unit tests for Settings class
|
9
|
+
#
|
10
|
+
class WavefrontSettingsTest < WavefrontTestBase
|
11
|
+
def api_base
|
12
|
+
'customer'
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_permissions
|
16
|
+
should_work(:permissions, nil, 'permissions')
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_preferences
|
20
|
+
should_work(:preferences, nil, 'preferences')
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_update_preferences
|
24
|
+
should_work(:update_preferences, SETTINGS_BODY, 'preferences',
|
25
|
+
:post, JSON_POST_HEADERS, SETTINGS_BODY.to_json)
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_default_user_groups
|
29
|
+
should_work(:default_user_groups, nil, 'preferences/defaultUserGroups')
|
30
|
+
end
|
31
|
+
end
|
data/wavefront-sdk.gemspec
CHANGED
@@ -2,7 +2,6 @@ require 'pathname'
|
|
2
2
|
require 'date'
|
3
3
|
require_relative 'lib/wavefront-sdk/defs/version'
|
4
4
|
|
5
|
-
# rubocop:disable Metrics/BlockLength:
|
6
5
|
Gem::Specification.new do |gem|
|
7
6
|
gem.name = 'wavefront-sdk'
|
8
7
|
gem.version = WF_SDK_VERSION
|
@@ -12,7 +11,7 @@ Gem::Specification.new do |gem|
|
|
12
11
|
gem.description = 'SDK for Wavefront (wavefront.com) API v2 '
|
13
12
|
|
14
13
|
gem.authors = ['Robert Fisher']
|
15
|
-
gem.email = '
|
14
|
+
gem.email = 'rob@sysdef.xyz'
|
16
15
|
gem.homepage = 'https://github.com/snltd/wavefront-sdk'
|
17
16
|
gem.license = 'BSD-2-Clause'
|
18
17
|
|
@@ -22,11 +21,10 @@ Gem::Specification.new do |gem|
|
|
22
21
|
gem.bindir = 'bin'
|
23
22
|
|
24
23
|
gem.add_dependency 'addressable', '~> 2.4'
|
25
|
-
gem.add_dependency 'faraday', '~> 0.
|
24
|
+
gem.add_dependency 'faraday', '~> 0.15.4'
|
26
25
|
gem.add_dependency 'inifile', '~> 3.0'
|
27
26
|
gem.add_dependency 'map', '~> 6.6'
|
28
27
|
|
29
|
-
gem.add_development_dependency 'bundler', '~> 1.17'
|
30
28
|
gem.add_development_dependency 'minitest', '~> 5.11'
|
31
29
|
gem.add_development_dependency 'rake', '~> 12.0'
|
32
30
|
gem.add_development_dependency 'rubocop', '~> 0.54.0'
|
@@ -35,6 +33,5 @@ Gem::Specification.new do |gem|
|
|
35
33
|
gem.add_development_dependency 'webmock', '~> 3.0'
|
36
34
|
gem.add_development_dependency 'yard', '~> 0.9.5'
|
37
35
|
|
38
|
-
gem.required_ruby_version = Gem::Requirement.new('>= 2.
|
36
|
+
gem.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
|
39
37
|
end
|
40
|
-
# rubocop:enable Metrics/BlockLength:
|
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:
|
4
|
+
version: 3.0.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: 2019-03-
|
11
|
+
date: 2019-03-23 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: 0.
|
33
|
+
version: 0.15.4
|
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: 0.
|
40
|
+
version: 0.15.4
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: inifile
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,20 +66,6 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '6.6'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: bundler
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '1.17'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '1.17'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: minitest
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -179,7 +165,7 @@ dependencies:
|
|
179
165
|
- !ruby/object:Gem::Version
|
180
166
|
version: 0.9.5
|
181
167
|
description: 'SDK for Wavefront (wavefront.com) API v2 '
|
182
|
-
email:
|
168
|
+
email: rob@sysdef.xyz
|
183
169
|
executables: []
|
184
170
|
extensions: []
|
185
171
|
extra_rdoc_files: []
|
@@ -224,6 +210,7 @@ files:
|
|
224
210
|
- lib/wavefront-sdk/report.rb
|
225
211
|
- lib/wavefront-sdk/savedsearch.rb
|
226
212
|
- lib/wavefront-sdk/search.rb
|
213
|
+
- lib/wavefront-sdk/settings.rb
|
227
214
|
- lib/wavefront-sdk/source.rb
|
228
215
|
- lib/wavefront-sdk/stdlib/array.rb
|
229
216
|
- lib/wavefront-sdk/stdlib/hash.rb
|
@@ -274,6 +261,7 @@ files:
|
|
274
261
|
- spec/wavefront-sdk/resources/test2.conf
|
275
262
|
- spec/wavefront-sdk/savedsearch_spec.rb
|
276
263
|
- spec/wavefront-sdk/search_spec.rb
|
264
|
+
- spec/wavefront-sdk/settings_spec.rb
|
277
265
|
- spec/wavefront-sdk/source_spec.rb
|
278
266
|
- spec/wavefront-sdk/stdlib/array_spec.rb
|
279
267
|
- spec/wavefront-sdk/stdlib/hash_spec.rb
|
@@ -304,7 +292,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
304
292
|
requirements:
|
305
293
|
- - ">="
|
306
294
|
- !ruby/object:Gem::Version
|
307
|
-
version: 2.
|
295
|
+
version: 2.3.0
|
308
296
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
309
297
|
requirements:
|
310
298
|
- - ">="
|
@@ -346,6 +334,7 @@ test_files:
|
|
346
334
|
- spec/wavefront-sdk/resources/test2.conf
|
347
335
|
- spec/wavefront-sdk/savedsearch_spec.rb
|
348
336
|
- spec/wavefront-sdk/search_spec.rb
|
337
|
+
- spec/wavefront-sdk/settings_spec.rb
|
349
338
|
- spec/wavefront-sdk/source_spec.rb
|
350
339
|
- spec/wavefront-sdk/stdlib/array_spec.rb
|
351
340
|
- spec/wavefront-sdk/stdlib/hash_spec.rb
|