class Blather::MUC::Invite

<x xmlns='jabber.org/protocol/muc#user'>

<invite to='jid'>
  <reason>comment</reason>
</invite>

</x>

Public Class Methods

import(node) click to toggle source
# File lib/gxg/net_clients.rb, line 222
def self.import(node)
    self.new(node.element_name).inherit(node)
end
new(jid = nil, reason = nil, password = nil) click to toggle source
Calls superclass method
# File lib/gxg/net_clients.rb, line 234
def self.new(jid = nil, reason = nil, password = nil)
    invite = super :x
    invite.invite_to = jid
    invite.reason    = reason
    invite.password  = password
    invite
end

Public Instance Methods

inherit(node) click to toggle source
# File lib/gxg/net_clients.rb, line 226
def inherit(node)
    create_invite.remove
    self.from = node[:from]
    invite = node.find_first('ns:x/ns:invite', :ns => self.class.registered_ns)
    self << invite
    self
end
invite_from() click to toggle source
# File lib/gxg/net_clients.rb, line 250
def invite_from
create_invite[:from]
end
invite_to() click to toggle source
# File lib/gxg/net_clients.rb, line 246
def invite_to
    ::Blather::JID.new(create_invite[:to])
end
invite_to=(jid) click to toggle source
# File lib/gxg/net_clients.rb, line 242
def invite_to=(jid)
    create_invite[:to] = JID.new(jid)
end
password() click to toggle source
# File lib/gxg/net_clients.rb, line 268
def password
    create_password.content
end
password=(password) click to toggle source
# File lib/gxg/net_clients.rb, line 263
def password=(password)
    return if password.blank?
    create_password.content = password
end
reason() click to toggle source
# File lib/gxg/net_clients.rb, line 259
def reason
    create_reason.content
end
reason=(reason) click to toggle source
# File lib/gxg/net_clients.rb, line 254
def reason=(reason)
    return if reason.blank?
    create_reason.content = reason
end

Protected Instance Methods

create_invite() click to toggle source
# File lib/gxg/net_clients.rb, line 280
def create_invite
    unless create_invite = find_first('ns:invite', :ns => self.class.registered_ns)
    self << (create_invite = XMPPNode.new('invite', self.document))
    end
    create_invite
end
create_password() click to toggle source
# File lib/gxg/net_clients.rb, line 273
def create_password
    unless create_password = find_first('ns:password', :ns => self.class.registered_ns)
    self << (create_password = XMPPNode.new('password', self.document))
    end
    create_password
end
create_reason() click to toggle source
# File lib/gxg/net_clients.rb, line 287
def create_reason
    unless create_reason = create_invite.find_first('ns:reason', :ns => self.class.registered_ns)
    self.create_invite << (create_reason = XMPPNode.new('reason', self.document))
    end
    create_reason
end