class Bl::Commands::Space
Public Class Methods
new(*)
click to toggle source
Calls superclass method
# File lib/bl/commands/space.rb, line 4 def initialize(*) @config = Bl::Config.instance super end
Public Instance Methods
disk_usage()
click to toggle source
# File lib/bl/commands/space.rb, line 44 def disk_usage res = request(:get, 'space/diskUsage') print_space_disk_usage(res) end
get_notification()
click to toggle source
# File lib/bl/commands/space.rb, line 31 def get_notification res = request(:get, 'space/notification') print_space_notification(res) end
image()
click to toggle source
# File lib/bl/commands/space.rb, line 24 def image body = request(:get, 'space/image').body ::File.open(body.filename, 'wb') { |f| f.write(body.content) } puts "#{body.filename} generated." end
info()
click to toggle source
# File lib/bl/commands/space.rb, line 10 def info res = request(:get, 'space') puts formatter.render(res.body, fields: SPACE_FIELDS) end
update_notification(content)
click to toggle source
# File lib/bl/commands/space.rb, line 37 def update_notification(content) res = client.put('space/notification', content: content) puts 'space notification updated' print_space_notification(res) end
Private Instance Methods
print_space_disk_usage(res)
click to toggle source
# File lib/bl/commands/space.rb, line 55 def print_space_disk_usage(res) puts 'summary:' puts formatter.render(res.body, fields: SPACE_DISK_USAGE) puts 'details:' puts formatter.render( res.body.details, fields: SPACE_DISK_USAGE_DETAILS_FIELDS ) end
print_space_notification(res)
click to toggle source
# File lib/bl/commands/space.rb, line 51 def print_space_notification(res) puts formatter.render(res.body, fields: SPACE_NOTIFICATION_FIELDS) end