Class: Lita::GoogleGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/lita/google_group.rb

Overview

A google email group

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, email:, name:, member_count:, description:) ⇒ GoogleGroup

Returns a new instance of GoogleGroup.



16
17
18
19
# File 'lib/lita/google_group.rb', line 16

def initialize(id:, email:, name:, member_count:, description:)
  @id, @email, @name, @description = id, email, name, description
  @member_count = member_count.to_i
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



4
5
6
# File 'lib/lita/google_group.rb', line 4

def description
  @description
end

#emailObject (readonly)

Returns the value of attribute email.



4
5
6
# File 'lib/lita/google_group.rb', line 4

def email
  @email
end

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/lita/google_group.rb', line 4

def id
  @id
end

#member_countObject (readonly)

Returns the value of attribute member_count.



4
5
6
# File 'lib/lita/google_group.rb', line 4

def member_count
  @member_count
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/lita/google_group.rb', line 4

def name
  @name
end

Class Method Details

.from_api(group) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/lita/google_group.rb', line 6

def self.from_api(group)
  GoogleGroup.new(
    id: group.id,
    email: group.email,
    name: group.name,
    description: group.description,
    member_count: group.direct_members_count,
  )
end

Instance Method Details

#==(other) ⇒ Object



21
22
23
# File 'lib/lita/google_group.rb', line 21

def ==(other)
  @id == other.id && @email == other.email
end

#to_sObject



25
26
27
# File 'lib/lita/google_group.rb', line 25

def to_s
  @email
end