wavefront-cli 2.1.5 → 2.1.6

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: 825a16c621df1f57055b6e98da763f00ea82329aa47fe5050d6a47dd0db0b50e
4
- data.tar.gz: 8a4941ec0679722eba818a537effc9d1cb1df1f336cf296b8bcaf433de67e5c3
3
+ metadata.gz: 4f2e02d1e31da1b3ad2fd05c895813c97349e833c270b7bc843c63591b428d82
4
+ data.tar.gz: bdcf1886e4f5a28387e0ff8a669ebb8517e3d794bee15c0fc6ec19262e9844b7
5
5
  SHA512:
6
- metadata.gz: b0dd1e687410d21ff3c9b2388ccdadc4c4af30782f2ca80d3f8b85ef2f5ae87d1c6b87e7b1470aacf6e8b8e210bca17ea951b429d300c55f4c5460064a43313b
7
- data.tar.gz: 9285e05ec60f6f5efa3270d86db6ad484f85742d8a8267818b06f9c563db3a5928a8714cace109942529316732e37f38731946e1725ec75e1892afd81fe20279
6
+ metadata.gz: e48473c939d7be914f2effa82f5542a0395baa3cd7150a5e3f80d27a6b08e34bb026ce41f8623ccec15cb7044f7e256c5685a058d0c903725623a04c972ed43d
7
+ data.tar.gz: f2443319167863a1cbb90201dd6db6ce711233b2877af8b4841df3311ba9691f6adaea1eb242bf209d231bf0a3c86a4e140dbe62efdb143e49b83a8724f2627d
@@ -180,13 +180,7 @@ module WavefrontCli
180
180
  abort "API #{data.status.code}: #{data.status.message}."
181
181
  end
182
182
 
183
- resp = if data.response.respond_to?(:items)
184
- data.response.items
185
- else
186
- data.response
187
- end
188
-
189
- handle_response(resp, format_var, method)
183
+ handle_response(data.response, format_var, method)
190
184
  end
191
185
 
192
186
  def check_status(status)
@@ -291,7 +285,7 @@ module WavefrontCli
291
285
  end
292
286
 
293
287
  def do_update
294
- k, v = options[:'<key=value>'].split('=')
288
+ k, v = options[:'<key=value>'].split('=', 2)
295
289
  wf.update(options[:'<id>'], k => v)
296
290
  end
297
291
 
@@ -1,9 +1,9 @@
1
1
  # For development against a local checkout of the SDK, uncomment
2
2
  # this block
3
3
  #
4
- dir = Pathname.new(__FILE__).dirname.realpath.parent.parent.parent
5
- $LOAD_PATH.<< dir + 'lib'
6
- $LOAD_PATH.<< dir + 'wavefront-sdk' + 'lib'
4
+ #dir = Pathname.new(__FILE__).dirname.realpath.parent.parent.parent
5
+ #$LOAD_PATH.<< dir + 'lib'
6
+ #$LOAD_PATH.<< dir + 'wavefront-sdk' + 'lib'
7
7
 
8
8
  require 'pathname'
9
9
  require 'pp'
@@ -14,13 +14,21 @@ module WavefrontDisplay
14
14
  class Base
15
15
  include WavefrontCli::Constants
16
16
 
17
- attr_reader :data, :options
17
+ attr_reader :raw, :data, :options
18
18
 
19
- # @param data [Map, Hash, Array] the data returned by the SDK
19
+ # @param raw_response [Map, Hash, Array] the data returned by the SDK
20
20
  # response.
21
21
  # @param options [Hash] options from docopt
22
22
  #
23
- def initialize(data, options = {})
23
+ def initialize(raw_response, options = {})
24
+ @raw = raw_response
25
+
26
+ data = if raw_response.respond_to?(:items)
27
+ raw_response.items
28
+ else
29
+ raw_response
30
+ end
31
+
24
32
  @data = data.is_a?(Map) ? Map(put_id_first(data)) : data
25
33
  @options = options
