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.

Instance Attribute Summary

Attributes inherited from BasicData

#client

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BasicData

#==, client, create, #initialize, many, one, parse, parse_many, path_name, #refresh!, register_attributes, save

Constructor Details

This class inherits a constructor from Trello::BasicData

Class Method Details

.find(id, params = {}) ⇒ Object

Locate a specific action and return a new Action object.



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

def find(id, params = {})
  client.find(:action, id, params)
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