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.
- data/README +47 -103
- data/Rakefile +5 -3
- data/lib/authenticated_service.rb +5 -1
- data/lib/basic_response.rb +2 -4
- data/lib/basic_service.rb +47 -22
- data/lib/conference_call_service/add_conference_template_participant_response.rb +19 -0
- data/lib/conference_call_service/commit_conference_response.rb +17 -0
- data/lib/conference_call_service/conference_call_service.rb +481 -0
- data/lib/conference_call_service/conference_constants.rb +70 -0
- data/lib/conference_call_service/conference_details.rb +36 -0
- data/lib/conference_call_service/conference_schedule.rb +73 -0
- data/lib/conference_call_service/create_conference_response.rb +20 -0
- data/lib/conference_call_service/create_conference_template_response.rb +21 -0
- data/lib/conference_call_service/get_conference_list_response.rb +36 -0
- data/lib/conference_call_service/get_conference_status_response.rb +43 -0
- data/lib/conference_call_service/get_conference_template_list_response.rb +36 -0
- data/lib/conference_call_service/get_conference_template_participant_response.rb +19 -0
- data/lib/conference_call_service/get_conference_template_response.rb +27 -0
- data/lib/conference_call_service/get_participant_status_response.rb +29 -0
- data/lib/conference_call_service/get_running_conference_response.rb +25 -0
- data/lib/conference_call_service/new_participant_response.rb +20 -0
- data/lib/conference_call_service/participant.rb +28 -0
- data/lib/conference_call_service/participant_details.rb +59 -0
- data/lib/conference_call_service/remove_conference_response.rb +17 -0
- data/lib/conference_call_service/remove_conference_template_participant_response.rb +17 -0
- data/lib/conference_call_service/remove_conference_template_response.rb +20 -0
- data/lib/conference_call_service/remove_participant_response.rb +17 -0
- data/lib/conference_call_service/update_conference_response.rb +17 -0
- data/lib/conference_call_service/update_conference_template_participant_response.rb +17 -0
- data/lib/conference_call_service/update_conference_template_response.rb +17 -0
- data/lib/conference_call_service/update_participant_response.rb +17 -0
- data/lib/ip_location_service/ip_address.rb +50 -0
- data/lib/ip_location_service/ip_address_location.rb +50 -0
- data/lib/ip_location_service/ip_location_response.rb +47 -0
- data/lib/ip_location_service/ip_location_service.rb +79 -0
- data/lib/ip_location_service/region.rb +23 -0
- data/lib/local_search_service/local_search_response.rb +30 -0
- data/lib/local_search_service/local_search_service.rb +91 -0
- data/lib/quota_service/quota_information.rb +3 -3
- data/lib/service_environment.rb +0 -1
- data/lib/service_exception.rb +1 -1
- data/lib/sms_service/sms_response.rb +2 -2
- data/lib/sms_service/sms_service.rb +7 -10
- data/lib/token_service/token_service.rb +20 -22
- data/lib/voice_call_service/call_status_response.rb +11 -11
- data/lib/voice_call_service/voice_call_response.rb +3 -3
- data/lib/voice_call_service/voice_call_service.rb +41 -41
- metadata +42 -12
@@ -0,0 +1,23 @@
|
|
1
|
+
module IpLocationService
|
2
|
+
|
3
|
+
# Represents a region as used within the IpAddressLocation class in the context of the IpLocationService.
|
4
|
+
class Region
|
5
|
+
attr_accessor :country_code, :region_code, :region_name
|
6
|
+
|
7
|
+
def to_s
|
8
|
+
"Region: #{@country_code.to_s}, #{@region_code.to_s}, #{@region_name.to_s}"
|
9
|
+
end
|
10
|
+
|
11
|
+
#### Static methods
|
12
|
+
|
13
|
+
def self.build_from_xml(xml_doc)
|
14
|
+
region = Region.new
|
15
|
+
if xml_doc && xml_doc.size > 0 then
|
16
|
+
region.country_code = IpLocationService.xpath_query(xml_doc, "countryCode", false).to_s
|
17
|
+
region.region_code = IpLocationService.xpath_query(xml_doc, "regionCode", false).to_s
|
18
|
+
region.region_name = IpLocationService.xpath_query(xml_doc, "regionName", false).to_s
|
19
|
+
end
|
20
|
+
return region
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../basic_response'
|
2
|
+
|
3
|
+
module LocalSearchService
|
4
|
+
class LocalSearchResponse < BasicResponse
|
5
|
+
|
6
|
+
attr_accessor :search_result
|
7
|
+
|
8
|
+
# Constructor.
|
9
|
+
# ===Parameters
|
10
|
+
# <tt>response_xml</tt>:: Xml as returned by a <tt>ip_location</tt>-method call.
|
11
|
+
# <tt>raise_exception_on_error</tt>:: Xml as returned by a <tt>call_status</tt>-method call.
|
12
|
+
#
|
13
|
+
def initialize(response_xml, raise_exception_on_error = true)
|
14
|
+
|
15
|
+
doc = response_xml.document
|
16
|
+
|
17
|
+
@error_code = LocalSearchService.xpath_query(doc, "statusCode").to_s
|
18
|
+
@error_message = LocalSearchService.xpath_query(doc, "statusMessage").to_s
|
19
|
+
|
20
|
+
#TODO
|
21
|
+
@search_result = LocalSearchService.xpath_query(doc, "searchResult/RESULTS")
|
22
|
+
|
23
|
+
raise_on_error(response_xml) if raise_exception_on_error
|
24
|
+
end
|
25
|
+
|
26
|
+
def to_s
|
27
|
+
"#{@error_code.to_s}: #{@error_message.to_s}: #{@search_result.to_s}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../authenticated_service'
|
2
|
+
require File.dirname(__FILE__) + '/local_search_response'
|
3
|
+
|
4
|
+
Handsoap.http_driver = :httpclient
|
5
|
+
|
6
|
+
# Print http and soap requests and reponses if ruby has been started with -d option.
|
7
|
+
Handsoap::Service.logger = $stdout if $DEBUG
|
8
|
+
|
9
|
+
module LocalSearchService
|
10
|
+
|
11
|
+
|
12
|
+
# Client to access the developer garden ip location service.
|
13
|
+
#
|
14
|
+
# See also:
|
15
|
+
# * https://www.developergarden.com/openapi/localsearch
|
16
|
+
# * http://www.developergarden.com/static/docu/de/ch04s02s06.html
|
17
|
+
class LocalSearchService < AuthenticatedService
|
18
|
+
|
19
|
+
@@LOCAL_SEARCH_SCHEMA = 'http://localsearch.developer.telekom.com/schema/'
|
20
|
+
|
21
|
+
@@LOCAL_SEARCH_SCHEMA_SERVICE_ENDPOINT = {
|
22
|
+
:uri => "https://gateway.developer.telekom.com/p3gw-mod-odg-localsearch/services/localsearch",
|
23
|
+
:version => 1
|
24
|
+
}
|
25
|
+
|
26
|
+
endpoint @@LOCAL_SEARCH_SCHEMA_SERVICE_ENDPOINT
|
27
|
+
|
28
|
+
|
29
|
+
def on_create_document(doc)
|
30
|
+
super(doc)
|
31
|
+
doc.alias 'local', @@LOCAL_SEARCH_SCHEMA
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
# Retrieves spatial information about the given ip address.
|
36
|
+
# === Parameters
|
37
|
+
# <tt>search_parameters</tt>:: Search parameter hash specifying the terms and options to perform the search.
|
38
|
+
# Have a look at the developer garden service documentation for more details about
|
39
|
+
# valid parameters and their behavior.
|
40
|
+
# <tt>environment</tt>:: Service environment as defined in ServiceLevel.
|
41
|
+
# === Returns
|
42
|
+
# A LocalSearchResponse object.
|
43
|
+
# This object has a <tt>search_result</tt>-method which returns an <tt>Handsoap::XmlQueryFront::NodeSelection</tt>
|
44
|
+
# object. NodeSelection is basically part of Handsoap's XmlQueryFront, a concept to abstract from the underlying
|
45
|
+
# xml parser which is currently nokogiri, by default.
|
46
|
+
# Have a closer look at the Handsoap-Framework at github (http://github.com/unwire/handsoap/) to get
|
47
|
+
# more details about this. Don't hestitate to clone the project and have a look at its source code. It's not
|
48
|
+
# too much code and is fairly easy to read.
|
49
|
+
# For more information about the xml structure of the response object please refer to the Developergarden documentation.
|
50
|
+
#
|
51
|
+
# The tests of this gem also show some basic examples on how to parse a LocalSearchResult.
|
52
|
+
def local_search(search_parameter = { :what => "test" }, environment = ServiceEnvironment.MOCK)
|
53
|
+
response = nil
|
54
|
+
|
55
|
+
response = invoke_authenticated("local:LocalSearchRequest") do |request, doc|
|
56
|
+
request.add('environment', environment)
|
57
|
+
|
58
|
+
search_parameter.each_pair do |param, value|
|
59
|
+
request.add('searchParameters') do |params|
|
60
|
+
unless value.nil? then
|
61
|
+
params.add("parameter", param.to_s)
|
62
|
+
params.add("value", value.to_s)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
puts response.to_xml
|
69
|
+
|
70
|
+
response = LocalSearchResponse.new(response)
|
71
|
+
|
72
|
+
return response
|
73
|
+
end
|
74
|
+
|
75
|
+
#### Static Methods
|
76
|
+
|
77
|
+
def self.LOCAL_SEARCH_SCHEMA
|
78
|
+
return @@LOCAL_SEARCH_SCHEMA
|
79
|
+
end
|
80
|
+
|
81
|
+
|
82
|
+
# Performs a xpath query in the ip location namespace for the given document and query string.
|
83
|
+
# === Parameters
|
84
|
+
# <tt>doc</tt>:: XmlQueryFront document.
|
85
|
+
# <tt>query_string</tt>:: Element to look for
|
86
|
+
# <tt>global_search</tt>:: Searches within all levels using "//" if <tt>global_search = true</tt>.
|
87
|
+
def self.xpath_query(doc, query_string, global_search = true)
|
88
|
+
self.xpath_query_for_schema(@@LOCAL_SEARCH_SCHEMA, doc, query_string, global_search)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -14,9 +14,9 @@ module QuotaService
|
|
14
14
|
super(response_xml)
|
15
15
|
|
16
16
|
doc = response_xml.document
|
17
|
-
@max_quota = doc.xpath("//maxQuota").
|
18
|
-
@max_user_quota = doc.xpath("//maxUserQuota").
|
19
|
-
@quota_level = doc.xpath("//quotaLevel").
|
17
|
+
@max_quota = doc.xpath("//maxQuota").to_s
|
18
|
+
@max_user_quota = doc.xpath("//maxUserQuota").to_s
|
19
|
+
@quota_level = doc.xpath("//quotaLevel").to_s
|
20
20
|
|
21
21
|
raise_on_error(response_xml) if raise_exception_on_error
|
22
22
|
end
|
data/lib/service_environment.rb
CHANGED
data/lib/service_exception.rb
CHANGED
@@ -10,8 +10,8 @@ class SmsResponse < BasicResponse
|
|
10
10
|
def initialize(response_xml, raise_exception_on_error = true)
|
11
11
|
doc = response_xml.document
|
12
12
|
|
13
|
-
@error_code = doc.xpath("//status").
|
14
|
-
@error_message = doc.xpath("//description").
|
13
|
+
@error_code = doc.xpath("//status").to_s
|
14
|
+
@error_message = doc.xpath("//description").to_s
|
15
15
|
|
16
16
|
raise_on_error(response_xml) if raise_exception_on_error
|
17
17
|
end
|
@@ -68,19 +68,16 @@ module SmsService
|
|
68
68
|
originator = originator[0, 11]
|
69
69
|
|
70
70
|
response = invoke_authenticated(action_name) do |message, doc|
|
71
|
-
message.add("request")
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
71
|
+
message.add("request") do |request|
|
72
|
+
request.add('environment', environment)
|
73
|
+
request.add('number', numbers)
|
74
|
+
request.add('message', sms_message)
|
75
|
+
request.add('originator', originator)
|
76
|
+
request.add('account', account)
|
77
|
+
end
|
78
78
|
end
|
79
79
|
|
80
80
|
return SmsResponse.new(response)
|
81
81
|
end
|
82
|
-
|
83
|
-
|
84
82
|
end
|
85
|
-
|
86
83
|
end
|
@@ -52,7 +52,7 @@ module TokenService
|
|
52
52
|
build_login_header(doc)
|
53
53
|
end
|
54
54
|
|
55
|
-
intermediate_token =
|
55
|
+
intermediate_token = parse_token_data(response)
|
56
56
|
|
57
57
|
return intermediate_token
|
58
58
|
end
|
@@ -105,7 +105,7 @@ module TokenService
|
|
105
105
|
message.add('ns1:serviceId', @@SERVICE_ID)
|
106
106
|
end
|
107
107
|
|
108
|
-
security_token =
|
108
|
+
security_token = parse_token_data(response)
|
109
109
|
|
110
110
|
return security_token
|
111
111
|
end
|
@@ -120,22 +120,21 @@ module TokenService
|
|
120
120
|
def build_login_header(doc)
|
121
121
|
|
122
122
|
# Get the header element
|
123
|
-
header = build_security_header_common(doc)
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
password.set_value(@password)
|
123
|
+
header = build_security_header_common(doc) do |security|
|
124
|
+
security.add("UsernameToken") do |username_token|
|
125
|
+
|
126
|
+
# Create username section
|
127
|
+
username_token.add("Username") do |username|
|
128
|
+
username.set_value(@username)
|
129
|
+
end
|
130
|
+
|
131
|
+
# Create password section
|
132
|
+
username_token.add("Password") do |password|
|
133
|
+
password.set_attr("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText")
|
134
|
+
password.set_value(@password)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
139
138
|
|
140
139
|
return header
|
141
140
|
end
|
@@ -151,12 +150,11 @@ module TokenService
|
|
151
150
|
def build_get_tokens_header(doc, intermediate_token)
|
152
151
|
|
153
152
|
# Get the header element
|
154
|
-
header = build_security_header_common(doc)
|
155
|
-
|
156
|
-
|
153
|
+
header = build_security_header_common(doc) do |security|
|
154
|
+
security.set_value( intermediate_token, :raw )
|
155
|
+
end
|
157
156
|
|
158
157
|
return header
|
159
158
|
end
|
160
|
-
|
161
159
|
end
|
162
160
|
end
|
@@ -14,17 +14,17 @@ class CallStatusResponse < BasicResponse
|
|
14
14
|
def initialize(response_xml, raise_exception_on_error = true)
|
15
15
|
doc = response_xml.document
|
16
16
|
|
17
|
-
@error_code = doc.xpath("//status").
|
18
|
-
@error_message = doc.xpath("//err_msg").
|
19
|
-
@session_id = doc.xpath("//sessionId").
|
20
|
-
@connection_time_a = doc.xpath("//connectiontimea").
|
21
|
-
@connection_time_b = doc.xpath("//connectiontimeb").
|
22
|
-
@description_a = doc.xpath("//descriptiona").
|
23
|
-
@description_b = doc.xpath("//descriptionb").
|
24
|
-
@reason_a = doc.xpath("//reasona").
|
25
|
-
@reason_b = doc.xpath("//reasonb").
|
26
|
-
@state_a = doc.xpath("//statea").
|
27
|
-
@state_b = doc.xpath("//stateb").
|
17
|
+
@error_code = doc.xpath("//status").to_s
|
18
|
+
@error_message = doc.xpath("//err_msg").to_s
|
19
|
+
@session_id = doc.xpath("//sessionId").to_s
|
20
|
+
@connection_time_a = doc.xpath("//connectiontimea").to_s
|
21
|
+
@connection_time_b = doc.xpath("//connectiontimeb").to_s
|
22
|
+
@description_a = doc.xpath("//descriptiona").to_s
|
23
|
+
@description_b = doc.xpath("//descriptionb").to_s
|
24
|
+
@reason_a = doc.xpath("//reasona").to_s
|
25
|
+
@reason_b = doc.xpath("//reasonb").to_s
|
26
|
+
@state_a = doc.xpath("//statea").to_s
|
27
|
+
@state_b = doc.xpath("//stateb").to_s
|
28
28
|
|
29
29
|
raise_on_error(response_xml) if raise_exception_on_error
|
30
30
|
end
|
@@ -13,9 +13,9 @@ class VoiceCallResponse < BasicResponse
|
|
13
13
|
def initialize(response_xml, raise_exception_on_error = true)
|
14
14
|
doc = response_xml.document
|
15
15
|
|
16
|
-
@error_code = doc.xpath("//status").
|
17
|
-
@error_message = doc.xpath("//err_msg").
|
18
|
-
@session_id = doc.xpath("//sessionId").
|
16
|
+
@error_code = doc.xpath("//status").to_s
|
17
|
+
@error_message = doc.xpath("//err_msg").to_s
|
18
|
+
@session_id = doc.xpath("//sessionId").to_s
|
19
19
|
|
20
20
|
raise_on_error(response_xml) if raise_exception_on_error
|
21
21
|
end
|
@@ -36,17 +36,17 @@ module VoiceCallService
|
|
36
36
|
# <tt>account</tt>:: Currently unused
|
37
37
|
def new_call(a_number, b_number, expiration, max_duration, environment = ServiceEnvironment.MOCK, privacy_a = false, privacy_b = false, greeter = "", account = "")
|
38
38
|
response = invoke_authenticated("newCall") do |message, doc|
|
39
|
-
message.add("request")
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
39
|
+
message.add("request") do |request|
|
40
|
+
request.add('environment', environment)
|
41
|
+
request.add('aNumber', a_number)
|
42
|
+
request.add('bNumber', b_number)
|
43
|
+
request.add('privacyA', privacy_a.to_s)
|
44
|
+
request.add('privacyB', privacy_b.to_s)
|
45
|
+
request.add('expiration', expiration)
|
46
|
+
request.add('maxDuration', max_duration)
|
47
|
+
request.add('greeter', greeter)
|
48
|
+
request.add('account', account)
|
49
|
+
end
|
50
50
|
end
|
51
51
|
|
52
52
|
return VoiceCallResponse.new(response)
|
@@ -59,11 +59,11 @@ module VoiceCallService
|
|
59
59
|
# <tt>keep_alive</tt>:: Prevent an expiration of the call by calling <tt>call_status</tt> with <tt>keep_alive = 1</tt>.
|
60
60
|
def call_status(session_id, environment = ServiceEnvironment.MOCK, keep_alive = 1)
|
61
61
|
response = invoke_authenticated("callStatus") do |message, doc|
|
62
|
-
message.add("request")
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
62
|
+
message.add("request") do |request|
|
63
|
+
request.add('environment', environment)
|
64
|
+
request.add('keepAlive', keep_alive)
|
65
|
+
request.add('sessionId', session_id)
|
66
|
+
end
|
67
67
|
end
|
68
68
|
|
69
69
|
return CallStatusResponse.new(response)
|
@@ -80,10 +80,10 @@ module VoiceCallService
|
|
80
80
|
tdc = message.find("tearDownCall")
|
81
81
|
tdc.set_attr("xmlns", "http://webservice.voicebutler.odg.tonline.de")
|
82
82
|
|
83
|
-
message.add("request")
|
84
|
-
|
85
|
-
|
86
|
-
|
83
|
+
message.add("request") do |request|
|
84
|
+
request.add('environment', environment)
|
85
|
+
request.add('sessionId', session_id)
|
86
|
+
end
|
87
87
|
end
|
88
88
|
|
89
89
|
return CallStatusResponse.new(response)
|
@@ -105,30 +105,30 @@ module VoiceCallService
|
|
105
105
|
# <tt>account</tt>:: Currently unused.
|
106
106
|
def new_call_sequenced(a_number, b_number, expiration, max_duration, environment = ServiceEnvironment.MOCK, privacy_a = false, privacy_b = false, max_wait = 60, greeter = "", account = "")
|
107
107
|
response = invoke_authenticated("newCallSequenced") do |message, doc|
|
108
|
-
message.add("request")
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
108
|
+
message.add("request") do |request|
|
109
|
+
request.add('environment', environment)
|
110
|
+
request.add('aNumber', a_number)
|
111
|
+
|
112
|
+
# b_number can be an array of strings representing numbers or a single string representing a single number.
|
113
|
+
if b_number.is_a? Array then
|
114
|
+
# It's an array
|
115
|
+
for bn in b_number do
|
116
|
+
request.add('bNumber', bn)
|
117
|
+
end
|
118
|
+
else
|
119
|
+
|
120
|
+
# We assume its a string
|
121
|
+
request.add('bNumber', b_number)
|
118
122
|
end
|
119
|
-
else
|
120
123
|
|
121
|
-
|
122
|
-
request.add('
|
124
|
+
request.add('privacyA', privacy_a.to_s)
|
125
|
+
request.add('privacyB', privacy_b.to_s)
|
126
|
+
request.add('expiration', expiration)
|
127
|
+
request.add('maxDuration', max_duration)
|
128
|
+
request.add('maxWait', max_wait)
|
129
|
+
request.add('greeter', greeter)
|
130
|
+
request.add('account', account)
|
123
131
|
end
|
124
|
-
|
125
|
-
request.add('privacyA', privacy_a.to_s)
|
126
|
-
request.add('privacyB', privacy_b.to_s)
|
127
|
-
request.add('expiration', expiration)
|
128
|
-
request.add('maxDuration', max_duration)
|
129
|
-
request.add('maxWait', max_wait)
|
130
|
-
request.add('greeter', greeter)
|
131
|
-
request.add('account', account)
|
132
132
|
end
|
133
133
|
|
134
134
|
return VoiceCallResponse.new(response)
|