Class: Teems::Models::Channel

Inherits:
Data
  • Object
show all
Defined in:
lib/teems/models/channel.rb

Overview

Represents a Teams channel within a team

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description

Returns:

  • (Object)

    the current value of description



6
7
8
# File 'lib/teems/models/channel.rb', line 6

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



6
7
8
# File 'lib/teems/models/channel.rb', line 6

def id
  @id
end

#membership_typeObject (readonly)

Returns the value of attribute membership_type

Returns:

  • (Object)

    the current value of membership_type



6
7
8
# File 'lib/teems/models/channel.rb', line 6

def membership_type
  @membership_type
end

#nameObject (readonly)

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



6
7
8
# File 'lib/teems/models/channel.rb', line 6

def name
  @name
end

#team_idObject (readonly)

Returns the value of attribute team_id

Returns:

  • (Object)

    the current value of team_id



6
7
8
# File 'lib/teems/models/channel.rb', line 6

def team_id
  @team_id
end

#team_nameObject (readonly)

Returns the value of attribute team_name

Returns:

  • (Object)

    the current value of 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_nameObject



18
19
20
# File 'lib/teems/models/channel.rb', line 18

def display_name
  team_name ? "#{team_name} / #{name}" : name
end

#private?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/teems/models/channel.rb', line 22

def private?
  membership_type == 'private'
end

#to_sObject



26
27
28
# File 'lib/teems/models/channel.rb', line 26

def to_s
  "##{name}"
end