richard-cli 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/richard +1 -2
- data/lib/richard/queued_user.rb +4 -11
- data/lib/richard/queued_user_formatter.rb +9 -5
- data/lib/richard/version.rb +1 -1
- data/lib/richard.rb +3 -1
- data/richard-cli.gemspec +1 -1
- metadata +4 -4
data/bin/richard
CHANGED
data/lib/richard/queued_user.rb
CHANGED
@@ -3,22 +3,14 @@ require 'json'
|
|
3
3
|
module Richard
|
4
4
|
class QueuedUser
|
5
5
|
attr_reader :user_id, :email, :name
|
6
|
-
attr_reader :status
|
6
|
+
attr_reader :status, :blocking_duration
|
7
7
|
|
8
8
|
def initialize(options)
|
9
9
|
@user_id = options[:user_id]
|
10
10
|
@name = options[:name]
|
11
11
|
@email = options[:email]
|
12
12
|
@status = options[:status]
|
13
|
-
|
14
|
-
|
15
|
-
def to_s
|
16
|
-
[
|
17
|
-
user_id,
|
18
|
-
name,
|
19
|
-
email,
|
20
|
-
status
|
21
|
-
].join(", ")
|
13
|
+
@blocking_duration = options[:blocking_duration]
|
22
14
|
end
|
23
15
|
end
|
24
16
|
|
@@ -33,7 +25,8 @@ module Richard
|
|
33
25
|
user_id: obj['user']['id'],
|
34
26
|
name: obj['user']['name'],
|
35
27
|
email: obj['user']['email'],
|
36
|
-
status: obj['status']
|
28
|
+
status: obj['status'],
|
29
|
+
blocking_duration: obj['blocking_duration']
|
37
30
|
)
|
38
31
|
end
|
39
32
|
end
|
@@ -17,19 +17,23 @@ module Richard
|
|
17
17
|
def row_header
|
18
18
|
[
|
19
19
|
"User Id",
|
20
|
-
"
|
21
|
-
"
|
22
|
-
"
|
20
|
+
"User",
|
21
|
+
"Status",
|
22
|
+
"Blocking Duration"
|
23
23
|
]
|
24
24
|
end
|
25
25
|
|
26
26
|
def user_to_row(user)
|
27
27
|
return [
|
28
28
|
user.user_id,
|
29
|
-
user.name,
|
30
29
|
user.email,
|
31
|
-
user.status
|
30
|
+
user.status,
|
31
|
+
format_duration(user.blocking_duration)
|
32
32
|
]
|
33
33
|
end
|
34
|
+
|
35
|
+
def format_duration(duration)
|
36
|
+
(duration) ? Time.at(duration).utc.strftime("%Hh %Mm %Ss") : '--'
|
37
|
+
end
|
34
38
|
end
|
35
39
|
end
|
data/lib/richard/version.rb
CHANGED
data/lib/richard.rb
CHANGED
@@ -61,7 +61,9 @@ module Richard
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def format_estimated_wait(response)
|
64
|
-
|
64
|
+
seconds = response['estimated_wait_time']
|
65
|
+
wait_time = Time.at(seconds).utc.strftime("%Hh %Mm %Ss")
|
66
|
+
"Estimated Wait: #{wait_time}"
|
65
67
|
end
|
66
68
|
|
67
69
|
def format_flash(flash)
|
data/richard-cli.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["adamk@nulogy.com"]
|
11
11
|
spec.summary = %q{A command line interface for richard}
|
12
12
|
spec.description = %q{}
|
13
|
-
spec.homepage = ""
|
13
|
+
spec.homepage = "http://github.com/nulogy/richard-cli"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: richard-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -129,7 +129,7 @@ files:
|
|
129
129
|
- lib/richard/queued_user_formatter.rb
|
130
130
|
- lib/richard/version.rb
|
131
131
|
- richard-cli.gemspec
|
132
|
-
homepage:
|
132
|
+
homepage: http://github.com/nulogy/richard-cli
|
133
133
|
licenses:
|
134
134
|
- MIT
|
135
135
|
post_install_message:
|
@@ -144,7 +144,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
144
144
|
version: '0'
|
145
145
|
segments:
|
146
146
|
- 0
|
147
|
-
hash: -
|
147
|
+
hash: -1249351282469868080
|
148
148
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
149
|
none: false
|
150
150
|
requirements:
|
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
153
|
version: '0'
|
154
154
|
segments:
|
155
155
|
- 0
|
156
|
-
hash: -
|
156
|
+
hash: -1249351282469868080
|
157
157
|
requirements: []
|
158
158
|
rubyforge_project:
|
159
159
|
rubygems_version: 1.8.23.2
|