Class: Xrc::User

Inherits:
Object
  • Object
show all
Defined in:
lib/xrc/user.rb

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ User

Returns a new instance of User.

Examples:

Xrc::Client.new(jid: "[email protected]", mention_name: "alice", name: "Alice Liddel")

Parameters:

  • attributes (Hash)

    a customizable set of options

Options Hash (attributes):

  • :jid (String)

    JID

  • :mention_name (String)

    Mention name

  • :name (String)

    Full name



8
9
10
# File 'lib/xrc/user.rb', line 8

def initialize(attributes)
  @attributes = attributes
end

Instance Method Details

#jidXrc::Jid

Returns JID represented in a Xrc::Jid object.

Returns:

  • (Xrc::Jid)

    JID represented in a Xrc::Jid object



13
14
15
# File 'lib/xrc/user.rb', line 13

def jid
  @jid ||= Jid.new(@attributes[:jid])
end

#mention_nameString

Returns Mention name.

Returns:

  • (String)

    Mention name



18
19
20
# File 'lib/xrc/user.rb', line 18

def mention_name
  @attributes[:mention_name]
end

#nameString

Returns Full name.

Returns:

  • (String)

    Full name



23
24
25
# File 'lib/xrc/user.rb', line 23

def name
  @attributes[:name]
end