Class: Telegem::Types::User
Instance Attribute Summary collapse
-
#can_join_groups ⇒ Object
readonly
Returns the value of attribute can_join_groups.
-
#can_read_all_group_messages ⇒ Object
readonly
Returns the value of attribute can_read_all_group_messages.
-
#first_name ⇒ Object
readonly
Returns the value of attribute first_name.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#is_bot ⇒ Object
readonly
Returns the value of attribute is_bot.
-
#last_name ⇒ Object
readonly
Returns the value of attribute last_name.
-
#supports_inline_queries ⇒ Object
readonly
Returns the value of attribute supports_inline_queries.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Attributes inherited from BaseType
Instance Method Summary collapse
- #full_name ⇒ Object
-
#initialize(data) ⇒ User
constructor
A new instance of User.
- #mention ⇒ Object
Methods inherited from BaseType
#method_missing, #respond_to_missing?
Constructor Details
#initialize(data) ⇒ User
Returns a new instance of User.
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/api/types.rb', line 37 def initialize(data) super(data) @id = data['id'] @is_bot = data['is_bot'] @first_name = data['first_name'] @last_name = data['last_name'] @username = data['username'] @can_join_groups = data['can_join_groups'] = data['can_read_all_group_messages'] @supports_inline_queries = data['supports_inline_queries'] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Telegem::Types::BaseType
Instance Attribute Details
#can_join_groups ⇒ Object (readonly)
Returns the value of attribute can_join_groups.
34 35 36 |
# File 'lib/api/types.rb', line 34 def can_join_groups @can_join_groups end |
#can_read_all_group_messages ⇒ Object (readonly)
Returns the value of attribute can_read_all_group_messages.
34 35 36 |
# File 'lib/api/types.rb', line 34 def end |
#first_name ⇒ Object (readonly)
Returns the value of attribute first_name.
34 35 36 |
# File 'lib/api/types.rb', line 34 def first_name @first_name end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
34 35 36 |
# File 'lib/api/types.rb', line 34 def id @id end |
#is_bot ⇒ Object (readonly)
Returns the value of attribute is_bot.
34 35 36 |
# File 'lib/api/types.rb', line 34 def is_bot @is_bot end |
#last_name ⇒ Object (readonly)
Returns the value of attribute last_name.
34 35 36 |
# File 'lib/api/types.rb', line 34 def last_name @last_name end |
#supports_inline_queries ⇒ Object (readonly)
Returns the value of attribute supports_inline_queries.
34 35 36 |
# File 'lib/api/types.rb', line 34 def supports_inline_queries @supports_inline_queries end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
34 35 36 |
# File 'lib/api/types.rb', line 34 def username @username end |
Instance Method Details
#full_name ⇒ Object
50 51 52 |
# File 'lib/api/types.rb', line 50 def full_name [first_name, last_name].compact.join(' ') end |
#mention ⇒ Object
54 55 56 |
# File 'lib/api/types.rb', line 54 def mention username ? "@#{username}" : first_name end |