haveapi-client 0.26.4 → 0.26.5

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: 990c16577799341bfe013e588b33b15e52c3acf973869a84ba3b051b99de57fd
4
- data.tar.gz: 14d4be7d907a1ef7857f5e7fc56cf39a408958e20aa1d7f0e10f4737d9cc3309
3
+ metadata.gz: e1b98aab9f8e937585fa078d6fa5bc38e68f83ed7b70c800dbaa9a0cf1f4ec28
4
+ data.tar.gz: 2df727132132091b6422d8d4dbc858f6911ed21d96b5e82197a7cb43ad955d9c
5
5
  SHA512:
6
- metadata.gz: 28eefedb8c494cf33f0b81729b34dfcc558affdcb9d3acabf8c58f49b6a0ec9cb55a9f6e8b4c32ad72da42e4f66a78125710aa861284bcc1fbe119f230998306
7
- data.tar.gz: d42f140abba3ffa5851bb68a410061e64e23fd7a7e312d20ed82f36d6a143a1016e496773beb675aaf86248bf33809de994d0a55aba4d1d48324f4f119346325
6
+ metadata.gz: 7baed8b41fd39094bbf765cf6e48d295a7265dd99038cc85a9142a25b34d18369e9676793f396ee5958922d5b0d9a8f7614b41935a4605afb9f35400cef83c6d
7
+ data.tar.gz: b1c00e04bcc29a60b32e6425c880752eb7c367380366a96662cd64d8de8534393fb7b30a4edf2e592796017e3a9ee2d926115fa75c8bf7e6f1e55552c3ce6f26
@@ -26,9 +26,9 @@ module HaveAPI::CLI
26
26
  id ||= @id
27
27
 
28
28
  if cancel
29
- puts 'Waiting for the action to cancel (hit Ctrl+C to skip)...'
29
+ warn 'Waiting for the action to cancel (hit Ctrl+C to skip)...'
30
30
  else
31
- puts 'Waiting for the action to complete (hit Ctrl+C to skip)...'
31
+ warn 'Waiting for the action to complete (hit Ctrl+C to skip)...'
32
32
  end
33
33
 
34
34
  last_status = false
@@ -47,11 +47,11 @@ module HaveAPI::CLI
47
47
  end
48
48
  rescue Interrupt
49
49
  @pb && @pb.stop
50
- puts
50
+ warn
51
51
 
52
52
  cancel_action(timeout: timeout) if can_cancel && !cancel && last_status
53
53
 
54
- puts
54
+ warn
55
55
  print_help(id)
56
56
  exit(false)
57
57
  end
@@ -81,7 +81,7 @@ module HaveAPI::CLI
81
81
  end
82
82
 
83
83
  if res.is_a?(HaveAPI::Client::Response) && res.ok?
84
- puts 'Cancelled'
84
+ warn 'Cancelled'
85
85
  exit
86
86
 
87
87
  elsif res
@@ -102,11 +102,11 @@ module HaveAPI::CLI
102
102
  def print_help(id = nil)
103
103
  id ||= @id
104
104
 
105
- puts 'Run'
106
- puts " #{$0} action_state show #{id}"
107
- puts 'or'
108
- puts " #{$0} action_state wait #{id}"
109
- puts "to check the action's progress."
105
+ warn 'Run'
106
+ warn " #{$0} action_state show #{id}"
107
+ warn 'or'
108
+ warn " #{$0} action_state wait #{id}"
109
+ warn "to check the action's progress."
110
110
  end
111
111
 
112
112
  protected
@@ -121,7 +121,8 @@ module HaveAPI::CLI
121
121
  '%t: [%B]'
122
122
  end,
123
123
  starting_at: state.progress.current,
124
- autofinish: false
124
+ autofinish: false,
125
+ output: $stderr
125
126
  )
126
127
 
127
128
  @pb.title = if state.status
@@ -112,7 +112,7 @@ module HaveAPI::CLI
112
112
  @input_params[:meta] = { includes: includes } if includes
113
113
 
114
114
  begin
115
- ret = action.execute(@input_params, raw: @opts[:raw])
115
+ ret = action.execute(@input_params)
116
116
  rescue HaveAPI::Client::ValidationError => e
117
117
  format_errors(action, 'input parameters not valid', e.errors)
118
118
  exit(false)
@@ -508,7 +508,7 @@ module HaveAPI::CLI
508
508
 
509
509
  def format_output(action, response, out = $>)
510
510
  if @opts[:raw]
511
- puts JSON.generate(response)
511
+ puts JSON.pretty_generate(response)
512
512
  return
513
513
  end
514
514
 
@@ -16,7 +16,7 @@ module HaveAPI::Client
16
16
  "#<#{self.class.name} @name=#{@name}>"
17
17
  end
18
18
 
19
- def execute(data, raw: false)
19
+ def execute(data)
20
20
  params_arg = {}
21
21
 
22
22
  if input
@@ -29,7 +29,7 @@ module HaveAPI::Client
29
29
  params_arg = params.to_api
30
30
  end
31
31
 
32
- ret = @api.call(self, params_arg, raw: raw)
32
+ ret = @api.call(self, params_arg)
33
33
  reset
34
34
  ret
35
35
  end
@@ -117,7 +117,7 @@ module HaveAPI::Client
117
117
  end
118
118
  end
119
119
 
120
- def call(action, params = {}, raw: false)
120
+ def call(action, params = {})
121
121
  args = []
122
122
  input_namespace = action.input && action.namespace(:input)
123
123
  meta = nil
@@ -164,11 +164,7 @@ module HaveAPI::Client
164
164
  end
165
165
 
166
166
  if response[:status]
167
- if raw
168
- ok(JSON.pretty_generate(response[:response]))
169
- else
170
- ok(response[:response])
171
- end
167
+ ok(response[:response])
172
168
 
173
169
  else
174
170
  error(response[:message], response[:errors])
@@ -1,6 +1,6 @@
1
1
  module HaveAPI
2
2
  module Client
3
3
  PROTOCOL_VERSION = '2.0'.freeze
4
- VERSION = '0.26.4'.freeze
4
+ VERSION = '0.26.5'.freeze
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haveapi-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.26.4
4
+ version: 0.26.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub Skokan