Class: Trello::Organization
- Includes:
- HasActions
- Defined in:
- lib/trello/organization.rb
Overview
Organizations are useful for linking members together.
Instance Attribute Summary collapse
- #description ⇒ String readonly
- #display_name ⇒ String readonly
- #id ⇒ String readonly
- #name ⇒ String readonly
- #url ⇒ String readonly
Attributes inherited from BasicData
Class Method Summary collapse
-
.find(id, params = {}) ⇒ Object
Find an organization by its id.
Instance Method Summary collapse
-
#boards ⇒ Object
Returns a list of boards under this organization.
-
#members(params = {}) ⇒ Object
Returns an array of members associated with the organization.
-
#request_prefix ⇒ Object
:nodoc:.
-
#update_fields(fields) ⇒ Object
Update the fields of an organization.
Methods included from HasActions
Methods inherited from BasicData
#==, client, create, #initialize, many, one, parse, parse_many, path_name, #refresh!, register_attributes, save
Methods included from JsonUtils
Constructor Details
This class inherits a constructor from Trello::BasicData
Instance Attribute Details
#description ⇒ String (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[:id] attributes[:name] = fields['name'] || attributes[:name] attributes[:display_name] = fields['displayName'] || attributes[:display_name] attributes[:description] = fields['desc'] || attributes[:description] attributes[:url] = fields['url'] || attributes[:url] attributes[:invited] = fields['invited'] if fields.has_key?('invited') attributes[:website] = fields['website'] || attributes[:website] attributes[:logo_hash] = fields['logoHash'] || attributes[:logo_hash] attributes[:billable_member_count] = fields['billableMemberCount'] || attributes[:billable_member_count] attributes[:active_billable_member_count] = fields['activeBillableMemberCount'] || attributes[:active_billable_member_count] attributes[:memberships] = fields['memberships'] || attributes[: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_name ⇒ String (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[:id] attributes[:name] = fields['name'] || attributes[:name] attributes[:display_name] = fields['displayName'] || attributes[:display_name] attributes[:description] = fields['desc'] || attributes[:description] attributes[:url] = fields['url'] || attributes[:url] attributes[:invited] = fields['invited'] if fields.has_key?('invited') attributes[:website] = fields['website'] || attributes[:website] attributes[:logo_hash] = fields['logoHash'] || attributes[:logo_hash] attributes[:billable_member_count] = fields['billableMemberCount'] || attributes[:billable_member_count] attributes[:active_billable_member_count] = fields['activeBillableMemberCount'] || attributes[:active_billable_member_count] attributes[:memberships] = fields['memberships'] || attributes[: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 |
#id ⇒ String (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[:id] attributes[:name] = fields['name'] || attributes[:name] attributes[:display_name] = fields['displayName'] || attributes[:display_name] attributes[:description] = fields['desc'] || attributes[:description] attributes[:url] = fields['url'] || attributes[:url] attributes[:invited] = fields['invited'] if fields.has_key?('invited') attributes[:website] = fields['website'] || attributes[:website] attributes[:logo_hash] = fields['logoHash'] || attributes[:logo_hash] attributes[:billable_member_count] = fields['billableMemberCount'] || attributes[:billable_member_count] attributes[:active_billable_member_count] = fields['activeBillableMemberCount'] || attributes[:active_billable_member_count] attributes[:memberships] = fields['memberships'] || attributes[: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 |
#name ⇒ String (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[:id] attributes[:name] = fields['name'] || attributes[:name] attributes[:display_name] = fields['displayName'] || attributes[:display_name] attributes[:description] = fields['desc'] || attributes[:description] attributes[:url] = fields['url'] || attributes[:url] attributes[:invited] = fields['invited'] if fields.has_key?('invited') attributes[:website] = fields['website'] || attributes[:website] attributes[:logo_hash] = fields['logoHash'] || attributes[:logo_hash] attributes[:billable_member_count] = fields['billableMemberCount'] || attributes[:billable_member_count] attributes[:active_billable_member_count] = fields['activeBillableMemberCount'] || attributes[:active_billable_member_count] attributes[:memberships] = fields['memberships'] || attributes[: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 |
#url ⇒ String (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[:id] attributes[:name] = fields['name'] || attributes[:name] attributes[:display_name] = fields['displayName'] || attributes[:display_name] attributes[:description] = fields['desc'] || attributes[:description] attributes[:url] = fields['url'] || attributes[:url] attributes[:invited] = fields['invited'] if fields.has_key?('invited') attributes[:website] = fields['website'] || attributes[:website] attributes[:logo_hash] = fields['logoHash'] || attributes[:logo_hash] attributes[:billable_member_count] = fields['billableMemberCount'] || attributes[:billable_member_count] attributes[:active_billable_member_count] = fields['activeBillableMemberCount'] || attributes[:active_billable_member_count] attributes[:memberships] = fields['memberships'] || attributes[: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
#boards ⇒ Object
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_prefix ⇒ Object
: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[:id] attributes[:name] = fields['name'] || attributes[:name] attributes[:display_name] = fields['displayName'] || attributes[:display_name] attributes[:description] = fields['desc'] || attributes[:description] attributes[:url] = fields['url'] || attributes[:url] attributes[:invited] = fields['invited'] if fields.has_key?('invited') attributes[:website] = fields['website'] || attributes[:website] attributes[:logo_hash] = fields['logoHash'] || attributes[:logo_hash] attributes[:billable_member_count] = fields['billableMemberCount'] || attributes[:billable_member_count] attributes[:active_billable_member_count] = fields['activeBillableMemberCount'] || attributes[:active_billable_member_count] attributes[:memberships] = fields['memberships'] || attributes[:memberships] self end |