Class: Quandl::Command::Tasks::Info
- Inherits:
-
Base
- Object
- Base
- Quandl::Command::Tasks::Info
show all
- Defined in:
- lib/quandl/command/tasks/info.rb
Instance Attribute Summary
Attributes inherited from Base
#args, #options, #request_timer
Instance Method Summary
collapse
Methods inherited from Base
#ask_yes_or_no, authenticated_users_only!, call, #call, command_name, configure, #current_user, #debug, description, disable!, disabled?, #error, #fatal, #force_yes?, #info, #initialize, #logger, options, #summarize, #summarize_hash, syntax, #table, #verbose?, warn_unauthenticated_users
Instance Method Details
#execute ⇒ Object
5
6
7
8
9
10
11
12
|
# File 'lib/quandl/command/tasks/info.rb', line 5
def execute
info title "Quandl Toolbelt"
info current_user.info
info toolbelt_info
debug title "Package Versions"
debug package_info
end
|
#package_info ⇒ Object
34
35
36
|
# File 'lib/quandl/command/tasks/info.rb', line 34
def package_info
quandl_package_versions.sort_by{|p| p[:package].to_s }.collect{|p| "#{ p[:package] } ( #{ p[:version] } )" }.join("\n")
end
|
#quandl_package_versions ⇒ Object
38
39
40
41
42
43
44
|
# File 'lib/quandl/command/tasks/info.rb', line 38
def quandl_package_versions
Quandl.constants.collect do |c|
package = "Quandl::#{c}".constantize
version = "Quandl::#{c}::VERSION".constantize rescue nil
{ package: package, version: version } unless version.nil?
end.compact
end
|
#title(name) ⇒ Object
14
15
16
17
|
# File 'lib/quandl/command/tasks/info.rb', line 14
def title(name)
name = name.to_s
"\n#{name}\n" + ( name.length.times.collect{'='}.join )
end
|
26
27
28
29
30
31
32
|
# File 'lib/quandl/command/tasks/info.rb', line 26
def toolbelt_info
[
"host: #{quandl_url}",
"token: #{auth_token}",
"version: #{Quandl::Command::VERSION}",
].join("\n")
end
|
#user_info ⇒ Object
19
20
21
22
23
24
|
# File 'lib/quandl/command/tasks/info.rb', line 19
def user_info
[
"username: #{current_user.username}",
"email: #{current_user.email}",
].join("\n")
end
|