Module: Joplin
- Defined in:
- lib/joplin.rb,
lib/joplin/version.rb
Overview
Defined Under Namespace
Classes: Error, Note, Notebook, Resource
Constant Summary
collapse
- VERSION =
"1.1.0"
- @@token =
nil
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Attribute Details
#token ⇒ Object
Returns the value of attribute token.
8
9
10
|
# File 'lib/joplin.rb', line 8
def token
@token
end
|
Class Method Details
.get_token ⇒ Object
22
23
24
25
26
27
|
# File 'lib/joplin.rb', line 22
def self.get_token
settings = JSON.parse File.read("#{ENV['HOME']}/.config/joplin-desktop/settings.json")
settings['api.token']
rescue StandardError
nil
end
|
.search(query, opts = {}) ⇒ Object
16
17
18
19
20
|
# File 'lib/joplin.rb', line 16
def self.search(query, opts = {})
url = "#{Joplin.uri}/search/?query=#{query}&token=#{Joplin.token}&type=#{opts[:type]}"
res = HTTP.get url
JSON.parse res.body
end
|
.token ⇒ Object
29
30
31
|
# File 'lib/joplin.rb', line 29
def self.token
@@token || get_token
end
|
.token=(token) ⇒ Object
12
13
14
|
# File 'lib/joplin.rb', line 12
def self.token=(token)
@@token = token
end
|
.uri ⇒ Object
37
38
39
|
# File 'lib/joplin.rb', line 37
def self.uri
@@uri
end
|
.uri=(uri) ⇒ Object
33
34
35
|
# File 'lib/joplin.rb', line 33
def self.uri=(uri)
@@uri = uri
end
|