Class: Trello::Action

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

Overview

Action represents some event that occurred. For instance, when a card is created.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BasicData

#==, #initialize, many, one, #refresh!, register_attributes

Constructor Details

This class inherits a constructor from Trello::BasicData

Class Method Details

.find(id) ⇒ Object

Locate a specific action and return a new Action object.



10
11
12
# File 'lib/trello/action.rb', line 10

def find(id)
  super(:actions, id)
end

Instance Method Details

#boardObject

Returns the board this action occurred on.



29
30
31
# File 'lib/trello/action.rb', line 29

def board
  Client.get("/actions/#{id}/board").json_into(Board)
end

#cardObject

Returns the card the action occurred on.



34
35
36
# File 'lib/trello/action.rb', line 34

def card
  Client.get("/actions/#{id}/card").json_into(Card)
end

#listObject

Returns the list the action occurred on.



39
40
41
# File 'lib/trello/action.rb', line 39

def list
  Client.get("/actions/#{id}/list").json_into(List)
end

#update_fields(fields) ⇒ Object

Update the attributes of an action

Supply a hash of string keyed data retrieved from the Trello API representing an Action.



19
20
21
22
23
24
25
26
# File 'lib/trello/action.rb', line 19

def update_fields(fields)
  attributes[:id]                = fields['id']
  attributes[:type]              = fields['type']
  attributes[:data]              = fields['data']
  attributes[:date]              = Time.iso8601(fields['date'])
  attributes[:member_creator_id] = fields['idMemberCreator']
  self
end