Class: Bl::Commands::Space

Inherits:
Bl::Command show all
Defined in:
lib/bl/commands/space.rb

Instance Method Summary collapse

Methods included from Printer

print_response, printable_issues

Methods included from Requestable

client, formatter, request

Constructor Details

#initializeSpace

Returns a new instance of Space.



4
5
6
7
# File 'lib/bl/commands/space.rb', line 4

def initialize(*)
  @config = Bl::Config.instance
  super
end

Instance Method Details

#disk_usageObject



44
45
46
47
# File 'lib/bl/commands/space.rb', line 44

def disk_usage
  res = request(:get, 'space/diskUsage')
  print_space_disk_usage(res)
end

#get_notificationObject



31
32
33
34
# File 'lib/bl/commands/space.rb', line 31

def get_notification
  res = request(:get, 'space/notification')
  print_space_notification(res)
end

#imageObject



24
25
26
27
28
# 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

#infoObject



10
11
12
13
# 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) ⇒ Object



37
38
39
40
41
# 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