evertils-common 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/evertils/common/entity/note.rb +4 -0
- data/lib/evertils/common/entity/sync.rb +21 -0
- data/lib/evertils/common/queries/simple.rb +88 -0
- data/lib/evertils/common/version.rb +1 -1
- data/lib/evertils/common.rb +3 -1
- metadata +3 -2
- data/lib/evertils/common/simplequeries.rb +0 -70
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e57d1a952e6919cb2e454985c29c01786127dd8
|
4
|
+
data.tar.gz: acb73cef67dcb5b2614b26d631824a00f72bf304
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca62fed087792f4fb6b11b3cad3e73db0431a5153c0442c8eb4f167fcf93ab99d2221df0ef819b51708aba08845936b5930e14393c753177fa39fced5807c5ca
|
7
|
+
data.tar.gz: 5ef8ceb6814ad67cba541375284b7787e517467122f3f848d383707bb7ad496d9c849fa19f6e5a8a4f82b7d74bb4c1519f9b97476c5bdf679e24df1adf31fd2d
|
@@ -60,6 +60,10 @@ module Evertils
|
|
60
60
|
|
61
61
|
nb = Entity::Notebook.new
|
62
62
|
parent_notebook = nb.find(p_notebook_name)
|
63
|
+
|
64
|
+
if parent_notebook.nil?
|
65
|
+
parent_notebook = @evernote.getDefaultNotebook(Evertils::Common::EVERNOTE_DEVELOPER_TOKEN)
|
66
|
+
end
|
63
67
|
|
64
68
|
## parent_notebook is optional; if omitted, default notebook is used
|
65
69
|
if parent_notebook.is_a? ::Evernote::EDAM::Type::Notebook
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'evertils/common/authentication'
|
2
|
+
|
3
|
+
module Evertils
|
4
|
+
module Common
|
5
|
+
module Entity
|
6
|
+
class Sync
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
@evernote = Authentication.new.store
|
10
|
+
|
11
|
+
self
|
12
|
+
end
|
13
|
+
|
14
|
+
def state
|
15
|
+
@evernote.getSyncState()
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
require 'evertils/common/entity/notebook'
|
2
|
+
require 'evertils/common/entity/notebooks'
|
3
|
+
require 'evertils/common/entity/notes'
|
4
|
+
require 'evertils/common/entity/note'
|
5
|
+
require 'evertils/common/entity/tag'
|
6
|
+
require 'evertils/common/entity/tags'
|
7
|
+
require 'evertils/common/entity/sync'
|
8
|
+
|
9
|
+
module Evertils
|
10
|
+
module Common
|
11
|
+
module Queries
|
12
|
+
class Simple
|
13
|
+
|
14
|
+
def notebooks
|
15
|
+
Entity::Notebooks.new.all
|
16
|
+
end
|
17
|
+
|
18
|
+
def tags
|
19
|
+
Entity::Tags.new.all
|
20
|
+
end
|
21
|
+
|
22
|
+
def notebook_by_name(name)
|
23
|
+
nb = Entity::Notebook.new
|
24
|
+
nb.find(name)
|
25
|
+
end
|
26
|
+
|
27
|
+
def notes_by_notebook(name)
|
28
|
+
nb = Entity::Notebook.new
|
29
|
+
nb.find(name)
|
30
|
+
nb.notes
|
31
|
+
end
|
32
|
+
|
33
|
+
def create_stack_from(full_path)
|
34
|
+
stack = Entity::Stack.new
|
35
|
+
stack.create_from_yml(full_path)
|
36
|
+
end
|
37
|
+
|
38
|
+
def create_note_from(full_path)
|
39
|
+
note = Entity::Note.new
|
40
|
+
note.create_from_yml(full_path)
|
41
|
+
end
|
42
|
+
|
43
|
+
def create_notebooks_from(full_path)
|
44
|
+
nb = Entity::Notebooks.new
|
45
|
+
nb.create_from_yml(full_path)
|
46
|
+
end
|
47
|
+
|
48
|
+
def create_notebook(name, stack = nil)
|
49
|
+
nb = Entity::Notebook.new
|
50
|
+
nb.create(name, stack)
|
51
|
+
end
|
52
|
+
|
53
|
+
def find_note(title_filter = nil, notebook_filter = nil)
|
54
|
+
note = Entity::Note.new
|
55
|
+
note.find(title_filter, notebook_filter)
|
56
|
+
end
|
57
|
+
|
58
|
+
def note_exists(name)
|
59
|
+
note = Entity::Note.new
|
60
|
+
note.exists? name
|
61
|
+
end
|
62
|
+
|
63
|
+
def create_note(title, body = template_contents, p_notebook_name = nil, file = nil, share_note = false, created_on = nil)
|
64
|
+
note = Entity::Note.new
|
65
|
+
note.create(title, body, p_notebook_name, file, share_note, created_on)
|
66
|
+
end
|
67
|
+
|
68
|
+
def destroy_note(name)
|
69
|
+
note = Entity::Note.new
|
70
|
+
note.find(name)
|
71
|
+
note.expunge(name)
|
72
|
+
end
|
73
|
+
|
74
|
+
def poll
|
75
|
+
begin
|
76
|
+
sync = Entity::Sync.new
|
77
|
+
sync.state
|
78
|
+
rescue Evernote::EDAM::Error::EDAMSystemException => e
|
79
|
+
if e.errorCode == 19
|
80
|
+
puts "You're rate limited, wait #{e.rateLimitDuration}s"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
data/lib/evertils/common.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: evertils-common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Priebe
|
@@ -91,9 +91,10 @@ files:
|
|
91
91
|
- lib/evertils/common/entity/notebooks.rb
|
92
92
|
- lib/evertils/common/entity/notes.rb
|
93
93
|
- lib/evertils/common/entity/stack.rb
|
94
|
+
- lib/evertils/common/entity/sync.rb
|
94
95
|
- lib/evertils/common/entity/tag.rb
|
95
96
|
- lib/evertils/common/entity/tags.rb
|
96
|
-
- lib/evertils/common/
|
97
|
+
- lib/evertils/common/queries/simple.rb
|
97
98
|
- lib/evertils/common/version.rb
|
98
99
|
homepage: http://rubygems.org/gems/evertils-common
|
99
100
|
licenses:
|
@@ -1,70 +0,0 @@
|
|
1
|
-
require 'yaml'
|
2
|
-
require 'evertils/common/enml'
|
3
|
-
require 'evertils/common/entity/notebook'
|
4
|
-
require 'evertils/common/entity/notebooks'
|
5
|
-
require 'evertils/common/entity/notes'
|
6
|
-
require 'evertils/common/entity/note'
|
7
|
-
require 'evertils/common/entity/tag'
|
8
|
-
require 'evertils/common/entity/tags'
|
9
|
-
|
10
|
-
module Evertils
|
11
|
-
module Common
|
12
|
-
class SimpleQueries
|
13
|
-
|
14
|
-
def notebooks
|
15
|
-
Entity::Notebooks.new.all
|
16
|
-
end
|
17
|
-
|
18
|
-
def tags
|
19
|
-
Entity::Tags.new.all
|
20
|
-
end
|
21
|
-
|
22
|
-
def notebook_by_name(name)
|
23
|
-
nb = Entity::Notebook.new
|
24
|
-
nb.find(name)
|
25
|
-
end
|
26
|
-
|
27
|
-
def notes_by_notebook(name)
|
28
|
-
nb = Entity::Notebook.new
|
29
|
-
nb.find(name)
|
30
|
-
nb.notes
|
31
|
-
end
|
32
|
-
|
33
|
-
def create_stack_from(full_path)
|
34
|
-
stack = Entity::Stack.new
|
35
|
-
stack.create_from_yml(full_path)
|
36
|
-
end
|
37
|
-
|
38
|
-
def create_note_from(full_path)
|
39
|
-
note = Entity::Note.new
|
40
|
-
note.create_from_yml(full_path)
|
41
|
-
end
|
42
|
-
|
43
|
-
def create_notebooks_from(full_path)
|
44
|
-
nb = Entity::Notebooks.new
|
45
|
-
nb.create_from_yml(full_path)
|
46
|
-
end
|
47
|
-
|
48
|
-
def create_notebook(name, stack = nil)
|
49
|
-
nb = Entity::Notebook.new
|
50
|
-
nb.create(name, stack)
|
51
|
-
end
|
52
|
-
|
53
|
-
def find_note(title_filter = nil, notebook_filter = nil)
|
54
|
-
note = Entity::Note.new
|
55
|
-
note.find(title_filter, notebook_filter)
|
56
|
-
end
|
57
|
-
|
58
|
-
def note_exists(name)
|
59
|
-
note = Entity::Note.new
|
60
|
-
note.exists? name
|
61
|
-
end
|
62
|
-
|
63
|
-
def create_note(title, body = template_contents, p_notebook_name = nil, file = nil, share_note = false, created_on = nil)
|
64
|
-
note = Entity::Note.new
|
65
|
-
note.create(title, body, p_notebook_name, file, share_note, created_on)
|
66
|
-
end
|
67
|
-
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|