Class: Bcli::Commands::Drive::Search

Inherits:
Bcli::Command show all
Defined in:
lib/bcli/commands/drive/search.rb

Instance Method Summary collapse

Methods inherited from Bcli::Command

#ask, #client, #config, #credentials, #download, #link_to, #logger, #open_in_browser, #parse_json, #pastel, #prompt

Constructor Details

#initialize(options) ⇒ Search

attr_reader :query, :download_file



10
11
12
13
14
# File 'lib/bcli/commands/drive/search.rb', line 10

def initialize(options)
  @options = options
  # @download_file = options[:download]
  # @query = options[:query]
end

Instance Method Details

#execute(input: $stdin, output: $stdout, page: 1) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/bcli/commands/drive/search.rb', line 16

def execute(input: $stdin, output: $stdout, page: 1)
  res = client.get("/uploads?q[filename_cont]=#{query}&page=#{page}")
  if res.success?
    output.puts handle_search_response(res)
  else
    output.puts pastel.red res.inspect
  end
end