14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/trello/item.rb', line 14
class Item < BasicData
register_attributes :id, :name, :type, :state, :pos, readonly: [ :id, :name, :type, :state, :pos ]
validates_presence_of :id, :type
def update_fields(fields)
attributes[:id] = fields['id'] || attributes[:id]
attributes[:card_id] = fields['idCard'] || attributes[:card_id]
attributes[:checklist_id] = fields['idChecklist'] || attributes[:checklist_id]
attributes[:name] = fields['name'] || attributes[:name]
attributes[:type] = fields['type'] || attributes[:type]
attributes[:state] = fields['state'] || attributes[:state]
attributes[:pos] = fields['pos'] || attributes[:pos]
self
end
def complete?
state == "complete"
end
end
|