Sha256: f9bf9168b197921179aca236ac3f9cd339d41c44c159479dbc60ca93893ece5f

Contents?: true

Size: 763 Bytes

Versions: 19

Compression:

Stored size: 763 Bytes

Contents

module Evertils
  module Common
    module Query
      class Backup < Query::Base
        #
        # @since 0.2.8
        def files(*files)
          date = DateTime.now
          backup_notebook_name = 'Backup'
          nm = Entity::Note.new

          # create the backup notebook if it does not exist
          nb_entity = Entity::Notebook.new
          nb = nb_entity.find(backup_notebook_name)

          if nb_entity.find(backup_notebook_name).nil?
            nb = nb_entity.create(backup_notebook_name)
          end

          @entity = nm.create(title: "Backup: #{date}", body: "", parent_notebook: nb, files: files)
        end

        #
        # @since 0.2.9
        def expunge!
          @entity.expunge!
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
evertils-common-0.3.18 lib/evertils/common/query/backup.rb
evertils-common-0.3.17 lib/evertils/common/query/backup.rb
evertils-common-0.3.16 lib/evertils/common/query/backup.rb
evertils-common-0.3.15 lib/evertils/common/query/backup.rb
evertils-common-0.3.14 lib/evertils/common/query/backup.rb
evertils-common-0.3.13 lib/evertils/common/query/backup.rb
evertils-common-0.3.12 lib/evertils/common/query/backup.rb
evertils-common-0.3.11 lib/evertils/common/query/backup.rb
evertils-common-0.3.10 lib/evertils/common/query/backup.rb
evertils-common-0.3.9 lib/evertils/common/query/backup.rb
evertils-common-0.3.8 lib/evertils/common/query/backup.rb
evertils-common-0.3.7 lib/evertils/common/query/backup.rb
evertils-common-0.3.6 lib/evertils/common/query/backup.rb
evertils-common-0.3.5 lib/evertils/common/query/backup.rb
evertils-common-0.3.4.1 lib/evertils/common/query/backup.rb
evertils-common-0.3.4 lib/evertils/common/query/backup.rb
evertils-common-0.3.4.1.pre.dev lib/evertils/common/query/backup.rb
evertils-common-0.3.3.1 lib/evertils/common/query/backup.rb
evertils-common-0.3.3 lib/evertils/common/query/backup.rb