Class: Telegem::Types::Chat

Inherits:
BaseType show all
Defined in:
lib/api/types.rb

Instance Attribute Summary collapse

Attributes inherited from BaseType

#_raw_data

Instance Method Summary collapse

Methods inherited from BaseType

#method_missing, #respond_to_missing?

Constructor Details

#initialize(data) ⇒ Chat

Returns a new instance of Chat.



62
63
64
65
66
67
68
69
# File 'lib/api/types.rb', line 62

def initialize(data)
  super(data)
  
  @id = data['id']
  @type = data['type']
  @username = data['username']
  @title = data['title']
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Telegem::Types::BaseType

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



60
61
62
# File 'lib/api/types.rb', line 60

def id
  @id
end

#titleObject (readonly)

Returns the value of attribute title.



60
61
62
# File 'lib/api/types.rb', line 60

def title
  @title
end

#typeObject (readonly)

Returns the value of attribute type.



60
61
62
# File 'lib/api/types.rb', line 60

def type
  @type
end

#usernameObject (readonly)

Returns the value of attribute username.



60
61
62
# File 'lib/api/types.rb', line 60

def username
  @username
end

Instance Method Details

#channel?Boolean

Returns:

  • (Boolean)


83
84
85
# File 'lib/api/types.rb', line 83

def channel?
  type == 'channel'
end

#group?Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/api/types.rb', line 75

def group?
  type == 'group'
end

#private?Boolean

Returns:

  • (Boolean)


71
72
73
# File 'lib/api/types.rb', line 71

def private?
  type == 'private'
end

#supergroup?Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/api/types.rb', line 79

def supergroup?
  type == 'supergroup'
end