Class: FileConvert::Docs

Inherits:
Object
  • Object
show all
Defined in:
lib/file_convert/docs.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Docs

Returns a new instance of Docs.



7
8
9
10
# File 'lib/file_convert/docs.rb', line 7

def initialize(config)
  @client = GData::Client::Spreadsheets.new
  @client.clientlogin(config.user_name, config.password)
end

Instance Method Details

#download_and_read(url) ⇒ Object



12
13
14
15
16
17
# File 'lib/file_convert/docs.rb', line 12

def download_and_read(url)
  temp_file = Converter.get_a_temp_file
  content = @client.get(url)
  File.open(temp_file, 'w') { |file| file.write(content.body) }
  File.read(temp_file)
end