class Bl::Commands::File

Public Class Methods

new(*) click to toggle source
Calls superclass method
# File lib/bl/commands/file.rb, line 4
def initialize(*)
  @config = Bl::Config.instance
  @url = "projects/#{@config[:project_key]}"
  super
end

Public Instance Methods

get(*ids) click to toggle source
# File lib/bl/commands/file.rb, line 17
def get(*ids)
  ids.each do |id|
    res = request(:get, "#{@url}/files/#{id}")
    f = ::File.new(res.body.filename, 'w')
    f.write(res.body.content)
    f.close
    puts "file #{id} #{res.body.filename} downloaded."
  end
end
list(path = '') click to toggle source
# File lib/bl/commands/file.rb, line 11
def list(path = '')
  res = request(:get, "#{@url}/files/metadata/#{path}")
  print_response(res, :file)
end