Class: Trello::Organization

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

Overview

Organizations are useful for linking members together.

Instance Attribute Summary collapse

Attributes inherited from BasicData

#client

Class Method Summary collapse

Instance Method Summary collapse

Methods included from HasActions

#actions

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

Instance Attribute Details

#descriptionString (readonly)

Returns:



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/trello/organization.rb', line 14

class Organization < BasicData
  register_attributes :id, :name, :display_name, :description, :url,
    readonly: [ :id, :name, :display_name, :description, :url ]
  validates_presence_of :id, :name

  include HasActions

  class << self
    # Find an organization by its id.
    def find(id, params = {})
      client.find(:organization, id, params)
    end
  end

  # Update the fields of an organization.
  #
  # Supply a hash of string keyed data retrieved from the Trello API representing
  # an Organization.
  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

  # Returns a list of boards under this organization.
  def boards
    boards = client.get("/organizations/#{id}/boards/all").json_into(Board)
    MultiAssociation.new(self, boards).proxy
  end

  # Returns an array of members associated with the organization.
  def members(params = {})
    members = client.get("/organizations/#{id}/members/all", params).json_into(Member)
    MultiAssociation.new(self, members).proxy
  end

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

#display_nameString (readonly)

Returns:



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/trello/organization.rb', line 14

class Organization < BasicData
  register_attributes :id, :name, :display_name, :description, :url,
    readonly: [ :id, :name, :display_name, :description, :url ]
  validates_presence_of :id, :name

  include HasActions

  class << self
    # Find an organization by its id.
    def find(id, params = {})
      client.find(:organization, id, params)
    end
  end

  # Update the fields of an organization.
  #
  # Supply a hash of string keyed data retrieved from the Trello API representing
  # an Organization.
  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

  # Returns a list of boards under this organization.
  def boards
    boards = client.get("/organizations/#{id}/boards/all").json_into(Board)
    MultiAssociation.new(self, boards).proxy
  end

  # Returns an array of members associated with the organization.
  def members(params = {})
    members = client.get("/organizations/#{id}/members/all", params).json_into(Member)
    MultiAssociation.new(self, members).proxy
  end

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

#idString (readonly)

Returns:



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/trello/organization.rb', line 14

class Organization < BasicData
  register_attributes :id, :name, :display_name, :description, :url,
    readonly: [ :id, :name, :display_name, :description, :url ]
  validates_presence_of :id, :name

  include HasActions

  class << self
    # Find an organization by its id.
    def find(id, params = {})
      client.find(:organization, id, params)
    end
  end

  # Update the fields of an organization.
  #
  # Supply a hash of string keyed data retrieved from the Trello API representing
  # an Organization.
  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

  # Returns a list of boards under this organization.
  def boards
    boards = client.get("/organizations/#{id}/boards/all").json_into(Board)
    MultiAssociation.new(self, boards).proxy
  end

  # Returns an array of members associated with the organization.
  def members(params = {})
    members = client.get("/organizations/#{id}/members/all", params).json_into(Member)
    MultiAssociation.new(self, members).proxy
  end

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

#nameString (readonly)

Returns:



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/trello/organization.rb', line 14

class Organization < BasicData
  register_attributes :id, :name, :display_name, :description, :url,
    readonly: [ :id, :name, :display_name, :description, :url ]
  validates_presence_of :id, :name

  include HasActions

  class << self
    # Find an organization by its id.
    def find(id, params = {})
      client.find(:organization, id, params)
    end
  end

  # Update the fields of an organization.
  #
  # Supply a hash of string keyed data retrieved from the Trello API representing
  # an Organization.
  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

  # Returns a list of boards under this organization.
  def boards
    boards = client.get("/organizations/#{id}/boards/all").json_into(Board)
    MultiAssociation.new(self, boards).proxy
  end

  # Returns an array of members associated with the organization.
  def members(params = {})
    members = client.get("/organizations/#{id}/members/all", params).json_into(Member)
    MultiAssociation.new(self, members).proxy
  end

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

#urlString (readonly)

Returns:



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/trello/organization.rb', line 14

class Organization < BasicData
  register_attributes :id, :name, :display_name, :description, :url,
    readonly: [ :id, :name, :display_name, :description, :url ]
  validates_presence_of :id, :name

  include HasActions

  class << self
    # Find an organization by its id.
    def find(id, params = {})
      client.find(:organization, id, params)
    end
  end

  # Update the fields of an organization.
  #
  # Supply a hash of string keyed data retrieved from the Trello API representing
  # an Organization.
  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

  # Returns a list of boards under this organization.
  def boards
    boards = client.get("/organizations/#{id}/boards/all").json_into(Board)
    MultiAssociation.new(self, boards).proxy
  end

  # Returns an array of members associated with the organization.
  def members(params = {})
    members = client.get("/organizations/#{id}/members/all", params).json_into(Member)
    MultiAssociation.new(self, members).proxy
  end

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

Class Method Details

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

Find an organization by its id.



23
24
25
# File 'lib/trello/organization.rb', line 23

def find(id, params = {})
  client.find(:organization, id, params)
end

Instance Method Details

#boardsObject

Returns a list of boards under this organization.



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

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

#members(params = {}) ⇒ Object

Returns an array of members associated with the organization.



48
49
50
51
# File 'lib/trello/organization.rb', line 48

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

#request_prefixObject

:nodoc:



54
55
56
# File 'lib/trello/organization.rb', line 54

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.



32
33
34
35
36
37
38
39
# File 'lib/trello/organization.rb', line 32

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