Sha256: 27fc9d342b0aad199c6dcb34d0b425c28f733c52a8c08e3a8f10611f2af49c27
Contents?: true
Size: 897 Bytes
Versions: 5
Compression:
Stored size: 897 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 ) file.id end private def service @service ||= Lt::Google::Api::Drive.build(@credentials) end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems