Class: Punchblock::Ref

Inherits:
RayoNode show all
Defined in:
lib/punchblock/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



22
23
24
25
26
27
28
29
30
31
# File 'lib/punchblock/ref.rb', line 22

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

#component_idObject



40
41
42
43
44
45
46
47
# File 'lib/punchblock/ref.rb', line 40

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

#domainObject



33
34
35
36
37
38
# File 'lib/punchblock/ref.rb', line 33

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

#rayo_attributesObject



49
50
51
52
53
# File 'lib/punchblock/ref.rb', line 49

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

#schemeObject



18
19
20
# File 'lib/punchblock/ref.rb', line 18

def scheme
  uri.scheme
end

#uriString

Returns the command URI

Returns:

  • (String)

    the command URI



13
# File 'lib/punchblock/ref.rb', line 13

attribute :uri

#uri=(other) ⇒ Object



14
15
16
# File 'lib/punchblock/ref.rb', line 14

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