Class: Teems::Models::Channel
- Inherits:
-
Data
- Object
- Data
- Teems::Models::Channel
- Defined in:
- lib/teems/models/channel.rb
Overview
Represents a Teams channel within a team
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#membership_type ⇒ Object
readonly
Returns the value of attribute membership_type.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#team_id ⇒ Object
readonly
Returns the value of attribute team_id.
-
#team_name ⇒ Object
readonly
Returns the value of attribute team_name.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description
6 7 8 |
# File 'lib/teems/models/channel.rb', line 6 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id
6 7 8 |
# File 'lib/teems/models/channel.rb', line 6 def id @id end |
#membership_type ⇒ Object (readonly)
Returns the value of attribute membership_type
6 7 8 |
# File 'lib/teems/models/channel.rb', line 6 def membership_type @membership_type end |
#name ⇒ Object (readonly)
Returns the value of attribute name
6 7 8 |
# File 'lib/teems/models/channel.rb', line 6 def name @name end |
#team_id ⇒ Object (readonly)
Returns the value of attribute team_id
6 7 8 |
# File 'lib/teems/models/channel.rb', line 6 def team_id @team_id end |
#team_name ⇒ Object (readonly)
Returns the value of attribute team_name
6 7 8 |
# File 'lib/teems/models/channel.rb', line 6 def team_name @team_name end |
Class Method Details
.from_api(data, team_id: nil, team_name: nil) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/teems/models/channel.rb', line 7 def self.from_api(data, team_id: nil, team_name: nil) new( id: data['id'], name: data['displayName'], team_id: team_id, team_name: team_name, description: data['description'], membership_type: data['membershipType'] ) end |
Instance Method Details
#display_name ⇒ Object
18 19 20 |
# File 'lib/teems/models/channel.rb', line 18 def display_name team_name ? "#{team_name} / #{name}" : name end |
#private? ⇒ Boolean
22 23 24 |
# File 'lib/teems/models/channel.rb', line 22 def private? membership_type == 'private' end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/teems/models/channel.rb', line 26 def to_s "##{name}" end |