70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# File 'lib/document_exporter/gdoc/base.rb', line 70
def export_to(folder_id, file_id: nil)
metadata = Google::Apis::DriveV3::File.new(
name: document.base_filename(with_version: false),
mime_type: 'application/vnd.google-apps.document',
parents: [folder_id]
)
params = {
content_type: 'text/html',
upload_source: StringIO.new(content)
}.merge(GOOGLE_API_UPLOAD_OPTIONS)
@id = if file_id.present?
drive_service.service.update_file(file_id, metadata, params)
else
drive_service.service.create_file(metadata, params)
end.id
post_processing
self
end
|