Class: Trello::CheckItemState
- Defined in:
- lib/trello/item_state.rb
Overview
Represents the state of an item.
Instance Attribute Summary collapse
- #id ⇒ String readonly
- #item_id ⇒ String readonly
- #state ⇒ Object readonly
Attributes inherited from BasicData
Instance Method Summary collapse
-
#item ⇒ Object
Return the item this state belongs to.
-
#update_fields(fields) ⇒ Object
Update the fields of an item state.
Methods inherited from BasicData
#==, client, create, find, #initialize, many, one, parse, parse_many, path_name, #refresh!, register_attributes, save
Methods included from JsonUtils
Constructor Details
This class inherits a constructor from Trello::BasicData
Instance Attribute Details
#id ⇒ String (readonly)
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/trello/item_state.rb', line 10 class CheckItemState < BasicData register_attributes :id, :state, :item_id, readonly: [ :id, :state, :item_id ] validates_presence_of :id, :item_id # Update the fields of an item state. # # Supply a hash of string keyed data retrieved from the Trello API representing # an item state. def update_fields(fields) attributes[:id] = fields['id'] attributes[:state] = fields['state'] attributes[:item_id] = fields['idCheckItem'] self end # Return the item this state belongs to. def item Item.find(item_id) end end |
#item_id ⇒ String (readonly)
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/trello/item_state.rb', line 10 class CheckItemState < BasicData register_attributes :id, :state, :item_id, readonly: [ :id, :state, :item_id ] validates_presence_of :id, :item_id # Update the fields of an item state. # # Supply a hash of string keyed data retrieved from the Trello API representing # an item state. def update_fields(fields) attributes[:id] = fields['id'] attributes[:state] = fields['state'] attributes[:item_id] = fields['idCheckItem'] self end # Return the item this state belongs to. def item Item.find(item_id) end end |
#state ⇒ Object (readonly)
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/trello/item_state.rb', line 10 class CheckItemState < BasicData register_attributes :id, :state, :item_id, readonly: [ :id, :state, :item_id ] validates_presence_of :id, :item_id # Update the fields of an item state. # # Supply a hash of string keyed data retrieved from the Trello API representing # an item state. def update_fields(fields) attributes[:id] = fields['id'] attributes[:state] = fields['state'] attributes[:item_id] = fields['idCheckItem'] self end # Return the item this state belongs to. def item Item.find(item_id) end end |
Instance Method Details
#item ⇒ Object
Return the item this state belongs to.
26 27 28 |
# File 'lib/trello/item_state.rb', line 26 def item Item.find(item_id) end |
#update_fields(fields) ⇒ Object
Update the fields of an item state.
Supply a hash of string keyed data retrieved from the Trello API representing an item state.
18 19 20 21 22 23 |
# File 'lib/trello/item_state.rb', line 18 def update_fields(fields) attributes[:id] = fields['id'] attributes[:state] = fields['state'] attributes[:item_id] = fields['idCheckItem'] self end |