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

Methods included from JsonUtils

included

Constructor Details

This class inherits a constructor from Trello::BasicData

Instance Attribute Details

#descriptionString (readonly)



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
58
59
60
61
62
63
64
65
66
67
# File 'lib/trello/organization.rb', line 14

class Organization < BasicData
  register_attributes :id, :name, :display_name, :description, :url, :invited,
    :website, :logo_hash, :billable_member_count, :active_billable_member_count,
    :memberships,
    readonly: [ :id, :name, :display_name, :description, :url, :invited,
      :website, :logo_hash, :billable_member_count, :active_billable_member_count,
      :memberships ]
  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['desc']
    attributes[:url]                          = fields['url']
    attributes[:invited]                      = fields['invited']
    attributes[:website]                      = fields['website']
    attributes[:logo_hash]                    = fields['logoHash']
    attributes[:billable_member_count]        = fields['billableMemberCount']
    attributes[:active_billable_member_count] = fields['activeBillableMemberCount']
    attributes[:memberships]                  = fields['memberships']
    self
  end

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

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

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

#display_nameString (readonly)



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
58
59
60
61
62
63
64
65
66
67
# File 'lib/trello/organization.rb', line 14

class Organization < BasicData
  register_attributes :id, :name, :display_name, :description, :url, :invited,
    :website, :logo_hash, :billable_member_count, :active_billable_member_count,
    :memberships,
    readonly: [ :id, :name, :display_name, :description, :url, :invited,
      :website, :logo_hash, :billable_member_count, :active_billable_member_count,
      :memberships ]
  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['desc']
    attributes[:url]                          = fields['url']
    attributes[:invited]                      = fields['invited']
    attributes[:website]                      = fields['website']
    attributes[:logo_hash]                    = fields['logoHash']
    attributes[:billable_member_count]        = fields['billableMemberCount']
    attributes[:active_billable_member_count] = fields['activeBillableMemberCount']
    attributes[:memberships]                  = fields['memberships']
    self
  end

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

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

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

#idString (readonly)



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
58
59
60
61
62
63
64
65
66
67
# File 'lib/trello/organization.rb', line 14

class Organization < BasicData
  register_attributes :id, :name, :display_name, :description, :url, :invited,
    :website, :logo_hash, :billable_member_count, :active_billable_member_count,
    :memberships,
    readonly: [ :id, :name, :display_name, :description, :url, :invited,
      :website, :logo_hash, :billable_member_count, :active_billable_member_count,
      :memberships ]
  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['desc']
    attributes[:url]                          = fields['url']
    attributes[:invited]                      = fields['invited']
    attributes[:website]                      = fields['website']
    attributes[:logo_hash]                    = fields['logoHash']
    attributes[:billable_member_count]        = fields['billableMemberCount']
    attributes[:active_billable_member_count] = fields['activeBillableMemberCount']
    attributes[:memberships]                  = fields['memberships']
    self
  end

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

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

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

#nameString (readonly)



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
58
59
60
61
62
63
64
65
66
67
# File 'lib/trello/organization.rb', line 14

class Organization < BasicData
  register_attributes :id, :name, :display_name, :description, :url, :invited,
    :website, :logo_hash, :billable_member_count, :active_billable_member_count,
    :memberships,
    readonly: [ :id, :name, :display_name, :description, :url, :invited,
      :website, :logo_hash, :billable_member_count, :active_billable_member_count,
      :memberships ]
  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['desc']
    attributes[:url]                          = fields['url']
    attributes[:invited]                      = fields['invited']
    attributes[:website]                      = fields['website']
    attributes[:logo_hash]                    = fields['logoHash']
    attributes[:billable_member_count]        = fields['billableMemberCount']
    attributes[:active_billable_member_count] = fields['activeBillableMemberCount']
    attributes[:memberships]                  = fields['memberships']
    self
  end

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

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

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

#urlString (readonly)



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
58
59
60
61
62
63
64
65
66
67
# File 'lib/trello/organization.rb', line 14

class Organization < BasicData
  register_attributes :id, :name, :display_name, :description, :url, :invited,
    :website, :logo_hash, :billable_member_count, :active_billable_member_count,
    :memberships,
    readonly: [ :id, :name, :display_name, :description, :url, :invited,
      :website, :logo_hash, :billable_member_count, :active_billable_member_count,
      :memberships ]
  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['desc']
    attributes[:url]                          = fields['url']
    attributes[:invited]                      = fields['invited']
    attributes[:website]                      = fields['website']
    attributes[:logo_hash]                    = fields['logoHash']
    attributes[:billable_member_count]        = fields['billableMemberCount']
    attributes[:active_billable_member_count] = fields['activeBillableMemberCount']
    attributes[:memberships]                  = fields['memberships']
    self
  end

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

  # Returns an array of members associated with the organization.
  def members(params = {})
    members = Member.from_response client.get("/organizations/#{id}/members/all", params)
    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.



27
28
29
# File 'lib/trello/organization.rb', line 27

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

Instance Method Details

#boardsObject

Returns a list of boards under this organization.



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

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

#members(params = {}) ⇒ Object

Returns an array of members associated with the organization.



58
59
60
61
# File 'lib/trello/organization.rb', line 58

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

#request_prefixObject

:nodoc:



64
65
66
# File 'lib/trello/organization.rb', line 64

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.



36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/trello/organization.rb', line 36

def update_fields(fields)
  attributes[:id]                           = fields['id']
  attributes[:name]                         = fields['name']
  attributes[:display_name]                 = fields['displayName']
  attributes[:description]                  = fields['desc']
  attributes[:url]                          = fields['url']
  attributes[:invited]                      = fields['invited']
  attributes[:website]                      = fields['website']
  attributes[:logo_hash]                    = fields['logoHash']
  attributes[:billable_member_count]        = fields['billableMemberCount']
  attributes[:active_billable_member_count] = fields['activeBillableMemberCount']
  attributes[:memberships]                  = fields['memberships']
  self
end