Class: Trello::Item
Overview
An Item is a basic task that can be checked off and marked as completed.
Instance Attribute Summary collapse
Attributes inherited from BasicData
#client
Instance Method Summary
collapse
Methods inherited from BasicData
#==, client, create, find, #initialize, many, one, parse, parse_many, path_name, #refresh!, register_attributes, save
Methods included from JsonUtils
included
Instance Attribute Details
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[:card_id] = fields['idCard']
attributes[:checklist_id] = fields['idChecklist']
attributes[:name] = fields['name']
attributes[:type] = fields['type']
attributes[:state] = fields['state']
attributes[:pos] = fields['pos']
self
end
def complete?
state == "complete"
end
end
|
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[:card_id] = fields['idCard']
attributes[:checklist_id] = fields['idChecklist']
attributes[:name] = fields['name']
attributes[:type] = fields['type']
attributes[:state] = fields['state']
attributes[:pos] = fields['pos']
self
end
def complete?
state == "complete"
end
end
|
#pos ⇒ Object
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[:card_id] = fields['idCard']
attributes[:checklist_id] = fields['idChecklist']
attributes[:name] = fields['name']
attributes[:type] = fields['type']
attributes[:state] = fields['state']
attributes[:pos] = fields['pos']
self
end
def complete?
state == "complete"
end
end
|
#state ⇒ Object
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[:card_id] = fields['idCard']
attributes[:checklist_id] = fields['idChecklist']
attributes[:name] = fields['name']
attributes[:type] = fields['type']
attributes[:state] = fields['state']
attributes[:pos] = fields['pos']
self
end
def complete?
state == "complete"
end
end
|
#type ⇒ Object
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[:card_id] = fields['idCard']
attributes[:checklist_id] = fields['idChecklist']
attributes[:name] = fields['name']
attributes[:type] = fields['type']
attributes[:state] = fields['state']
attributes[:pos] = fields['pos']
self
end
def complete?
state == "complete"
end
end
|
Instance Method Details
#complete? ⇒ Boolean
33
34
35
|
# File 'lib/trello/item.rb', line 33
def complete?
state == "complete"
end
|
#update_fields(fields) ⇒ Object
Updates the fields of an item.
Supply a hash of string keyed data retrieved from the Trello API representing an item.
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/trello/item.rb', line 22
def update_fields(fields)
attributes[:id] = fields['id']
attributes[:card_id] = fields['idCard']
attributes[:checklist_id] = fields['idChecklist']
attributes[:name] = fields['name']
attributes[:type] = fields['type']
attributes[:state] = fields['state']
attributes[:pos] = fields['pos']
self
end
|