Class: GoogleDoc
- Inherits:
-
Object
- Object
- GoogleDoc
- Defined in:
- lib/google_doc.rb
Instance Attribute Summary collapse
-
#session ⇒ Object
Returns the value of attribute session.
Instance Method Summary collapse
Instance Attribute Details
#session ⇒ Object
Returns the value of attribute session.
3 4 5 |
# File 'lib/google_doc.rb', line 3 def session @session end |
Instance Method Details
#authenticate ⇒ Object
5 6 7 8 |
# File 'lib/google_doc.rb', line 5 def authenticate # will try to get token from ~/.ruby_google_drive.token @session = GoogleDrive.saved_session end |
#download(requested_filename, output_filename = "translations.csv") ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/google_doc.rb', line 10 def download(requested_filename, output_filename = "translations.csv") unless @session self.authenticate end result = @session.file_by_title(requested_filename) if result.is_a? Array file = result.first else file = result end return nil unless file file.export_as_file(output_filename, "csv") return output_filename end |