Class: FileConvert::Converter

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConverter

Returns a new instance of Converter.



21
22
23
24
25
# File 'lib/file_convert.rb', line 21

def initialize
  @drive = Drive.new Converter.configuration
  @docs = Docs.new Converter.configuration
  @bucket = Bucket.new Converter.configuration
end

Class Method Details

.configurationObject



16
17
18
# File 'lib/file_convert.rb', line 16

def self.configuration
  @config ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



11
12
13
14
# File 'lib/file_convert.rb', line 11

def self.configure(&block)
  yield(configuration)
  configuration
end

.get_a_temp_file(key = '') ⇒ Object



33
34
35
# File 'lib/file_convert.rb', line 33

def self.get_a_temp_file(key = '')
  Tempfile.new(['file_convert', key], configuration.tmp_folder)
end

Instance Method Details

#to_txt_from_s3(s3_file_key) ⇒ Object



27
28
29
30
31
# File 'lib/file_convert.rb', line 27

def to_txt_from_s3(s3_file_key)
  s3_file = @bucket.download s3_file_key
  convert_txt_url = @drive.get_convert_txt_url s3_file.path
  @docs.download_and_read(convert_txt_url)
end