Class: Evertils::Common::Entity::Notebook

Inherits:
Base
  • Object
show all
Defined in:
lib/evertils/common/entity/notebook.rb

Overview

Since:

  • 0.3.0

Constant Summary

Constants inherited from Base

Base::REPLACEMENTS

Instance Attribute Summary

Attributes inherited from Base

#entity

Instance Method Summary collapse

Methods inherited from Base

#end_of_day, #initialize, #placeholders_for, #prop, #start_of_day, #symbolize_keys, #to_s

Methods inherited from Generic

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

Constructor Details

This class inherits a constructor from Evertils::Common::Entity::Base

Instance Method Details

#create(name, stack = nil) ⇒ Object

Since:

  • 0.2.0



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/evertils/common/entity/notebook.rb', line 20

def create(name, stack = nil)
  @entity = nil

  notebook = ::Evernote::EDAM::Type::Notebook.new
  notebook.name = name

  if !stack.nil?
    notebook.stack = stack
    notebook.name = "#{stack}/#{name}"
  end

  @entity = @evernote.call(:createNotebook, notebook)

  self if @entity
end

#defaultObject

Since:

  • 0.2.0



38
39
40
41
42
# File 'lib/evertils/common/entity/notebook.rb', line 38

def default
  @entity = @evernote.call(:getDefaultNotebook)

  self if @entity
end

#expungeObject

Deprecated.

0.2.9

Since:

  • 0.2.0



53
54
55
56
57
# File 'lib/evertils/common/entity/notebook.rb', line 53

def expunge
  deprecation_notice('0.2.9', 'Replaced with Entity#expunge!  Will be removed in 0.4.0.')

  @evernote.call(:expungeNotebook, @entity.guid)
end

#expunge!Object

Since:

  • 0.2.9



46
47
48
# File 'lib/evertils/common/entity/notebook.rb', line 46

def expunge!
  @evernote.call(:expungeNotebook, @entity.guid)
end

#find(name) ⇒ Object

Since:

  • 0.2.0



9
10
11
12
13
14
15
16
# File 'lib/evertils/common/entity/notebook.rb', line 9

def find(name)
  @entity = nil
  notebooks = Notebooks.new.all

  @entity = notebooks.detect { |nb| nb.name == name }

  self if @entity
end

#notesObject

Since:

  • 0.2.0



61
62
63
64
65
66
67
# File 'lib/evertils/common/entity/notebook.rb', line 61

def notes
  filter = ::Evernote::EDAM::NoteStore::NoteFilter.new
  filter.notebookGuid = @entity.guid

  notes = Notes.new
  notes.find(nil, @entity.guid)
end