Class: Wunderlist::Note
- Inherits:
-
Object
- Object
- Wunderlist::Note
- Includes:
- Helper
- Defined in:
- lib/wunderlist/note.rb
Instance Attribute Summary collapse
-
#api ⇒ Object
Returns the value of attribute api.
-
#content ⇒ Object
Returns the value of attribute content.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#revision ⇒ Object
readonly
Returns the value of attribute revision.
-
#task_id ⇒ Object
readonly
Returns the value of attribute task_id.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
Instance Method Summary collapse
- #create ⇒ Object
-
#initialize(options = {}) ⇒ Note
constructor
A new instance of Note.
- #update ⇒ Object
Methods included from Helper
Constructor Details
#initialize(options = {}) ⇒ Note
Returns a new instance of Note.
12 13 14 15 16 17 18 19 20 |
# File 'lib/wunderlist/note.rb', line 12 def initialize( = {}) @api = ['api'] @id = ['id'] @task_id = ['task_id'] @content = ['content'] @created_at = ['created_at'] @updated_at = ['updated_at'] @revision = ['revision'] end |
Instance Attribute Details
#api ⇒ Object
Returns the value of attribute api.
9 10 11 |
# File 'lib/wunderlist/note.rb', line 9 def api @api end |
#content ⇒ Object
Returns the value of attribute content.
9 10 11 |
# File 'lib/wunderlist/note.rb', line 9 def content @content end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
10 11 12 |
# File 'lib/wunderlist/note.rb', line 10 def created_at @created_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
10 11 12 |
# File 'lib/wunderlist/note.rb', line 10 def id @id end |
#revision ⇒ Object (readonly)
Returns the value of attribute revision.
10 11 12 |
# File 'lib/wunderlist/note.rb', line 10 def revision @revision end |
#task_id ⇒ Object (readonly)
Returns the value of attribute task_id.
10 11 12 |
# File 'lib/wunderlist/note.rb', line 10 def task_id @task_id end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
10 11 12 |
# File 'lib/wunderlist/note.rb', line 10 def updated_at @updated_at end |
Instance Method Details
#create ⇒ Object
30 31 32 |
# File 'lib/wunderlist/note.rb', line 30 def create puts self.api.request :post, "api/v1/notes", self.to_hash end |
#update ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/wunderlist/note.rb', line 22 def update if self.id.nil? self.create else self.api.request :put, "api/v1/notes/#{self.id}", self.to_hash end end |