Class: CloudFile::Gdrive

Inherits:
Service show all
Defined in:
lib/cloud_file/providers/gdrive.rb

Instance Method Summary collapse

Methods inherited from Service

auth_value, #files, for_user, #open, #read_format, register, register_converter, uri_format

Instance Method Details

#listObject



25
26
27
28
29
30
31
32
33
# File 'lib/cloud_file/providers/gdrive.rb', line 25

def list
  client.files.map do |f|
    if f.title.downcase =~ /interview/
      ::File.create "entry.xml",f.document_feed_entry.to_s 
      raise 'foo'
    end
    {:title => f.title}
  end
end

#read(loc) ⇒ Object



14
15
16
17
18
# File 'lib/cloud_file/providers/gdrive.rb', line 14

def read(loc)
  file = client.file_by_title(loc[:title])
  file.download_to_file temp_file
  ::File.read temp_file
end

#temp_fileObject



10
11
12
# File 'lib/cloud_file/providers/gdrive.rb', line 10

def temp_file
  "/users/mharris717/multi.txt"
end

#write(loc, val) ⇒ Object



20
21
22
23
# File 'lib/cloud_file/providers/gdrive.rb', line 20

def write(loc,val)
  ::File.create temp_file,val
  client.upload_from_file(temp_file, loc[:title], :convert => true)
end