Class: Trello::Organization

Inherits:
BasicData show all
Includes:
HasActions
Defined in:
lib/trello/organization.rb

Overview

Organizations are useful for linking members together.

Class Method Summary collapse

Instance Method Summary collapse

Methods included from HasActions

#actions

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

Find an organization by its id.



12
13
14
# File 'lib/trello/organization.rb', line 12

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

Instance Method Details

#boardsObject

Returns a list of boards under this organization.



31
32
33
34
# File 'lib/trello/organization.rb', line 31

def boards
  boards = Client.get("/organizations/#{id}/boards/all").json_into(Board)
  MultiAssociation.new(self, boards).proxy
end

#membersObject

Returns an array of members associated with the organization.



37
38
39
40
# File 'lib/trello/organization.rb', line 37

def members
  members = Client.get("/organizations/#{id}/members/all").json_into(Member)
  MultiAssociation.new(self, members).proxy
end

#request_prefixObject

:nodoc:



43
44
45
# File 'lib/trello/organization.rb', line 43

def request_prefix
  "/organizations/#{id}"
end

#update_fields(fields) ⇒ Object

Update the fields of an organization.

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



21
22
23
24
25
26
27
28
# File 'lib/trello/organization.rb', line 21

def update_fields(fields)
  attributes[:id]           = fields['id']
  attributes[:name]         = fields['name']
  attributes[:display_name] = fields['displayName']
  attributes[:description]  = fields['description']
  attributes[:url]          = fields['url']
  self
end