haveapi-client 0.13.1 → 0.14.1

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: a461d053b40555dd6b7bfd065f5357243641f8960e505b6f5f8755d7eff03700
4
- data.tar.gz: 84e2ccbc1d353e032b88618e75bbdae6826db1182a8120e70481101599194f59
3
+ metadata.gz: 987307c7409922b6d622426644e8dc7d28ccc8a1115136249e190d8bf4bc129d
4
+ data.tar.gz: 677a4520cbf5ecfbfdba72cc1b2f50e94d9bc151b62f35d0546e35d84128ccdd
5
5
  SHA512:
6
- metadata.gz: a28a990fe2f400588435470f2c2f1ed4f09e5eb87a303fb7ec1f4ca2ea3ac09ae7f055681719025599bfa34aba59e7a4b62eb2269b9f8e0e24c18c27c6ce2388
7
- data.tar.gz: e20e680b9ce86029d00043264766cab06482fc4bc36b02abc9dd1af7e11ca16325a830279484c94cfa4b40cf088099f3a6d4b28acd4f8c4fe4ad0aca4a1a254e
6
+ metadata.gz: 854d2e6b3f9e592ee94122d00bf39aac12250d0bd29d1c2729b9636068e36d936418dc5f9f4cfb9ad8c78043d5758e3b34e2ec7ce5a5c2ee4cbf459b885c4a97
7
+ data.tar.gz: 3b16ef15d2d1ed6151c172d1237f10abb5dc7a8bdb975dc9853243306004c77d891d1cf697c689bd679f80dc9ec73810dc487b044bf71bb4112455fd6f681b5d
@@ -23,8 +23,8 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  spec.add_runtime_dependency 'activesupport', '>= 4.0'
25
25
  spec.add_runtime_dependency 'require_all', '~> 2.0.0'
26
- spec.add_runtime_dependency 'rest-client', '~> 2.0.2'
26
+ spec.add_runtime_dependency 'rest-client', '~> 2.1.0'
27
27
  spec.add_runtime_dependency 'json'
28
- spec.add_runtime_dependency 'highline', '~> 1.7.8'
29
- spec.add_runtime_dependency 'ruby-progressbar', '~> 1.7.5'
28
+ spec.add_runtime_dependency 'highline', '~> 2.0.3'
29
+ spec.add_runtime_dependency 'ruby-progressbar', '~> 1.11.0'
30
30
  end
@@ -5,8 +5,8 @@ module HaveAPI::CLI
5
5
  f.format
6
6
  end
7
7
 
8
- def self.print(*args)
9
- f = new(*args)
8
+ def self.print(*args, **kwargs)
9
+ f = new(*args, **kwargs)
10
10
  f.print
11
11
  end
12
12
 
@@ -84,7 +84,7 @@ module HaveAPI::CLI
84
84
  def generate
85
85
  return if @cols.empty?
86
86
  prepare
87
-
87
+
88
88
  case @layout
89
89
  when :columns
90
90
  columns
@@ -113,7 +113,7 @@ module HaveAPI::CLI
113
113
  i += 1
114
114
  ret
115
115
  end.join(' ')
116
-
116
+
117
117
  line sprintf(formatters, * @cols.map { |c| c[:label] }) if @header
118
118
 
119
119
  @str_objects.each do |o|
@@ -128,7 +128,7 @@ module HaveAPI::CLI
128
128
  @str_objects.each do |o|
129
129
  @cols.each_index do |i|
130
130
  c = @cols[i]
131
-
131
+
132
132
  if o[i].is_a?(::String) && o[i].index("\n")
133
133
  lines = o[i].split("\n")
134
134
  v = ([lines.first] + lines[1..-1].map { |l| (' ' * (w+3)) + l }).join("\n")
@@ -139,7 +139,7 @@ module HaveAPI::CLI
139
139
 
140
140
  line sprintf("%#{w}s: %s", c[:label], v)
141
141
  end
142
-
142
+
143
143
  line
144
144
  end
145
145
  end
@@ -155,10 +155,10 @@ module HaveAPI::CLI
155
155
 
156
156
  def prepare
157
157
  @str_objects = []
