Class: Trello::CheckItemState

Inherits:
BasicData show all
Defined in:
lib/trello/item_state.rb

Overview

Represents the state of an item.

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

Constructor Details

This class inherits a constructor from Trello::BasicData

Instance Attribute Details

#idString (readonly)

Returns:



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_idString (readonly)

Returns:



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

#stateObject (readonly)

Returns:

  • (Object)


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

#itemObject

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