0.0
No commit activity in last 3 years
No release in over 3 years
Uses google-api-ruby-client and Google Drive to convert files from one mime-type to another
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.10.1
~> 10.4.2
~> 3.2.0
~> 0.30.0

Runtime

 Project Readme

file-convert Gem Version Build Status Dependency Status

Use google-api-ruby-client and Google Drive to convert files from one mime-type to another. For available formats see Google Drive API Export Formats.

Installation

Simply add it to your Gemfile:

gem 'file-convert'

Config

FileConvert exposes .configure which accepts a block and passes the config hash. Example:

FileConvert.configure do |config|
  config['google_service_account'] = {
    'email' => '<strange-hash>@developer.gserviceaccount.com',
    'pkcs12_file_path' => 'config/file_convert_key.p12'
  }
end

Examples

# converts `path_to_some_file` from <txt> to <pdf>
conversion = FileConvert.convert('path_to_some_file.txt', 'text/plain', 'application/pdf')
# converted body is accessible via `#body`
conversion.body
# .. or define a path to save the converted document to
conversion.save('path_to_new_file.pdf')

Specs

  • $ bundle exec rake for rspec and rubocop.
  • $ bundle exec rake build to also run the integration tests located at spec/integration/**/*_integration.rb. Note that you need to configure valid Google API credentials (i.e. set ENV['email'] and ENV['pkcspath']) for these tests to work, since we want to actually test the integration with the Google API here. (Do not worry, TravisCI will run these tests as well.)

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using the ways described above.

Next Steps

  • Enable OCR if necessary when uploading files
  • Add CLI
  • Add different adapter than Google?

License

file-convert is Copyright © 2014 Roman Ernst and tolingo GmbH and may be redistributed under the terms specified in the LICENSE file.