Sha256: 0a6ab8109bfb47865a2fcde52acd547e187daabe08a45a9bb1b99fa30eec2e0b
Contents?: true
Size: 1003 Bytes
Versions: 34
Compression:
Stored size: 1003 Bytes
Contents
module Datapimp class Sync::GoogleDriveFolder < Hashie::Mash def api @api ||= Datapimp::Sync.google.api end def local_path Pathname(local) end def remote_path api.collection_by_title(remote) end def drawings remote_path.files.select {|file| file.mime_type == "application/vnd.google-apps.drawing" } end def run(action, options={}) action = action.to_sym if action == :push elsif action == :pull elsif action == :svgs drawings.each do |drawing| filename = drawing.title.parameterize + '.svg' local_file = local_path.join(filename) if local_file.exist? && !options[:overwrite] puts "== #{ filename } already exists. skipping. pass --overwrite to overwrite" else puts "== Downloading to svg: #{ filename }" drawing.export_as_file(local_path.join(filename), 'image/svg+xml') end end end end end end
Version data entries
34 entries across 34 versions & 1 rubygems