Class: Evertils::Common::Model::Note
- Inherits:
-
Object
- Object
- Evertils::Common::Model::Note
- Defined in:
- lib/evertils/common/model/note.rb
Overview
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#body ⇒ Object
(also: #content)
Accessor for the body/content property.
-
#created ⇒ Object
Accessor for the created_on property.
-
#entity ⇒ Object
The whole note.
-
#initialize(conf = {}) ⇒ Note
constructor
A new instance of Note.
-
#notebook ⇒ Object
Accessor for the notebook property.
-
#tags ⇒ Object
Accessor for the tagNames property.
-
#title ⇒ Object
Accessor for the title property.
Constructor Details
#initialize(conf = {}) ⇒ Note
Returns a new instance of Note.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/evertils/common/model/note.rb', line 13 def initialize(conf = {}) @conf = conf raise "Title (title) is a required field" unless conf[:title] @note = ::Evernote::EDAM::Type::Note.new # data which maps directly to the Type::Note object self.colour = conf[:colour] || 0xffffff self.created = conf[:created_on] || DateTime.now note_content = '' note_content += conf[:sections][:header] if valid_header? conf[:sections][:body]&.map { |el| note_content += "<h2>#{el}</h2>" } if valid_body? note_content += conf[:sections][:footer] if self.body = conf[:content] || note_content @note.title = conf[:title] @note.tagNames = conf[:tags] || [] @note.resources = [] # data that must be processed first @notebook = conf[:notebook] || Entity::Notebook.new.default.to_s @resources = conf[:file] || [] @shareable = conf[:share_note] || false @updated = conf[:updated_on] || nil attach_resources attach_notebook end |
Instance Attribute Details
#colour ⇒ Object
8 9 10 |
# File 'lib/evertils/common/model/note.rb', line 8 def colour @colour end |
#conf ⇒ Object (readonly)
9 10 11 |
# File 'lib/evertils/common/model/note.rb', line 9 def conf @conf end |
#shareable ⇒ Object
8 9 10 |
# File 'lib/evertils/common/model/note.rb', line 8 def shareable @shareable end |
#updated ⇒ Object
8 9 10 |
# File 'lib/evertils/common/model/note.rb', line 8 def updated @updated end |
Instance Method Details
#body ⇒ Object Also known as: content
Accessor for the body/content property
51 52 53 |
# File 'lib/evertils/common/model/note.rb', line 51 def body @note.content end |
#created ⇒ Object
Accessor for the created_on property
70 71 72 |
# File 'lib/evertils/common/model/note.rb', line 70 def created @note.created end |
#entity ⇒ Object
The whole note
76 77 78 |
# File 'lib/evertils/common/model/note.rb', line 76 def entity @note end |
#notebook ⇒ Object
Accessor for the notebook property
58 59 60 |
# File 'lib/evertils/common/model/note.rb', line 58 def notebook @note.notebookGuid end |
#tags ⇒ Object
Accessor for the tagNames property
64 65 66 |
# File 'lib/evertils/common/model/note.rb', line 64 def @note.tagNames end |
#title ⇒ Object
Accessor for the title property
45 46 47 |
# File 'lib/evertils/common/model/note.rb', line 45 def title @note.title end |