Class: Adhearsion::Rayo::Ref

Inherits:
RayoNode show all
Defined in:
lib/adhearsion/rayo/ref.rb

Overview

A rayo Ref message. This provides the command ID in response to execution of a command.

Instance Attribute Summary

Attributes inherited from RayoNode

#client, #connection, #original_component

Instance Method Summary collapse

Methods inherited from RayoNode

#==, class_from_registration, from_xml, #inherit, #inspect, #rayo_children, register, #source, #to_rayo, #to_xml

Instance Method Details

#call_idObject


23
24
25
26
27
28
29
30
31
32
# File 'lib/adhearsion/rayo/ref.rb', line 23

def call_id
  case scheme
  when 'xmpp'
    RubyJID.new(uri.opaque).node
  when nil
    uri.path
  else
    uri.opaque
  end
end

#component_idObject


41
42
43
44
45
46
47
48
# File 'lib/adhearsion/rayo/ref.rb', line 41

def component_id
  case scheme
  when 'xmpp'
    RubyJID.new(uri.opaque).resource
  else
    call_id
  end
end

#domainObject


34
35
36
37
38
39
# File 'lib/adhearsion/rayo/ref.rb', line 34

def domain
  case scheme
  when 'xmpp'
    RubyJID.new(uri.opaque).domain
  end
end

#rayo_attributesObject


50
51
52
53
54
# File 'lib/adhearsion/rayo/ref.rb', line 50

def rayo_attributes
  {}.tap do |atts|
    atts[:uri] = uri if uri
  end
end

#schemeObject


19
20
21
# File 'lib/adhearsion/rayo/ref.rb', line 19

def scheme
  uri.scheme
end

#uriString

Returns the command URI

Returns:

  • (String)

    the command URI


14
# File 'lib/adhearsion/rayo/ref.rb', line 14

attribute :uri

#uri=(other) ⇒ Object


15
16
17
# File 'lib/adhearsion/rayo/ref.rb', line 15

def uri=(other)
  super URI(other)
end