evertils-common 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 02dd9b8ab4a87dc43530c8f3901a3635167ce8be
4
- data.tar.gz: c56c21729320d0c0ce03b2c47079476330ba1325
3
+ metadata.gz: 8e57d1a952e6919cb2e454985c29c01786127dd8
4
+ data.tar.gz: acb73cef67dcb5b2614b26d631824a00f72bf304
5
5
  SHA512:
6
- metadata.gz: 12cbf17aec809a6f401c63d8fdd0a1f7ec0a66b5de8303abed2b08df8c1ee8be1a83d82e460ac49795c7212b456e9b43df2afd39b9081b82249bdad4660ad524
7
- data.tar.gz: 125c61ce993770a8aba0b9a8e9336c3984fe6ccfe4462251cfd7c767d96d64280aeb65f0bcea136ccc5e19110afdf5967521f0af49681789cb0a378716d7ae00
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
@@ -1,5 +1,5 @@
1
1
  module Evertils
2
2
  module Common
3
- VERSION = "0.2.5"
3
+ VERSION = "0.2.6"
4
4
  end
5
5
  end
@@ -1,7 +1,9 @@
1
1
  require 'evernote-thrift'
2
2
  require 'notifaction'
3
+ require 'yaml'
4
+ require 'evertils/common/enml'
3
5
  require 'evertils/common/version'
4
- require 'evertils/common/simplequeries'
6
+ require 'evertils/common/queries/simple'
5
7
 
6
8
  module Evertils
7
9
  module Common
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.5
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/simplequeries.rb
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