Module: EvernoteOAuth::BusinessUtils

Includes:
BusinessNoteStore, NoteStore, SharedNoteStore, UserStore
Included in:
Client
Defined in:
lib/evernote_oauth/business_utils.rb

Instance Method Summary collapse

Methods included from BusinessNoteStore

#business_note_store

Methods included from UserStore

#user_store

Methods included from SharedNoteStore

#shared_note_store

Methods included from NoteStore

#note_store

Instance Method Details

#create_business_notebook(notebook) ⇒ Evernote::EDAM::Type::LinkedNotebook

Creates a business notebook in the business account and LinkedNotebook for the user.

Parameters:

Returns:



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/evernote_oauth/business_utils.rb', line 31

def create_business_notebook(notebook)
  business_notebook = business_note_store.createNotebook(notebook)
  shared_notebook = business_notebook.sharedNotebooks.first
  business_user = business_note_store.user
  linked_notebook = Evernote::EDAM::Type::LinkedNotebook.new(
    shareKey: shared_notebook.shareKey,
    shareName: business_notebook.name,
    username: business_user.username,
    shardId: business_user.shardId
  )
  note_store.createLinkedNotebook(linked_notebook)
end

#create_note_in_business_notebook(note, business_notebook) ⇒ Evernote::EDAM::Type::Note

Creates a note in the given business notebook.

Parameters:

Returns:

  • (Evernote::EDAM::Type::Note)

    The newly created Note from the service. The server-side GUIDs for the Note and any Resources will be saved in this object.



14
15
16
17
18
# File 'lib/evernote_oauth/business_utils.rb', line 14

def create_note_in_business_notebook(note, business_notebook)
  shared_notebook = shared_note_store(business_notebook).getSharedNotebookByAuth
  note.notebookGuid = shared_notebook.notebookGuid
  shared_note_store(business_notebook).createNote(note)
end

#get_corresponding_notebook(business_notebook) ⇒ Evernote::EDAM::Type::Notebook

Get a notebook object corresponding to the given business notebook.

Parameters:

Returns:



48
49
50
51
# File 'lib/evernote_oauth/business_utils.rb', line 48

def get_corresponding_notebook(business_notebook)
  shared_notebook = shared_note_store(business_notebook).getSharedNotebookByAuth
  business_note_store.getNotebook(shared_notebook.notebookGuid)
end

#list_business_notebooksArray<Evernote::EDAM::Type::LinkedNotebook>

Lists all business notebooks the user can access.

Returns:



23
24
25
# File 'lib/evernote_oauth/business_utils.rb', line 23

def list_business_notebooks
  note_store.listLinkedNotebooks.select(&:businessId)
end