Class: Evertils::Common::Query::Time

Inherits:
Base show all
Defined in:
lib/evertils/common/query/time.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

#last_monthObject

Since:

  • 0.2.8



58
59
60
61
62
63
64
# File 'lib/evertils/common/query/time.rb', line 58

def last_month
  filter = ::Evernote::EDAM::NoteStore::NoteFilter.new
  filter.words = "created:month-1"

  note_manager = Evertils::Common::Entity::Notes.new
  note_manager.find_by_filter(filter)
end

#last_weekObject

Since:

  • 0.2.8



68
69
70
71
72
73
74
# File 'lib/evertils/common/query/time.rb', line 68

def last_week
  filter = ::Evernote::EDAM::NoteStore::NoteFilter.new
  filter.words = "created:week-1"

  note_manager = Evertils::Common::Entity::Notes.new
  note_manager.find_by_filter(filter)
end

#last_yearObject

Since:

  • 0.2.8



48
49
50
51
52
53
54
# File 'lib/evertils/common/query/time.rb', line 48

def last_year
  filter = ::Evernote::EDAM::NoteStore::NoteFilter.new
  filter.words = "created:year-1"

  note_manager = Evertils::Common::Entity::Notes.new
  note_manager.find_by_filter(filter)
end

#notebooks_created_in_range(start, finish = nil) ⇒ Object

Since:

  • 0.2.8



30
31
32
33
34
35
# File 'lib/evertils/common/query/time.rb', line 30

def notebooks_created_in_range(start, finish = nil)
  finish = DateTime.now if !finish
  notebook_manager = Evertils::Common::Entity::Notebooks.new

  notebook_manager.find_by_date_range(start, finish)
end

#notebooks_updated_in_range(start, finish = nil) ⇒ Object

Since:

  • 0.2.8



39
40
41
42
43
44
# File 'lib/evertils/common/query/time.rb', line 39

def notebooks_updated_in_range(start, finish = nil)
  finish = DateTime.now if !finish
  notebook_manager = Evertils::Common::Entity::Notebooks.new

  notebook_manager.find_by_date_range(start, finish, :updated)
end

#notes_created_on(date = DateTime.now) ⇒ Object

Since:

  • 0.2.8



16
17
18
19
# File 'lib/evertils/common/query/time.rb', line 16

def notes_created_on(date = DateTime.now)
  note_manager = Evertils::Common::Entity::Notes.new
  note_manager.find_by_date(date)
end

#notes_in_range(start, finish = nil, period = :created) ⇒ Object

Since:

  • 0.2.8



7
8
9
10
11
12
# File 'lib/evertils/common/query/time.rb', line 7

def notes_in_range(start, finish = nil, period = :created)
  finish = DateTime.now if !finish
  note_manager = Evertils::Common::Entity::Notes.new

  note_manager.find_by_date_range(start, finish, period)
end

#notes_updated_on(date = DateTime.now) ⇒ Object

Since:

  • 0.2.8



23
24
25
26
# File 'lib/evertils/common/query/time.rb', line 23

def notes_updated_on(date = DateTime.now)
  note_manager = Evertils::Common::Entity::Notes.new
  note_manager.find_by_date(date, :updated)
end

#yesterdayObject

Since:

  • 0.2.8



78
79
80
81
82
83
84
# File 'lib/evertils/common/query/time.rb', line 78

def yesterday
  filter = ::Evernote::EDAM::NoteStore::NoteFilter.new
  filter.words = "created:day-1"

  note_manager = Evertils::Common::Entity::Notes.new
  note_manager.find_by_filter(filter)
end