class Blather::Stanza::Iq::Si::Si

Si stanza fragment

Public Class Methods

find_or_create(parent) click to toggle source

Find or create si node in Si Iq and converts it to Si::Si

@param [Si] parent a Si Iq where to find or create si

@return [Si::Si]

# File lib/blather/stanza/iq/si.rb, line 103
def self.find_or_create(parent)
  if found_si = parent.find_first('//ns:si', :ns => NS_SI)
    si = self.new found_si
    found_si.remove
  else
    si = self.new
  end
  parent << si

  si
end
new(node = nil) click to toggle source

Create a new Si::Si object

@param [XML::Node, nil] node a node to inherit from

@return [Si::Si]

Calls superclass method
# File lib/blather/stanza/iq/si.rb, line 91
def self.new(node = nil)
  new_node = super :si
  new_node.namespace = NS_SI
  new_node.inherit node if node
  new_node
end

Public Instance Methods

feature() click to toggle source

Find or create feature node

@return [Si::Si::Feature]

# File lib/blather/stanza/iq/si.rb, line 167
def feature
  Feature.find_or_create self
end
file() click to toggle source

Find or create file node

@return [Si::Si::File]

# File lib/blather/stanza/iq/si.rb, line 160
def file
  File.find_or_create self
end
id() click to toggle source

Get the id of the stream

@return [String, nil]

# File lib/blather/stanza/iq/si.rb, line 118
def id
  read_attr :id
end
id=(id) click to toggle source

Set the id

@param [String, nil] id the id of the stream

# File lib/blather/stanza/iq/si.rb, line 125
def id=(id)
  write_attr :id, id
end
mime_type() click to toggle source

Get the MIME type of the stream

@return [String, nil]

# File lib/blather/stanza/iq/si.rb, line 132
def mime_type
  read_attr 'mime-type'
end
mime_type=(type) click to toggle source

Set the MIME type

@param [String, nil] type the MIME type of the stream

# File lib/blather/stanza/iq/si.rb, line 139
def mime_type=(type)
  write_attr 'mime-type', type
end
profile() click to toggle source

Get the profile of the stream

@return [String, nil]

# File lib/blather/stanza/iq/si.rb, line 146
def profile
  read_attr :profile
end
profile=(profile) click to toggle source

Set the profile

@param [String, nil] profile the profile of the stream

# File lib/blather/stanza/iq/si.rb, line 153
def profile=(profile)
  write_attr :profile, profile
end