Sha256: 8572e2059fb29a743d1b5334c56e4a40904aa2dcf4f82c53f7f20ded21ef6382
Contents?: true
Size: 833 Bytes
Versions: 1
Compression:
Stored size: 833 Bytes
Contents
class Todoly class Task def self.list(rest_if) rest_if.items.map do |item| self.new(rest_if, item) end end def self.create(rest_if, name, obj={}) obj["Content"] = name Task.new(rest_if, obj).save end def initialize(rest_if, obj) @rest_if = rest_if set_obj(obj) end def set_obj(obj) @raw = obj @id = obj["Id"] @name = obj["Content"] end attr_reader :raw, :id, :name def to_s @name end def name=(new_name) @name = @raw["Content"] = new_name save new_name end def check @raw["Checked"] = true save end def save if @id @rest_if.update_item_by_id(@id, @raw) else set_obj @rest_if.create_item(@raw) end self end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
todoly-0.0.1 | lib/todoly/task.rb |