158
-
158
+
159
159
  each_object do |o|
160
160
  arr = []
161
-
161
+
162
162
  @cols.each do |c|
163
163
  v = o[ c[:name] ]
164
164
  str = (c[:display] ? c[:display].call(v) : v)
@@ -190,7 +190,7 @@ module HaveAPI::CLI
190
190
 
191
191
  def col_width(i, c)
192
192
  w = c[:label].to_s.length
193
-
193
+
194
194
  @str_objects.each do |o|
195
195
  len = o[i].to_s.length
196
196
  w = len if len > w
@@ -13,7 +13,7 @@ module HaveAPI::Client
13
13
  end
14
14
 
15
15
  def execute(data, *_)
16
- args = [self]
16
+ params_arg = {}
17
17
 
18
18
  if input
19
19
  params = Params.new(self, data)
@@ -22,10 +22,10 @@ module HaveAPI::Client
22
22
  raise ValidationError.new(self, params.errors)
23
23
  end
24
24
 
25
- args << params.to_api << {}
25
+ params_arg = params.to_api
26
26
  end
27
27
 
28
- ret = @api.call(*args)
28
+ ret = @api.call(self, params_arg)
29
29
  reset
30
30
  ret
31
31
  end
@@ -112,12 +112,8 @@ module HaveAPI::Client::Authentication
112
112
  end
113
113
 
114
114
  def check_validity
115
- if @valid_to && @valid_to < Time.now
116
- if @opts[:user] && @opts[:password]
117
- request_token
118
- else
119
- raise AuthenticationFailed.new('token expired')
120
- end
115
+ if @valid_to && @valid_to < Time.now && @opts[:user] && @opts[:password]
116
+ request_token
121
117
  end
122
118
  end
123
119
 
@@ -153,6 +153,9 @@ module HaveAPI::Client
153
153
  rescue RestClient::ResourceNotFound => e
154
154
  response = parse(e.http_body)
155
155
 
156
+ rescue RestClient::BadRequest => e
157
+ response = parse(e.http_body)
158
+
156
159
  rescue => e
157
160
  return error("Fatal API error: #{e.inspect}")
158
161
  end
@@ -1,6 +1,6 @@
1
1
  module HaveAPI
2
2
  module Client
3
3
  PROTOCOL_VERSION = '2.0'
4
- VERSION = '0.13.1'
4
+ VERSION = '0.14.1'
5
5
  end
6
6
  end
data/shell.nix CHANGED
@@ -6,7 +6,7 @@ in stdenv.mkDerivation rec {
6
6
  name = "haveapi-client";
7
7
 
8
8
  buildInputs = with pkgs;[
9
- ruby
9
+ ruby_2_7
10
10
  git
11
11
  openssl
12
12
  ];
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haveapi-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.1
4
+ version: 0.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub Skokan
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-20 00:00:00.000000000 Z
11
+ date: 1980-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 2.0.2
75
+ version: 2.1.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 2.0.2
82
+ version: 2.1.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: json
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -100,28 +100,28 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 1.7.8
103
+ version: 2.0.3
104
104
  type: :runtime
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: 1.7.8
110
+ version: 2.0.3
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: ruby-progressbar
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 1.7.5
117
+ version: 1.11.0
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 1.7.5
124
+ version: 1.11.0
125
125
  description: Ruby API and CLI for HaveAPI
126
126
  email:
127
127
  - jakub.skokan@vpsfree.cz
@@ -183,7 +183,7 @@ homepage: ''
183
183
  licenses:
184
184
  - MIT
185
185
  metadata: {}
186
- post_install_message:
186
+ post_install_message:
187
187
  rdoc_options: []
188
188
  require_paths:
189
189
  - lib
@@ -198,9 +198,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
198
198
  - !ruby/object:Gem::Version
199
199
  version: '0'
200
200
  requirements: []
201
- rubyforge_project:
202
- rubygems_version: 2.7.6.2
203
- signing_key:
201
+ rubygems_version: 3.2.26
202
+ signing_key:
204
203
  specification_version: 4
205
204
  summary: Ruby API and CLI for HaveAPI
206
205
  test_files: []