Sha256: b4c88280d21959e2367240aa1984a667f1b62c78d0169dec7eb5bb0e0673e021
Contents?: true
Size: 938 Bytes
Versions: 6
Compression:
Stored size: 938 Bytes
Contents
# frozen_string_literal: true module Lt module Lcms module Lesson module Uploader class Gdoc def initialize(credentials) @credentials = credentials end def upload(name, content, content_type, parent_folder_id = nil) file_metadata = { name: name, mime_type: Lt::Google::Api::Drive::MIME_FILE } file_metadata[:parents] = [parent_folder_id] if parent_folder_id.present? file = service.create_file( file_metadata, fields: 'id', upload_source: StringIO.new(content), content_type: content_type, supports_all_drives: true ) file.id end private def service @service ||= Lt::Google::Api::Drive.build(@credentials) end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems