developergarden_sdk 0.0.8.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. data/README +47 -103
  2. data/Rakefile +5 -3
  3. data/lib/authenticated_service.rb +5 -1
  4. data/lib/basic_response.rb +2 -4
  5. data/lib/basic_service.rb +47 -22
  6. data/lib/conference_call_service/add_conference_template_participant_response.rb +19 -0
  7. data/lib/conference_call_service/commit_conference_response.rb +17 -0
  8. data/lib/conference_call_service/conference_call_service.rb +481 -0
  9. data/lib/conference_call_service/conference_constants.rb +70 -0
  10. data/lib/conference_call_service/conference_details.rb +36 -0
  11. data/lib/conference_call_service/conference_schedule.rb +73 -0
  12. data/lib/conference_call_service/create_conference_response.rb +20 -0
  13. data/lib/conference_call_service/create_conference_template_response.rb +21 -0
  14. data/lib/conference_call_service/get_conference_list_response.rb +36 -0
  15. data/lib/conference_call_service/get_conference_status_response.rb +43 -0
  16. data/lib/conference_call_service/get_conference_template_list_response.rb +36 -0
  17. data/lib/conference_call_service/get_conference_template_participant_response.rb +19 -0
  18. data/lib/conference_call_service/get_conference_template_response.rb +27 -0
  19. data/lib/conference_call_service/get_participant_status_response.rb +29 -0
  20. data/lib/conference_call_service/get_running_conference_response.rb +25 -0
  21. data/lib/conference_call_service/new_participant_response.rb +20 -0
  22. data/lib/conference_call_service/participant.rb +28 -0
  23. data/lib/conference_call_service/participant_details.rb +59 -0
  24. data/lib/conference_call_service/remove_conference_response.rb +17 -0
  25. data/lib/conference_call_service/remove_conference_template_participant_response.rb +17 -0
  26. data/lib/conference_call_service/remove_conference_template_response.rb +20 -0
  27. data/lib/conference_call_service/remove_participant_response.rb +17 -0
  28. data/lib/conference_call_service/update_conference_response.rb +17 -0
  29. data/lib/conference_call_service/update_conference_template_participant_response.rb +17 -0
  30. data/lib/conference_call_service/update_conference_template_response.rb +17 -0
  31. data/lib/conference_call_service/update_participant_response.rb +17 -0
  32. data/lib/ip_location_service/ip_address.rb +50 -0
  33. data/lib/ip_location_service/ip_address_location.rb +50 -0
  34. data/lib/ip_location_service/ip_location_response.rb +47 -0
  35. data/lib/ip_location_service/ip_location_service.rb +79 -0
  36. data/lib/ip_location_service/region.rb +23 -0
  37. data/lib/local_search_service/local_search_response.rb +30 -0
  38. data/lib/local_search_service/local_search_service.rb +91 -0
  39. data/lib/quota_service/quota_information.rb +3 -3
  40. data/lib/service_environment.rb +0 -1
  41. data/lib/service_exception.rb +1 -1
  42. data/lib/sms_service/sms_response.rb +2 -2
  43. data/lib/sms_service/sms_service.rb +7 -10
  44. data/lib/token_service/token_service.rb +20 -22
  45. data/lib/voice_call_service/call_status_response.rb +11 -11
  46. data/lib/voice_call_service/voice_call_response.rb +3 -3
  47. data/lib/voice_call_service/voice_call_service.rb +41 -41
  48. metadata +42 -12
data/README CHANGED
@@ -1,72 +1,22 @@
1
1
  == developergarden_sdk
2
2
  This library provides access to open development services of the Deutsche Telekom AG.
3
3
  For more details about the services see
4
+
4
5
  http://www.developergarden.com
5
6
 
6
7
  Depending on your operating system you might want to skip the "sudo" command prior to the
7
8
  commands listed here.
8
9
 
9
- === Dependencies
10
- In order to use this library the following dependencies need to be met:
11
- Ruby 1.8.6
12
- Ruby Gems >= 1.3.1
13
-
14
- There might be issues with Ruby 1.8.7 regarding to curb so it is highly recommended to use Ruby 1.8.6.
15
-
16
- ==== Gems
17
- The following gems need to be installed:
18
- * handsoap (Version 0.2.8)
19
- * nokogiri
20
- * httpclient (Version 2.1.14)
21
- * htmlentities
22
-
23
- === Install the handsoap gem
24
- For production use the official release of handsoap should be installed.
25
- More information about handsoap can be found at:
26
- http://github.com/troelskn/handsoap/tree/master
27
-
28
- ==== Install official handsoap release
29
- gem sources -a http://gems.github.com
30
- sudo gem install troelskn-handsoap
31
-
32
- ==== Install handsoap developer version
33
- If you want to use the bleeding edge version of handsoap proceed as follows.
34
- Note that you do not need to perform these steps if you have already installed the official release!
35
-
36
- Checkout handsoap from github
37
- git clone git://github.com/troelskn/handsoap.git
38
-
39
- Install jeweler
40
- sudo gem install jeweler
41
-
42
- Build handsoap package
43
- cd handsoap_git_repo
44
- rake build
45
-
46
- Install the resulting gem file
47
- cd pkg
48
- sudo gem install handsoap-0.2.7.gem
49
-
50
- Attention: if you you use the development version you might need to change the gem statement in
51
- basic_service.rb from
52
-
53
- gem 'troelskn-handsoap'
54
10
 
55
- to
11
+ === Installation
12
+ sudo gem install developergarden_sdk
56
13
 
57
- gem 'handsoap'
58
-
59
- === Installation of the developergarden_sdk Gem
60
- Install the gem using the following command
61
- gem install developergarden_sdk-0.0.x.gem
62
-
63
- Where x stands for the current version. For the version 0.0.4 this could look like this:
64
- gem install developergarden_sdk-0.0.x.gem
14
+ Dependent gems will be installed automatically.
65
15
 
66
16
  === Basic usage
67
17
  You can use the gem from pure Ruby applications and of course from Ruby on Rails apps as well.
68
18
 
69
- ==== To use the gem from your Ruby app:
19
+ ==== To use the gem from your Ruby app
70
20
 
71
21
  require 'rubygems'
72
22
  gem 'developergarden_sdk'
@@ -87,7 +37,48 @@ You can use the gem from pure Ruby applications and of course from Ruby on Rails
87
37
 
88
38
  sms = SmsService::SmsService.new("<USER>@t-online.de", "<PASSWORD>")
89
39
  sms_response = sms.send_sms("+49177 0000001", "Your message text.", "RubySDK", ServiceEnvironment.PRODUCTION, "")
90
-
40
+
41
+
42
+ === Ruby Example to perform an ip location request
43
+
44
+ require 'rubygems'
45
+ gem 'developergarden_sdk'
46
+ require 'token_Service/token_service'
47
+ require 'ip_location_service/ip_location_service'
48
+
49
+ @ip_location_service = IpLocationService::IpLocationService.new("<USER>@t-online.de", "<PASSWORD>")
50
+
51
+ ip = IpLocationService::IpAddress.new("93.222.255.58")
52
+ response = @ip_location_service.locate_ip(ip, ServiceEnvironment.PRODUCTION)
53
+
54
+ puts response.ip_address_locations.first.address
55
+ puts response.ip_address_locations.first.is_in_region.country_code
56
+ puts response.ip_address_locations.first.is_in_region.region_name
57
+
58
+ # If you except a single ip location (if you have passed a single ip to look up)
59
+ # then you can use the following way to access the location
60
+ puts response.ip_address_location.address
61
+ puts response.ip_address_location.is_in_region.country_code
62
+ puts response.ip_address_location.is_in_region.region_name
63
+
64
+ === Ruby Example to perform a local search
65
+ require 'rubygems'
66
+ gem 'developergarden_sdk'
67
+ require 'token_Service/token_service'
68
+
69
+ @service = LocalSearchService::LocalSearchService.new("<USER>@t-online.de", "<PASSWORD>")
70
+
71
+ search_parameter = {
72
+ :what => "music",
73
+ :near => "Konstanz"
74
+ }
75
+ response = @service.local_search(search_parameter, ServiceEnvironment.MOCK)
76
+
77
+ # Show response xml
78
+ puts response.search_result.to_xml
79
+ results_where_locs_where = response.search_result.xpath("//RESULTS/WHERE_LOCS/WHERE").first
80
+ lat = results_where_locs_where["LAT"]
81
+ puts lat
91
82
 
92
83
  ==== To use your gem from your Ruby on Rails app
93
84
  In your environment.rb add the following line in the config block:
@@ -117,53 +108,6 @@ In your environment.rb add the following line in the config block:
117
108
  In order to see more examples have a look the unit tests included in the gem's source code.
118
109
  You might also want to have a look at the actual source code and source code comments.
119
110
 
120
- === Debug
121
- Per default all generated and received soap xml messages are not visible. These can be print to stdout for debugging
122
- purposes by starting the ruby interpreter with the -d option. You will then see all http xml soap requests and responses.
123
- This can be done by invoking your ruby app by using a shebang like this:
124
- #!/usr/bin/ruby -d
125
-
126
- === Testing
127
- Before you run the tests you will need to modify config/test_settings.yml by entering your developer garden credentials.
128
-
129
- Executing tests will be done in the "sandbox" or "mock" environment which are free of charge.
130
- Be ware that the services itself have quotas on these test environments so your tests may fail after a while.
131
- The quotas are on a daily basis so they should pass again the next day.
132
-
133
- Failures when reaching the SANDBOX QUOTA might look like this:
134
- 0030 quotas have exceeded
135
-
136
- Phone numbers in test files are fictive and for testing purposes only.
137
-
138
- The testsuite can be run by invoking the test raketask.
139
- cd /home/yourhome/developergarden_sdk
140
- rake test
141
-
142
- In order to run a single test perform the following command:
143
- cd /home/yourhome/developergarden_sdk/lib
144
- ruby -d ../test/voice_call_service_test.rb --name teardown_call
145
-
146
- ==== QuotaService
147
- * QuotaService can be tested as it is. There is no need to pass an environment such as "production" or "sandbox" because
148
- it is free of charge.
149
-
150
- ==== SmsService
151
- * SmsService can be tested using the "sandbox" environment. Be aware that there is a 5 credit quota per day. So you can
152
- send 5 test sms per day. After that you will receive a corresponding quota error message.
153
-
154
- ==== VoiceCallService
155
- * In the "sandbox" environment there is a quota limit of 5 calls per day (each up to 10 sec) for the VoiceCallService
156
- * In the "production" environment a call may not last more than 60 minutes. After 60 min the call will be cancelled.
157
- * There is also a quota for the "mock" environment.
158
-
159
- For more information about service environments have a look at the documentation at http://www.developergarden.com
160
-
161
- === Build the developergarden_sdk gem
162
- You can build the gem by invoking the gem rake task
163
- rake gem
164
- The resulting gem will be generated to the pkg/ directory and can be installed like this:
165
- sudo gem install developergarden_sdk-0.0.6.gem
166
- Depending on the current version number you will need to adapt the gem filename correspondingly.
167
111
 
168
112
  ==More Information
169
113
  More information about developer garden services can be found at:
data/Rakefile CHANGED
@@ -13,7 +13,7 @@ require 'fileutils'
13
13
 
14
14
  spec = Gem::Specification.new do |s|
15
15
  s.name = 'developergarden_sdk'
16
- s.version = '0.0.8.1'
16
+ s.version = '0.9.0'
17
17
  s.homepage = 'http://www.developergarden.com'
18
18
  s.has_rdoc = true
19
19
  s.extra_rdoc_files = ['README', 'LICENSE']
@@ -25,8 +25,8 @@ spec = Gem::Specification.new do |s|
25
25
 
26
26
  # GEM dependencies
27
27
  s.add_dependency 'httpclient', '= 2.1.5.2'
28
- s.add_dependency 'nokogiri', '>= 1.3.1'
29
- s.add_dependency 'troelskn-handsoap', '= 0.2.8'
28
+ s.add_dependency 'nokogiri', '>= 1.4.0'
29
+ s.add_dependency 'handsoap', '= 1.1.4'
30
30
  s.add_dependency 'htmlentities', '>= 4.0.0'
31
31
 
32
32
  s.files = %w(LICENSE README Rakefile) + Dir.glob("{bin,lib,spec}/**/*")
@@ -57,6 +57,8 @@ end
57
57
 
58
58
  desc "update_plugin"
59
59
  task :update_plugin do
60
+ sh %{ rm -R plugin/developergarden_sdk/lib/* }
61
+ sh %{ rm -R plugin/developergarden_sdk/test/* }
60
62
  sh %{ cp -R lib/* plugin/developergarden_sdk/lib/ }
61
63
  sh %{ cp -R test/* plugin/developergarden_sdk/test/ }
62
64
  end
@@ -4,7 +4,11 @@ require File.dirname(__FILE__) + '/token_service/token_service'
4
4
  # Base service for all services demanding a security token.
5
5
  class AuthenticatedService < BasicService
6
6
 
7
- def initialize(username, password)
7
+ # Constructor
8
+ # ===Parameters
9
+ # <tt>username</tt>:: Username, such as myuser@t-online.de
10
+ # <tt>password</tt>:: Password
11
+ def initialize(username, password, environment = ServiceEnvironment.SANDBOX)
8
12
  super(username, password)
9
13
 
10
14
  @token_service = TokenService::TokenService.new(@username, @password)
@@ -14,10 +14,8 @@ class BasicResponse
14
14
  # <tt>raise_exception_on_error</tt>:: Xml as returned by a <tt>status</tt>-method call.
15
15
  def initialize(response_xml, raise_exception_on_error = true)
16
16
  doc = response_xml.document
17
-
18
- @error_code = doc.xpath("//errorCode").text
19
- @error_message = doc.xpath("//errorMessage").text
20
-
17
+ @error_code = doc.xpath("//errorCode").to_s || doc.xpath("//statusCode").to_s
18
+ @error_message = doc.xpath("//errorMessage").to_s || doc.xpath("//statusMessage").to_s
21
19
  raise_on_error(response_xml) if raise_exception_on_error
22
20
  end
23
21
 
data/lib/basic_service.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'rubygems'
2
- gem 'troelskn-handsoap'
2
+ gem 'handsoap'
3
3
 
4
4
  require 'handsoap'
5
5
  require File.dirname(__FILE__) + '/common/xml_tools'
@@ -7,14 +7,19 @@ require File.dirname(__FILE__) + '/service_environment'
7
7
 
8
8
  # Implements basic logic used by developer garden ruby service implementations.
9
9
  class BasicService < Handsoap::Service
10
-
10
+
11
11
  @@SERVICE_ID = "https://odg.t-online.de"
12
12
 
13
13
  # Create some namespaces
14
- on_create_document do |doc|
14
+ def on_create_document(doc)
15
15
  doc.alias 'ns1', "http://sts.idm.telekom.com/schema/"
16
16
  doc.alias 'xmlns:ns2', "Security"
17
- end
17
+ end
18
+
19
+ # Create the namespace for a later use in parse_token_data
20
+ def on_response_document(doc)
21
+ doc.add_namespace 'schema', 'http://sts.idm.telekom.com/schema/'
22
+ end
18
23
 
19
24
  # Constructor
20
25
  # ===Parameters
@@ -39,9 +44,9 @@ class BasicService < Handsoap::Service
39
44
  # <tt>doc</tt>:: Request XmlMason document.
40
45
  # <tt>security_token</tt>:: Security tokens as plain text gathered using the TokenService.
41
46
  def build_service_header(doc, security_token)
42
- header = build_security_header_common(doc)
43
- security = header.find("Security")
44
- security.set_value( security_token, :raw)
47
+ header = build_security_header_common(doc) do |security|
48
+ security.set_value( security_token, :raw)
49
+ end
45
50
  return header
46
51
  end
47
52
 
@@ -51,21 +56,22 @@ class BasicService < Handsoap::Service
51
56
  # The header of the given document will be enhanced so there is no need to
52
57
  # process the returning value.
53
58
  # ===Parameters
54
- # <tt>doc</tt>:: Request XmlMason document.
55
- def build_security_header_common(doc)
56
-
59
+ # <tt>doc</tt>:: Request XmlMason document.
60
+ def build_security_header_common(doc, &block)
61
+
57
62
  # Get the header element
58
63
  header = doc.find('Header')
59
64
 
60
65
  # Add plain security element
61
- header.add('Security')
66
+ header.add('Security') do |security|
67
+
68
+ # Set namespace
69
+ security.set_attr("xmlns", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd")
70
+ security.set_attr("env:mustUnderstand", "1")
62
71
 
63
- # Find security element for further enhancement
64
- security = header.find('Security')
72
+ security = yield(security)
73
+ end
65
74
 
66
- # Set namespace
67
- security.set_attr("xmlns", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd")
68
- security.set_attr("env:mustUnderstand", "1")
69
75
  return header
70
76
  end
71
77
 
@@ -75,14 +81,33 @@ class BasicService < Handsoap::Service
75
81
  # <tt>response</tt>:: Response as returned from a <tt>getTokens</tt> call, for example.
76
82
  #
77
83
  # ==Return
78
- # Returns the security token as plain text to be inserted into a security header build with <tt>build_security_header_common</tt>.
79
- def get_token_data_from_response(response)
80
-
81
- # nokogiri document. Unfortunately it is unable to parse the returning xml completely.
82
- # Especially the body is not parsed completely.
84
+ # Returns the security token as plain text to be inserted into a security header build with <tt>build_security_header_common</tt>.
85
+ def parse_token_data(response)
83
86
  doc = response.document
84
- intermediate_token = doc.xpath("//schema:tokenData", "schema" => 'http://sts.idm.telekom.com/schema/').inner_text
87
+
88
+ # Get the XmlQueryFront object which is a subclass of an array.
89
+ intermediate_token = doc.xpath("//schema:tokenData", "schema" => 'http://sts.idm.telekom.com/schema/').to_s
90
+
91
+ # The first element is a NokogiriDriver-Object which mixes in the XmlElement module.
92
+ # In order to preserve the CDATA ...
93
+ #= xml_element
94
+ #puts intermediate_token
85
95
 
86
96
  return intermediate_token
87
97
  end
98
+
99
+ # Performs a xpath query in the given namespace for the given document and query string.
100
+ # === Parameters
101
+ # <tt>schema</tt>:: Schema to be searched in such as <tt>'http://iplocation.developer.telekom.com/schema/'</tt>
102
+ # <tt>doc</tt>:: XmlQueryFront document.
103
+ # <tt>query_string</tt>:: Element to look for
104
+ # <tt>global_search</tt>:: Searches within all levels using "//" if <tt>global_search = true</tt>.
105
+ def self.xpath_query_for_schema(schema, doc, query_string, global_search = true)
106
+ xpath_query = ""
107
+ xpath_query = "//" if global_search
108
+ xpath_query += "schema:#{query_string}"
109
+
110
+ # Only search if there's at least one element
111
+ doc.xpath(xpath_query, "schema" => schema)
112
+ end
88
113
  end
@@ -0,0 +1,19 @@
1
+ require File.dirname(__FILE__) + '/../basic_response'
2
+
3
+ module ConferenceCallService
4
+ class AddConferenceTemplateParticipantResponse < BasicResponse
5
+ attr_accessor :participant_id
6
+
7
+ # Constructor
8
+ # ===Parameters
9
+ # <tt>response_xml</tt>:: Xml as returned by the corresponding method call.
10
+ # <tt>raise_exception_on_error</tt>:: Raise an exception if an error occurs or not?
11
+ def initialize(response_xml, raise_exception_on_error = true)
12
+ doc = response_xml.document
13
+ @error_code = ConferenceCallService.xpath_query(doc, "statusCode").to_s
14
+ @error_message = ConferenceCallService.xpath_query(doc, "statusMessage").to_s
15
+ @participant_id = ConferenceCallService.xpath_query(doc, "participantId").to_s
16
+ raise_on_error(response_xml) if raise_exception_on_error
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,17 @@
1
+ require File.dirname(__FILE__) + '/../basic_response'
2
+
3
+ module ConferenceCallService
4
+ class CommitConferenceResponse < BasicResponse
5
+
6
+ # Constructor.
7
+ # ===Parameters
8
+ # <tt>response_xml</tt>:: Xml as returned by the corresponding method call.
9
+ # <tt>raise_exception_on_error</tt>:: Raise an exception if an error occurs or not?
10
+ def initialize(response_xml, raise_exception_on_error = true)
11
+ doc = response_xml.document
12
+ @error_code = ConferenceCallService.xpath_query(doc, "statusCode").to_s
13
+ @error_message = ConferenceCallService.xpath_query(doc, "statusMessage").to_s
14
+ raise_on_error(response_xml) if raise_exception_on_error
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,481 @@
1
+ require File.dirname(__FILE__) + '/../authenticated_service'
2
+ require File.dirname(__FILE__) + '/conference_constants'
3
+ require File.dirname(__FILE__) + '/conference_details'
4
+ require File.dirname(__FILE__) + '/conference_schedule'
5
+ require File.dirname(__FILE__) + '/get_conference_list_response'
6
+ require File.dirname(__FILE__) + '/create_conference_response'
7
+ require File.dirname(__FILE__) + '/commit_conference_response'
8
+ require File.dirname(__FILE__) + '/get_conference_status_response'
9
+ require File.dirname(__FILE__) + '/new_participant_response'
10
+ require File.dirname(__FILE__) + '/participant_details'
11
+ require File.dirname(__FILE__) + '/remove_participant_response'
12
+ require File.dirname(__FILE__) + '/remove_conference_response'
13
+ require File.dirname(__FILE__) + '/get_running_conference_response'
14
+ require File.dirname(__FILE__) + '/participant'
15
+ require File.dirname(__FILE__) + '/get_conference_template_list_response'
16
+ require File.dirname(__FILE__) + '/create_conference_template_response'
17
+ require File.dirname(__FILE__) + '/update_participant_response'
18
+ require File.dirname(__FILE__) + '/update_conference_response'
19
+ require File.dirname(__FILE__) + '/get_conference_template_response'
20
+ require File.dirname(__FILE__) + '/remove_conference_template_response'
21
+ require File.dirname(__FILE__) + '/get_conference_template_participant_response'
22
+ require File.dirname(__FILE__) + '/remove_conference_template_participant_response'
23
+ require File.dirname(__FILE__) + '/add_conference_template_participant_response'
24
+ require File.dirname(__FILE__) + '/update_conference_template_participant_response'
25
+ require File.dirname(__FILE__) + '/update_conference_template_response'
26
+ require File.dirname(__FILE__) + '/get_participant_status_response'
27
+
28
+
29
+ Handsoap.http_driver = :httpclient
30
+
31
+ # Print http and soap requests and reponses if ruby has been started with -d option.
32
+ Handsoap::Service.logger = $stdout if $DEBUG
33
+
34
+
35
+ module ConferenceCallService
36
+
37
+ # Client to access the developer garden conference call service.
38
+ #
39
+ # See also:
40
+ # * https://www.developergarden.com/openapi/conferencecall
41
+ # * http://www.developergarden.com/static/docu/de/ch04s02s02.html
42
+ class ConferenceCallService < AuthenticatedService
43
+ @@CONFERENCE_CALL_SCHEMA = 'http://ccs.developer.telekom.com/schema/'
44
+
45
+ @@CONFERENCE_CALL_SCHEMA_SERVICE_ENDPOINT = {
46
+ :uri => "https://gateway.developer.telekom.com/p3gw-mod-odg-ccs/services/ccsPort",
47
+ :version => 1
48
+ }
49
+
50
+ endpoint @@CONFERENCE_CALL_SCHEMA_SERVICE_ENDPOINT
51
+
52
+ # Add namespaces to the handsoap XmlMason document.
53
+ def on_create_document(doc)
54
+ super(doc)
55
+ doc.alias 'cc', @@CONFERENCE_CALL_SCHEMA
56
+ end
57
+
58
+ # Stores the created conference to the conference call server.
59
+ # ===Parameters
60
+ # <tt>conference_id</tt>:: id of the interest conference
61
+ # <tt>environment</tt>:: Service environment as defined in ServiceEnvironment.
62
+ def commit_conference(conference_id, environment = ServiceEnvironment.MOCK)
63
+ response_xml = invoke_authenticated("cc:commitConference") do |request, doc|
64
+ request.add('commitConferenceRequest') do |commit_request, doc|
65
+ commit_request.add('conferenceId', conference_id)
66
+ commit_request.add('environment', environment)
67
+ end
68
+ end
69
+
70
+ response = CommitConferenceResponse.new(response_xml)
71
+ end
72
+
73
+ # Creates a new conference.
74
+ # ===Parameters
75
+ # <tt>owner_id</tt>:: Return only items owned by the given user such as "max.mustermann".
76
+ # <tt>detail</tt>:: Specifies the conference details like max duration, name and description.
77
+ # <tt>schedule</tt>:: Specifies when the conference will take place and if its going to be repeated on a regular basis.
78
+ # <tt>environment</tt>:: Service environment as defined in ServiceLevel.
79
+ def create_conference(owner_id, detail, schedule = nil, environment = ServiceEnvironment.MOCK, account = nil)
80
+ response_xml = invoke_authenticated("cc:createConference") do |request, doc|
81
+ request.add('createConferenceRequest') do |create_request|
82
+ create_request.add('environment', environment)
83
+ create_request.add('ownerId', owner_id.to_s)
84
+ create_request.add('detail') do |detail_request|
85
+ detail.add_to_handsoap_xml(detail_request)
86
+ end
87
+
88
+ # schedule
89
+ if schedule then
90
+ create_request.add('schedule') do |schedule_request|
91
+ schedule.add_to_handsoap_xml(schedule_request)
92
+ end
93
+ end
94
+
95
+ create_request.add('account', account) if (account && !account.empty?)
96
+ end
97
+ end
98
+
99
+ response = CreateConferenceResponse.new(response_xml)
100
+ end
101
+
102
+
103
+ # Retrieves spatial information about the given ip address.
104
+ # ===Parameters
105
+ # <tt>owner_id</tt>:: Return only items owned by the given user such as "max.mustermann".
106
+ # <tt>what</tt>:: Constraints of the list to be retrieved.
107
+ # <tt>environment</tt>:: Service environment as defined in ServiceLevel.
108
+ # <tt>account</tt>:: IP address for which to perform an ip location.
109
+ def get_conference_list(owner_id, what = ConferenceConstants.CONFERENCE_LIST_ALL, environment = ServiceEnvironment.MOCK, account = nil)
110
+
111
+ response_xml = invoke_authenticated("cc:getConferenceList") do |request, doc|
112
+ request.add('getConferenceListRequest') do |list_request|
113
+ list_request.add('environment', environment)
114
+ list_request.add('what', what.to_s)
115
+ list_request.add('ownerId', owner_id.to_s)
116
+ list_request.add('account', account) if (account && !account.empty?)
117
+ end
118
+ end
119
+
120
+ response = GetConferenceListResponse.new(response_xml)
121
+ return response
122
+ end
123
+
124
+ # Retrieves that status of the given conference.
125
+ # ===Parameters
126
+ # <tt>conference_id</tt>::
127
+ # <tt>what</tt>:: Contraints of the list to be retrieved.
128
+ # <tt>environment</tt>:: Service environment as defined in ServiceLevel.
129
+ def get_conference_status(conference_id, what = ConferenceConstants.CONFERENCE_LIST_ALL, environment = ServiceEnvironment.MOCK, account = nil)
130
+ response_xml = invoke_authenticated("cc:getConferenceStatus") do |request, doc|
131
+ request.add('getConferenceStatusRequest') do |status_request|
132
+ status_request.add('environment', environment)
133
+ status_request.add('what', what.to_s)
134
+ status_request.add('conferenceId', conference_id.to_s)
135
+ status_request.add('account', account) if (account && !account.empty?)
136
+ end
137
+ end
138
+
139
+ response = GetConferenceStatusResponse.new(response_xml)
140
+ return response
141
+ end
142
+
143
+ # Retrieves the status of the given participant in the specified conference.
144
+ # ===Parameters
145
+ # <tt>conference_id</tt>:: Id of the intended conference.
146
+ # <tt>participant_id</tt>:: Id of the desired participant.
147
+ # <tt>environment</tt>:: Service environment as defined in ServiceLevel.
148
+ def get_participant_status(conference_id, participant_id, environment = ServiceEnvironment.MOCK, account = nil)
149
+ response_xml = invoke_authenticated("cc:getParticipantStatus") do |request, doc|
150
+ request.add('getParticipantStatusRequest') do |new_participant_request|
151
+ new_participant_request.add('environment', environment)
152
+ new_participant_request.add('account', account) if (account && !account.empty?)
153
+ new_participant_request.add('conferenceId', conference_id.to_s)
154
+ new_participant_request.add('participantId', participant_id)
155
+ end
156
+ end
157
+
158
+ response = GetParticipantStatusResponse.new(response_xml)
159
+ end
160
+
161
+ # Adds the given participant to the specified conference.
162
+ # ===Parameters ra
163
+ # <tt>conference_id</tt>:: Id of the intended conference.
164
+ # <tt>participant</tt>:: Details of the participant to be added.
165
+ # <tt>environment</tt>:: Service environment as defined in ServiceLevel.
166
+ def new_participant(conference_id, participant, environment = ServiceEnvironment.MOCK, account = nil)
167
+ response_xml = invoke_authenticated("cc:newParticipant") do |request, doc|
168
+ request.add('newParticipantRequest') do |new_participant_request|
169
+ new_participant_request.add('environment', environment)
170
+ new_participant_request.add('account', account) if (account && !account.empty?)
171
+ new_participant_request.add('conferenceId', conference_id.to_s)
172
+ new_participant_request.add('participant') do |participant_request|
173
+ participant.add_to_handsoap_xml(participant_request)
174
+ end
175
+ end
176
+ end
177
+
178
+ response = NewParticipantResponse.new(response_xml)
179
+ end
180
+
181
+ # Updates the settings for the given participant of the given conference call.
182
+ # ===Parameters
183
+ # <tt>conference_id</tt>:: id of the interest conference
184
+ # <tt>participant_id</tt>:: id of the coming participant
185
+ # <tt>participant_detail</tt>:: Details of the coming participant
186
+ # <tt>action</tt>:: Action to performed for the given participant. Actions are mute, umute and redial.
187
+ # See ConferenceConstants for the corresponding constants.
188
+ # <tt>environment</tt>:: Service environment as defined in ServiceLevel.
189
+ def update_participant(conference_id, participant_id, participant_detail = nil, action = nil, environment = ServiceEnvironment.MOCK, account = nil)
190
+ response_xml = invoke_authenticated("cc:updateParticipant") do |request, doc|
191
+ request.add('updateParticipantRequest') do |update_participant_request|
192
+ update_participant_request.add('environment', environment)
193
+ update_participant_request.add('account', account) if (account && !account.empty?)
194
+ update_participant_request.add('conferenceId', conference_id.to_s)
195
+ update_participant_request.add('participantId', participant_id.to_s)
196
+ update_participant_request.add('action', action.to_s) if action
197
+
198
+ if participant_detail then
199
+ update_participant_request.add('participant') do |participant_request|
200
+ participant_detail.add_to_handsoap_xml(participant_request)
201
+ end
202
+ end
203
+ end
204
+ end
205
+
206
+ response = UpdateParticipantResponse.new(response_xml)
207
+ end
208
+
209
+ # Removes the given conference.
210
+ # ===Parameters
211
+ # <tt>conference_id</tt>:: id of the removed conference
212
+ # <tt>environment</tt>:: Service environment as defined in ServiceLevel.
213
+ def remove_conference(conference_id, environment = ServiceEnvironment.MOCK, account = nil)
214
+ response_xml = invoke_authenticated("cc:removeConference") do |request, doc|
215
+ request.add('removeConferenceRequest') do |remove_conference_request|
216
+ remove_conference_request.add('environment', environment)
217
+ remove_conference_request.add('conferenceId', conference_id.to_s)
218
+ remove_conference_request.add('account', account) if (account && !account.empty?)
219
+ end
220
+ end
221
+
222
+ response = RemoveConferenceResponse.new(response_xml)
223
+ end
224
+
225
+ # Retrieves that status of the given conference.
226
+ # ===Parameters
227
+ # <tt>conference_id</tt>::
228
+ # <tt>what</tt>:: Contraints of the list to be retrieved.
229
+ # <tt>environment</tt>:: Service environment as defined in ServiceLevel.
230
+ def remove_participant(conference_id, participant_id, environment = ServiceEnvironment.MOCK, account = nil)
231
+ response_xml = invoke_authenticated("cc:removeParticipant") do |request, doc|
232
+ request.add('removeParticipantRequest') do |remove_request|
233
+ remove_request.add('environment', environment)
234
+ remove_request.add('account', account) if (account && !account.empty?)
235
+ remove_request.add('conferenceId', conference_id.to_s)
236
+ remove_request.add('participantId', participant_id.to_s)
237
+ end
238
+ end
239
+
240
+ response = RemoveParticipantResponse.new(response_xml)
241
+ end
242
+
243
+ # Updates an existing conference.
244
+ # ===Parameters
245
+ # <tt>conference_id</tt>:: Id of the conference
246
+ # <tt>conference_details</tt>:: Id of the conference
247
+ # <tt>environment</tt>:: Service environment as defined in ServiceLevel.
248
+ def update_conference(conference_id, conference_details = nil, schedule = nil, initiator_id = nil, environment = ServiceEnvironment.MOCK, account = nil)
249
+ response_xml = invoke_authenticated("cc:updateConference") do |request, doc|
250
+ request.add('updateConferenceRequest') do |remove_request|
251
+ remove_request.add('environment', environment)
252
+ remove_request.add('account', account) if (account && !account.empty?)
253
+ remove_request.add('conferenceId', conference_id.to_s)
254
+ remove_request.add('initiatorId', initiator_id.to_s)
255
+
256
+ if conference_details then
257
+ remove_request.add('detail') do |detail_request|
258
+ conference_details.add_to_handsoap_xml(detail_request)
259
+ end
260
+ end
261
+
262
+ if schedule then
263
+ remove_request.add('schedule') do |schedule_request|
264
+ schedule.add_to_handsoap_xml(schedule_request)
265
+ end
266
+ end
267
+ end
268
+ end
269
+
270
+ response = UpdateConferenceResponse.new(response_xml)
271
+ end
272
+
273
+ # Tell whether a conference is running
274
+ # ===Parameters
275
+ # <tt>conference_id</tt>:: id of the maybe running conference
276
+ # <tt>environment</tt>:: Service environment as defined in ServiceLevel.
277
+ def get_running_conference(conference_id, environment = ServiceEnvironment.MOCK, account = nil)
278
+ response_xml = invoke_authenticated("cc:getRunningConference") do |request, doc|
279
+ request.add('getRunningConferenceRequest') do |get_running_conference_request|
280
+ get_running_conference_request.add('environment', environment)
281
+ get_running_conference_request.add('conferenceId', conference_id.to_s)
282
+ get_running_conference_request.add('account', account) if (account && !account.empty?)
283
+ end
284
+ end
285
+
286
+ response = GetRunningConferenceResponse.new(response_xml)
287
+ end
288
+
289
+ # Creates a conference template.
290
+ # ===Parameters
291
+ # <tt>owner_id</tt>:: id of the owner of the conference template
292
+ # <tt>detail</tt>: details of the conference template. ConferenceDetails Type
293
+ # <tt>participants</tt>: optional parameter of the type ParticipantDetail
294
+ # <tt>environment</tt>:: Service environment as defined in ServiceLevel.
295
+ def create_conference_template(owner_id, detail, participants = nil, environment = ServiceEnvironment.MOCK, account = nil)
296
+ response_xml = invoke_authenticated("cc:createConferenceTemplate") do |request, doc|
297
+ request.add('createConferenceTemplateRequest') do |create_conference_template_request|
298
+ create_conference_template_request.add('environment', environment)
299
+ create_conference_template_request.add('account', account) if (account && !account.empty?)
300
+ create_conference_template_request.add('ownerId', owner_id.to_s)
301
+ create_conference_template_request.add('detail') do |detail_request|
302
+ detail.add_to_handsoap_xml(detail_request)
303
+ end
304
+
305
+ if participants then
306
+ participants.each do |participant|
307
+ create_conference_template_request.add('participants') do |participant_request|
308
+ participant.add_to_handsoap_xml(participant_request)
309
+ end
310
+ end
311
+ end
312
+ end
313
+ end
314
+
315
+ response = CreateConferenceTemplateResponse.new(response_xml)
316
+ end
317
+
318
+ # Returns the confernece template with the given id.
319
+ # ===Parameters
320
+ # <tt>template_id</tt>::
321
+ # <tt>environment</tt>:: Service environment as defined in ServiceLevel.
322
+ def get_conference_template(template_id, environment = ServiceEnvironment.MOCK, account = nil)
323
+ response_xml = invoke_authenticated("cc:getConferenceTemplate") do |request, doc|
324
+ request.add('getConferenceTemplateRequest') do |get_conference_template_request|
325
+ get_conference_template_request.add('environment', environment)
326
+ get_conference_template_request.add('templateId', template_id.to_s)
327
+ get_conference_template_request.add('account', account) if (account && !account.empty?)
328
+ end
329
+ end
330
+
331
+ response = GetConferenceTemplateResponse.new(response_xml)
332
+ end
333
+
334
+ # Updates the specified conference with the given parameters.
335
+ # ===Parameters
336
+ # <tt>template_id</tt>:: id of the updated template
337
+ # <tt>initiator_id</tt>:: id of the initiator of the conference
338
+ # <tt>details</tt>:: details of the conference template
339
+ # <tt>environment</tt>:: Service environment as defined in ServiceLevel.
340
+ def update_conference_template(template_id, initiator_id, detail, environment = ServiceEnvironment.MOCK, account = nil)
341
+ response_xml = invoke_authenticated("cc:updateConferenceTemplate") do |request, doc|
342
+ request.add('updateConferenceTemplateRequest') do |update_conference_template_request|
343
+ update_conference_template_request.add('environment', environment)
344
+ update_conference_template_request.add('templateId', template_id.to_s)
345
+ update_conference_template_request.add('initiatorId', initiator_id.to_s)
346
+ update_conference_template_request.add('detail') do |detail_request|
347
+ detail.add_to_handsoap_xml(detail_request)
348
+ end
349
+ update_conference_template_request.add('account', account) if (account && !account.empty?)
350
+ end
351
+ end
352
+
353
+ response = UpdateConferenceTemplateResponse.new(response_xml)
354
+ end
355
+
356
+ # ===Parameters
357
+ # <tt>template_id</tt>:: template of the removed conference
358
+ # <tt>environment</tt>:: Service environment as defined in ServiceLevel.
359
+ def remove_conference_template(template_id, environment = ServiceEnvironment.MOCK, account = nil)
360
+ response_xml = invoke_authenticated("cc:removeConferenceTemplate") do |request, doc|
361
+ request.add('getConferenceTemplateRequest') do |remove_conference_template_request|
362
+ remove_conference_template_request.add('environment', environment)
363
+ remove_conference_template_request.add('templateId', template_id.to_s)
364
+ remove_conference_template_request.add('account', account) if (account && !account.empty?)
365
+ end
366
+ end
367
+
368
+ response = RemoveConferenceTemplateResponse.new(response_xml)
369
+ end
370
+
371
+ # Give the list of the templates of the given conference owner
372
+ # ===Parameters
373
+ # <tt>owner_id</tt>:: id of the owner of the requested conference
374
+ # <tt>environment</tt>:: Service environment as defined in ServiceLevel.
375
+ def get_conference_template_list(owner_id, environment = ServiceEnvironment.MOCK, account = nil)
376
+ response_xml = invoke_authenticated("cc:getConferenceTemplateList") do |request, doc|
377
+ request.add('getConferenceTemplateListRequest') do |get_conference_template_list_request|
378
+ get_conference_template_list_request.add('environment', environment)
379
+ get_conference_template_list_request.add('ownerId', owner_id.to_s)
380
+ get_conference_template_list_request.add('account', account) if (account && !account.empty?)
381
+ end
382
+ end
383
+
384
+ response = GetConferenceTemplateListResponse.new(response_xml)
385
+ end
386
+
387
+ # Give the list of the templates of the given conference owner
388
+ # ===Parameters
389
+ # <tt>template_id</tt>:: id of the template in which we call the participant
390
+ # <tt>participant_id</tt>:: id of the called participant
391
+ # <tt>environment</tt>:: Service environment as defined in ServiceLevel.
392
+ def get_conference_template_participant(template_id, participant_id, environment = ServiceEnvironment.MOCK, account = nil)
393
+ response_xml = invoke_authenticated("cc:getConferenceTemplateParticipant") do |request, doc|
394
+ request.add('getConferenceTemplateParticipantRequest') do |get_conference_template_participant_request|
395
+ get_conference_template_participant_request.add('environment', environment)
396
+ get_conference_template_participant_request.add('templateId', template_id.to_s)
397
+ get_conference_template_participant_request.add('participantId', participant_id.to_s)
398
+ get_conference_template_participant_request.add('account', account) if (account && !account.empty?)
399
+ end
400
+ end
401
+
402
+ response = GetConferenceTemplateParticipantResponse.new(response_xml)
403
+ end
404
+
405
+ # Update the details of a given participant
406
+ # ===Parameters
407
+ # <tt>template_id</tt>:: id of the template in which we call the participant
408
+ # <tt>participant_id</tt>:: id of the changed participant
409
+ # <tt>participant</tt>:: details of the changed participant
410
+ # <tt>environment</tt>:: Service environment as defined in ServiceLevel.
411
+ def update_conference_template_participant(template_id, participant_id, participant, environment = ServiceEnvironment.MOCK, account = nil)
412
+ response_xml = invoke_authenticated("cc:updateConferenceTemplateParticipant") do |request, doc|
413
+ request.add('updateConferenceTemplateParticipantRequest') do |update_conference_template_participant_request|
414
+ update_conference_template_participant_request.add('environment', environment)
415
+ update_conference_template_participant_request.add('templateId', template_id.to_s)
416
+ update_conference_template_participant_request.add('participantId', participant_id.to_s)
417
+ update_conference_template_participant_request.add('participant') do |participant_request|
418
+ participant.add_to_handsoap_xml(participant_request)
419
+ end
420
+ update_conference_template_participant_request.add('account', account) if (account && !account.empty?)
421
+ end
422
+ end
423
+
424
+ response = UpdateConferenceTemplateParticipantResponse.new(response_xml)
425
+ end
426
+
427
+ # Give the list of the templates of the given conference owner
428
+ # ===Parameters
429
+ # <tt>template_id</tt>:: id of the template in which we call the participant
430
+ # <tt>participant_id</tt>:: id of the called participant
431
+ # <tt>environment</tt>:: Service environment as defined in ServiceLevel.
432
+ def remove_conference_template_participant(template_id, participant_id, environment = ServiceEnvironment.MOCK, account = nil)
433
+ response_xml = invoke_authenticated("cc:removeConferenceTemplateParticipant") do |request, doc|
434
+ request.add('removeConferenceTemplateParticipantRequest') do |remove_conference_template_participant_request|
435
+ remove_conference_template_participant_request.add('environment', environment)
436
+ remove_conference_template_participant_request.add('templateId', template_id.to_s)
437
+ remove_conference_template_participant_request.add('participantId', participant_id.to_s)
438
+ remove_conference_template_participant_request.add('account', account) if (account && !account.empty?)
439
+ end
440
+ end
441
+
442
+ response = RemoveConferenceTemplateParticipantResponse.new(response_xml)
443
+ end
444
+
445
+ # Give the list of the templates of the given conference owner
446
+ # ===Parameters
447
+ # <tt>template_id</tt>:: conference in which will be added the participant
448
+ # <tt>participant</tt>:: participant who will be added to the conference
449
+ # <tt>environment</tt>:: Service environment as defined in ServiceLevel.
450
+ def add_conference_template_participant(template_id, participant, environment = ServiceEnvironment.MOCK, account = nil)
451
+ response_xml = invoke_authenticated("cc:addConferenceTemplateParticipant") do |request, doc|
452
+ request.add('addConferenceTemplateParticipantRequest') do |add_conference_template_participant_request|
453
+ add_conference_template_participant_request.add('environment', environment)
454
+ add_conference_template_participant_request.add('templateId', template_id.to_s)
455
+ add_conference_template_participant_request.add('participant') do |participant_request|
456
+ participant.add_to_handsoap_xml(participant_request)
457
+ end
458
+ add_conference_template_participant_request.add('account', account) if (account && !account.empty?)
459
+ end
460
+ end
461
+
462
+ response = AddConferenceTemplateParticipantResponse.new(response_xml)
463
+ end
464
+
465
+
466
+ #### Static Methods
467
+
468
+ def self.CONFERENCE_CALL_SCHEMA
469
+ return @@CONFERENCE_CALL_SCHEMA
470
+ end
471
+
472
+ # Performs a xpath query in the ip location namespace for the given document and query string.
473
+ # === Parameters
474
+ # <tt>doc</tt>:: XmlQueryFront document.
475
+ # <tt>query_string</tt>:: Element to look for
476
+ # <tt>global_search</tt>:: Searches within all levels using "//" if <tt>global_search = true</tt>.
477
+ def self.xpath_query(doc, query_string, global_search = true)
478
+ self.xpath_query_for_schema(@@CONFERENCE_CALL_SCHEMA, doc, query_string, global_search)
479
+ end
480
+ end
481
+ end