Class: Evertils::Common::Query::Backup

Inherits:
Base show all
Defined in:
lib/evertils/common/query/backup.rb

Overview

Since:

  • 0.3.0

Instance Method Summary collapse

Methods inherited from Base

#end_of_day, #start_of_day

Methods inherited from Generic

#bytesize, #deprecation_notice, #encoding, #force_encoding, #has_required_fields, #initialize

Constructor Details

This class inherits a constructor from Evertils::Common::Generic

Instance Method Details

#expunge!Object

Since:

  • 0.2.9



25
26
27
# File 'lib/evertils/common/query/backup.rb', line 25

def expunge!
  @entity.expunge!
end

#files(*files) ⇒ Object

Since:

  • 0.2.8



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/evertils/common/query/backup.rb', line 7

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