haveapi-client 0.7.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +7 -0
- data/haveapi-client.gemspec +1 -1
- data/lib/haveapi/cli/cli.rb +20 -3
- data/lib/haveapi/client/parameters/typed.rb +14 -6
- data/lib/haveapi/client/version.rb +2 -2
- metadata +20 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9da0b977f9f71abb381d016bc92c0294accff85
|
4
|
+
data.tar.gz: b2de06f3dd320432dcbc1227c4fb810b09de9b39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7563807a8438187e214a465a65e2d66fb22e70d9096a455d4dad2dc5547caa13a18e0c2617ea969eda594eca62fcd3440572a934e6acce9e0003f36c914a01f
|
7
|
+
data.tar.gz: de48846f23d460b19408234b34f6c32f4c2343da479d71dd730ce26494878200d0947bbfa0ee596d0e088908d32cea21ff90297a6157320c3be084f661cec76c
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
* Fri Feb 10 2017 - version 0.8.0
|
2
|
+
- Fix coercion of Text parameters
|
3
|
+
- Ask on input parameters on stdin if an argument isn't provided
|
4
|
+
- Protocol version set to 1.2
|
5
|
+
- CLI uses DateTime.iso8601 to parse dates
|
6
|
+
- Datetime parameters accept Time, DateTime and Date objects
|
7
|
+
|
1
8
|
* Fri Nov 25 2016 - version 0.7.1
|
2
9
|
- Do not require a concrete version of json
|
3
10
|
|
data/haveapi-client.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'haveapi/client/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'haveapi-client'
|
8
8
|
spec.version = HaveAPI::Client::VERSION
|
9
|
-
spec.date = '
|
9
|
+
spec.date = '2017-02-10'
|
10
10
|
spec.authors = ['Jakub Skokan']
|
11
11
|
spec.email = ['jakub.skokan@vpsfree.cz']
|
12
12
|
spec.summary =
|
data/lib/haveapi/cli/cli.rb
CHANGED
@@ -3,6 +3,7 @@ require 'pp'
|
|
3
3
|
require 'highline/import'
|
4
4
|
require 'yaml'
|
5
5
|
require 'time'
|
6
|
+
require 'date'
|
6
7
|
|
7
8
|
module HaveAPI::CLI
|
8
9
|
class Cli
|
@@ -308,7 +309,14 @@ module HaveAPI::CLI
|
|
308
309
|
|
309
310
|
action.input[:parameters].each do |name, p|
|
310
311
|
opts.on(param_option(name, p), p[:description] || p[:label] || '') do |*args|
|
311
|
-
|
312
|
+
arg = args.first
|
313
|
+
|
314
|
+
if arg.nil?
|
315
|
+
options[name] = read_param(name, p)
|
316
|
+
|
317
|
+
else
|
318
|
+
options[name] = args.first
|
319
|
+
end
|
312
320
|
end
|
313
321
|
end
|
314
322
|
|
@@ -354,12 +362,21 @@ module HaveAPI::CLI
|
|
354
362
|
ret += "[no-]#{name}"
|
355
363
|
|
356
364
|
else
|
357
|
-
ret += "#{name} #{name.underscore.upcase}"
|
365
|
+
ret += "#{name} [#{name.underscore.upcase}]"
|
358
366
|
end
|
359
367
|
|
360
368
|
ret
|
361
369
|
end
|
362
370
|
|
371
|
+
def read_param(name, p)
|
372
|
+
prompt = "#{p[:label] || name}: "
|
373
|
+
|
374
|
+
ask(prompt) do |q|
|
375
|
+
q.default = nil
|
376
|
+
q.echo = !p[:protected]
|
377
|
+
end
|
378
|
+
end
|
379
|
+
|
363
380
|
def list_versions
|
364
381
|
desc = @api.available_versions
|
365
382
|
|
@@ -707,7 +724,7 @@ module HaveAPI::CLI
|
|
707
724
|
def format_date(date)
|
708
725
|
return '' unless date
|
709
726
|
|
710
|
-
t =
|
727
|
+
t = DateTime.iso8601(date).to_time
|
711
728
|
ret = case @opts[:datetime]
|
712
729
|
when :timestamp
|
713
730
|
t.to_i
|
@@ -53,15 +53,23 @@ module HaveAPI::Client
|
|
53
53
|
Boolean.to_b(raw)
|
54
54
|
|
55
55
|
elsif type == 'Datetime'
|
56
|
-
|
57
|
-
|
56
|
+
if raw.is_a?(::Time)
|
57
|
+
raw
|
58
58
|
|
59
|
-
|
60
|
-
|
61
|
-
|
59
|
+
elsif raw.is_a?(::Date) || raw.is_a?(::DateTime)
|
60
|
+
raw.to_time
|
61
|
+
|
62
|
+
else
|
63
|
+
begin
|
64
|
+
DateTime.iso8601(raw).to_time
|
65
|
+
|
66
|
+
rescue ArgumentError
|
67
|
+
@errors << 'not in ISO 8601 format'
|
68
|
+
nil
|
69
|
+
end
|
62
70
|
end
|
63
71
|
|
64
|
-
elsif type
|
72
|
+
elsif %w(String Text).include?(type)
|
65
73
|
raw.to_s
|
66
74
|
|
67
75
|
else
|
metadata
CHANGED
@@ -1,125 +1,125 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: haveapi-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jakub Skokan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.6'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: activesupport
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 4.1.14
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 4.1.14
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: require_all
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 1.3.3
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 1.3.3
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rest-client
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 1.8.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
82
|
version: 1.8.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: json
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: highline
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - ~>
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: 1.7.8
|
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
110
|
version: 1.7.8
|
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
117
|
version: 1.7.5
|
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
124
|
version: 1.7.5
|
125
125
|
description: Ruby API and CLI for HaveAPI
|
@@ -188,12 +188,12 @@ require_paths:
|
|
188
188
|
- lib
|
189
189
|
required_ruby_version: !ruby/object:Gem::Requirement
|
190
190
|
requirements:
|
191
|
-
- -
|
191
|
+
- - ">="
|
192
192
|
- !ruby/object:Gem::Version
|
193
193
|
version: '0'
|
194
194
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
195
195
|
requirements:
|
196
|
-
- -
|
196
|
+
- - ">="
|
197
197
|
- !ruby/object:Gem::Version
|
198
198
|
version: '0'
|
199
199
|
requirements: []
|