Class: FileConvert::Converter
- Inherits:
-
Object
- Object
- FileConvert::Converter
- Defined in:
- lib/file_convert.rb
Class Method Summary collapse
- .configuration ⇒ Object
- .configure {|configuration| ... } ⇒ Object
- .get_a_temp_file(key = '') ⇒ Object
Instance Method Summary collapse
-
#initialize ⇒ Converter
constructor
A new instance of Converter.
- #to_txt_from_s3(s3_file_key) ⇒ Object
Constructor Details
#initialize ⇒ Converter
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
.configuration ⇒ Object
16 17 18 |
# File 'lib/file_convert.rb', line 16 def self.configuration @config ||= Configuration.new end |
.configure {|configuration| ... } ⇒ Object
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 |