26
34
  end
@@ -98,12 +106,28 @@ module WavefrontDisplay
98
106
  else
99
107
  require_relative 'printer/long'
100
108
  puts WavefrontDisplayPrinter::Long.new(data, fields, modified_data)
109
+ pagination_line
101
110
  end
102
111
  end
103
112
 
104
113
  def multicolumn(*columns)
105
114
  require_relative 'printer/terse'
106
115
  puts WavefrontDisplayPrinter::Terse.new(data, *columns)
116
+ pagination_line
117
+ end
118
+
119
+ # if this is a section of a larger dataset, say so
120
+ #
121
+ def pagination_line
122
+ if raw.respond_to?(:moreItems) && raw.moreItems == true
123
+ if raw.respond_to?(:offset) && raw.respond_to?(:limit)
124
+ enditem = raw.limit > 0 ? raw.offset + raw.limit - 1 : 0
125
+ puts format('Showing items %d to %d. Use -o and -L for more.',
126
+ raw.offset, enditem)
127
+ else
128
+ puts 'Showing paginated output. Use -o and -L for more.'
129
+ end
130
+ end
107
131
  end
108
132
 
109
133
  # Give it a key-value hash, and it will return the size of the first
@@ -1 +1 @@
1
- WF_CLI_VERSION = '2.1.5'.freeze
1
+ WF_CLI_VERSION = '2.1.6'.freeze
@@ -28,9 +28,9 @@ Gem::Specification.new do |gem|
28
28
  gem.add_development_dependency 'bundler', '~> 1.3'
29
29
  gem.add_development_dependency 'rake', '~> 12.0'
30
30
  gem.add_development_dependency 'yard', '~> 0.9.5'
31
- gem.add_development_dependency 'rubocop', '~> 0.51.0'
31
+ gem.add_development_dependency 'rubocop', '~> 0.52.0'
32
32
  gem.add_development_dependency 'webmock', '~> 3.0'
33
- gem.add_development_dependency 'minitest', '~> 5.8', '>= 5.8.0'
33
+ gem.add_development_dependency 'minitest', '~> 5.11', '>= 5.11.0'
34
34
  gem.add_development_dependency 'spy', '~> 0.4.0'
35
35
 
36
36
  gem.required_ruby_version = Gem::Requirement.new('>= 2.2.0')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wavefront-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.5
4
+ version: 2.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Fisher
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-05 00:00:00.000000000 Z
11
+ date: 2018-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docopt
@@ -92,14 +92,14 @@ dependencies:
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: 0.51.0
95
+ version: 0.52.0
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
- version: 0.51.0
102
+ version: 0.52.0
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: webmock
105
105
  requirement: !ruby/object:Gem::Requirement
@@ -120,20 +120,20 @@ dependencies:
120
120
  requirements:
121
121
  - - "~>"
122
122
  - !ruby/object:Gem::Version
123
- version: '5.8'
123
+ version: '5.11'
124
124
  - - ">="
125
125
  - !ruby/object:Gem::Version
126
- version: 5.8.0
126
+ version: 5.11.0
127
127
  type: :development
128
128
  prerelease: false
129
129
  version_requirements: !ruby/object:Gem::Requirement
130
130
  requirements:
131
131
  - - "~>"
132
132
  - !ruby/object:Gem::Version
133
- version: '5.8'
133
+ version: '5.11'
134
134
  - - ">="
135
135
  - !ruby/object:Gem::Version
136
- version: 5.8.0
136
+ version: 5.11.0
137
137
  - !ruby/object:Gem::Dependency
138
138
  name: spy
139
139
  requirement: !ruby/object:Gem::Requirement
@@ -289,7 +289,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
289
289
  version: '0'
290
290
  requirements: []
291
291
  rubyforge_project:
292
- rubygems_version: 2.7.3
292
+ rubygems_version: 2.7.4
293
293
  signing_key:
294
294
  specification_version: 4
295
295
  summary: CLI for Wavefront API v2