Class: ConferenceCallService::ParticipantDetails

Inherits:
Object
  • Object
show all
Defined in:
lib/conference_call_service/participant_details.rb

Constant Summary collapse

@@IS_INITIATOR =
1
@@IS_NOT_INITIATOR =
0

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(firstname, lastname, number, email, flags = @@IS_NOT_INITIATOR) ⇒ ParticipantDetails

Constructor



9
10
11
12
13
14
15
# File 'lib/conference_call_service/participant_details.rb', line 9

def initialize(firstname, lastname, number, email, flags = @@IS_NOT_INITIATOR)
  @firstname = firstname
  @lastname = lastname
  @number = number
  @email = email
  @flags = flags
end

Instance Attribute Details

#emailObject

Returns the value of attribute email.



3
4
5
# File 'lib/conference_call_service/participant_details.rb', line 3

def email
  @email
end

#firstnameObject

Returns the value of attribute firstname.



3
4
5
# File 'lib/conference_call_service/participant_details.rb', line 3

def firstname
  @firstname
end

#flagsObject

Returns the value of attribute flags.



3
4
5
# File 'lib/conference_call_service/participant_details.rb', line 3

def flags
  @flags
end

#lastnameObject

Returns the value of attribute lastname.



3
4
5
# File 'lib/conference_call_service/participant_details.rb', line 3

def lastname
  @lastname
end

#numberObject

Returns the value of attribute number.



3
4
5
# File 'lib/conference_call_service/participant_details.rb', line 3

def number
  @number
end

Class Method Details

.build_from_xml(xml_doc) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/conference_call_service/participant_details.rb', line 42

def self.build_from_xml(xml_doc)

  # Depending on the answer there might be a nil object, a NodeSelection or a NokogiriDriver.
  # For the parsing a NodeSelection and a NokogiriDriver behave similar but in order to prevent further nil errors
  # we have to see whether the elment is really present. For a nodeselection this is done by using .size > 0
  # which won't work for the nokogiri driver. Maybe handsoap will clean this up in future releases.
  if xml_doc && ( (xml_doc.is_a?(Handsoap::XmlQueryFront::NodeSelection) && xml_doc.size > 0) || xml_doc.is_a?(Handsoap::XmlQueryFront::NokogiriDriver ) ) then
    
    firstname  = ConferenceCallService.xpath_query(xml_doc, "firstName").to_s
    lastname   = ConferenceCallService.xpath_query(xml_doc, "lastName").to_s
    number     = ConferenceCallService.xpath_query(xml_doc, "number").to_s
    email      = ConferenceCallService.xpath_query(xml_doc, "email").to_s
    flags      = ConferenceCallService.xpath_query(xml_doc, "flags").to_s
    new(firstname, lastname, number, email , flags)
  end
end

.IS_INITIATORObject

Static methods



34
35
36
# File 'lib/conference_call_service/participant_details.rb', line 34

def self.IS_INITIATOR
  @@IS_INITIATOR
end

.IS_NOT_INITIATORObject



38
39
40
# File 'lib/conference_call_service/participant_details.rb', line 38

def self.IS_NOT_INITIATOR
  @@IS_NOT_INITIATOR
end

Instance Method Details

#add_to_handsoap_xml(xml_doc) ⇒ Object

Adds all participant details to the given xml_doc object.

Parameters

xml_doc

An XmlMason object as given by a handsoap method invokation.



24
25
26
27
28
29
30
# File 'lib/conference_call_service/participant_details.rb', line 24

def add_to_handsoap_xml(xml_doc)
  xml_doc.add('firstName', @firstname.to_s)
  xml_doc.add('lastName', @lastname.to_s)
  xml_doc.add('number', @number.to_s)
  xml_doc.add('email', @email.to_s)
  xml_doc.add('flags', @flags.to_s)
end

#to_sObject



17
18
19
# File 'lib/conference_call_service/participant_details.rb', line 17

def to_s
  "#{@firstname.to_s} #{@lastname.to_s}, #{@number.to_s}, #{@email.to_s}, #{@flags.to_s}. "
end