Class: Rubirai::Group

Inherits:
Object
  • Object
show all
Defined in:
lib/rubirai/objects/group.rb

Overview

The group

Defined Under Namespace

Classes: Permission

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash, bot = nil) ⇒ Group

Returns a new instance of Group.

Parameters:

  • hash (Hash{String => Object})
  • bot (Rubirai::Bot, nil) (defaults to: nil)


19
20
21
22
23
24
25
# File 'lib/rubirai/objects/group.rb', line 19

def initialize(hash, bot = nil)
  hash = hash.stringify_keys
  @bot = bot
  @id = hash['id']
  @name = hash['name']
  @permission = hash['permission']
end

Instance Attribute Details

#botBot (readonly)

Returns the bot.

Returns:

  • (Bot)

    the bot



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
# File 'lib/rubirai/objects/group.rb', line 14

class Group
  attr_reader :bot, :id, :name, :permission

  # @param hash [Hash{String => Object}]
  # @param bot [Rubirai::Bot, nil]
  def initialize(hash, bot = nil)
    hash = hash.stringify_keys
    @bot = bot
    @id = hash['id']
    @name = hash['name']
    @permission = hash['permission']
  end

  # Group permissions
  class Permission
    # Owner
    OWNER = 'OWNER'

    # Administrator
    ADMINISTRATOR = 'ADMINISTRATOR'

    # Member
    MEMBER = 'MEMBER'
  end
end

#idInteger (readonly)

Returns group id.

Returns:

  • (Integer)

    group id



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
# File 'lib/rubirai/objects/group.rb', line 14

class Group
  attr_reader :bot, :id, :name, :permission

  # @param hash [Hash{String => Object}]
  # @param bot [Rubirai::Bot, nil]
  def initialize(hash, bot = nil)
    hash = hash.stringify_keys
    @bot = bot
    @id = hash['id']
    @name = hash['name']
    @permission = hash['permission']
  end

  # Group permissions
  class Permission
    # Owner
    OWNER = 'OWNER'

    # Administrator
    ADMINISTRATOR = 'ADMINISTRATOR'

    # Member
    MEMBER = 'MEMBER'
  end
end

#nameString (readonly)

Returns group name.

Returns:

  • (String)

    group name



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
# File 'lib/rubirai/objects/group.rb', line 14

class Group
  attr_reader :bot, :id, :name, :permission

  # @param hash [Hash{String => Object}]
  # @param bot [Rubirai::Bot, nil]
  def initialize(hash, bot = nil)
    hash = hash.stringify_keys
    @bot = bot
    @id = hash['id']
    @name = hash['name']
    @permission = hash['permission']
  end

  # Group permissions
  class Permission
    # Owner
    OWNER = 'OWNER'

    # Administrator
    ADMINISTRATOR = 'ADMINISTRATOR'

    # Member
    MEMBER = 'MEMBER'
  end
end

#permissionString (readonly)

Returns the group permission of the bot. See Permission.

Returns:

  • (String)

    the group permission of the bot. See Permission



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
# File 'lib/rubirai/objects/group.rb', line 14

class Group
  attr_reader :bot, :id, :name, :permission

  # @param hash [Hash{String => Object}]
  # @param bot [Rubirai::Bot, nil]
  def initialize(hash, bot = nil)
    hash = hash.stringify_keys
    @bot = bot
    @id = hash['id']
    @name = hash['name']
    @permission = hash['permission']
  end

  # Group permissions
  class Permission
    # Owner
    OWNER = 'OWNER'

    # Administrator
    ADMINISTRATOR = 'ADMINISTRATOR'

    # Member
    MEMBER = 'MEMBER'
  end
end