class Evertils::Common::Entity::Notebook

Public Instance Methods

create(name, stack = nil) click to toggle source

@since 0.2.0

# 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
default() click to toggle source

@since 0.2.0

# File lib/evertils/common/entity/notebook.rb, line 38
def default
  @entity = @evernote.call(:getDefaultNotebook)

  self if @entity
end
expunge() click to toggle source

@since 0.2.0 @deprecated 0.2.9

# 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!() click to toggle source

@since 0.2.9

# File lib/evertils/common/entity/notebook.rb, line 46
def expunge!
  @evernote.call(:expungeNotebook, @entity.guid)
end
find(name) click to toggle source

@since 0.2.0

# 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
notes() click to toggle source

@since 0.2.0

# 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