developergarden_sdk 0.0.8.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,70 @@
1
+ module ConferenceCallService
2
+ class ConferenceConstants
3
+
4
+ # Conference Status.
5
+ @@STATUS_ALL = 0
6
+
7
+ # Conference Status.
8
+ @@STATUS_DETAIL = 1
9
+
10
+ # Conference Status.
11
+ @@STATUS_PARTICIPANTS = 2
12
+
13
+ # Conference Status.
14
+ @@STATUS_SCHEDULE = 3
15
+
16
+ # Conference Participant Action constant.
17
+ @@ACTION_MUTE = 1
18
+
19
+ # Conference Participant Action constant.
20
+ @@ACTION_UNMUTE = 0
21
+
22
+ # Conference Participant Action constant.
23
+ @@ACTION_REDIAL = 2
24
+
25
+ # Conference list constant.
26
+ @@CONFERENCE_LIST_ALL = 0
27
+
28
+ # Conference list constant.
29
+ @@CONFERENCE_LIST_ADHOC = 1
30
+
31
+ # Conference list constant.
32
+ @@CONFERENCE_LIST_SCHEDULE = 2
33
+
34
+ def self.STATUS_ALL
35
+ @@STATUS_ALL
36
+ end
37
+
38
+ def self.STATUS_DETAIL
39
+ @@STATUS_DETAIL
40
+ end
41
+
42
+ def self.STATUS_PARTICIPANTS
43
+ @@STATUS_PARTICIPANTS
44
+ end
45
+
46
+ def self.STATUS_SCHEDULE
47
+ @@STATUS_SCHEDULE
48
+ end
49
+
50
+ def self.ACTION_MUTE
51
+ @@ACTION_MUTE
52
+ end
53
+
54
+ def self.ACTION_UNMUTE
55
+ @@ACTION_UNMUTE
56
+ end
57
+
58
+ def self.CONFERENCE_LIST_ALL
59
+ @@CONFERENCE_LIST_ALL
60
+ end
61
+
62
+ def self.CONFERENCE_LIST_ADHOC
63
+ @@CONFERENCE_LIST_ADHOC
64
+ end
65
+
66
+ def self.CONFERENCE_LIST_SCHEDULE
67
+ @@CONFERENCE_LIST_SCHEDULE
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,36 @@
1
+ module ConferenceCallService
2
+
3
+
4
+ class ConferenceDetails
5
+ attr_accessor :name, :description, :duration
6
+
7
+ # Constructor
8
+ def initialize(name, description, duration)
9
+ @name = name
10
+ @description = description
11
+ @duration = duration
12
+ end
13
+
14
+ def to_s
15
+ "#{@name.to_s} - #{@description.to_s}: #{@duration.to_s}"
16
+ end
17
+
18
+ def add_to_handsoap_xml(xml_doc)
19
+ xml_doc.add('name', @name.to_s)
20
+ xml_doc.add('description', @description.to_s)
21
+ xml_doc.add('duration', @duration.to_s)
22
+ end
23
+
24
+ #### Static methods
25
+
26
+ def self.build_from_xml(xml_doc)
27
+ if xml_doc then
28
+ name = ConferenceCallService.xpath_query(xml_doc, "name").to_s
29
+ description = ConferenceCallService.xpath_query(xml_doc, "description").to_s
30
+ duration = ConferenceCallService.xpath_query(xml_doc, "duration").to_s
31
+
32
+ new(name, description, duration)
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,73 @@
1
+ module ConferenceCallService
2
+
3
+ # Indicates when to start a conference call.
4
+ # Be ware that times are are relative to the UTC timezone.
5
+ class ConferenceSchedule
6
+ attr_accessor :minute, :hour, :day_of_month, :month, :year, :recurring, :notify
7
+
8
+ @@RECURRING_NONE = 0
9
+ @@RECURRING_HOURLY = 1
10
+ @@RECURRING_DAILY = 2
11
+ @@RECURRING_WEEKLY = 3
12
+ @@RECURRING_MONTHLY = 4
13
+
14
+ # Constructor
15
+ def initialize(minute = Time.now.min, hour = Time.now.hour, day_of_month = Time.now.day, month = Time.now.month, year = Time.now.year, recurring = @@RECURRING_NONE, notify = 0)
16
+ @minute = minute
17
+ @hour = hour
18
+ @day_of_month = day_of_month
19
+ @month = month
20
+ @year = year
21
+ @recurring = recurring
22
+ @notify = notify
23
+ end
24
+
25
+ def to_s
26
+ ret = "#{year}-#{month}-#{day_of_month} #{hour}:#{minute} Recurring: #{recurring}, Notify: #{notify}\n"
27
+ ret
28
+ end
29
+
30
+ def add_to_handsoap_xml(xml_doc)
31
+ xml_doc.add('minute', @minute.to_s)
32
+ xml_doc.add('hour', @hour.to_s)
33
+ xml_doc.add('dayOfMonth', @day_of_month.to_s)
34
+ xml_doc.add('month', @month.to_s)
35
+ xml_doc.add('year', @year.to_s)
36
+ xml_doc.add('recurring', @recurring.to_s)
37
+ xml_doc.add('notify', @notify.to_s)
38
+ end
39
+
40
+ #### Static methods
41
+
42
+ def self.build_from_xml(xml_doc)
43
+
44
+ # If the service responds with non-0000 answer there might me no schedule infos available
45
+ if xml_doc then
46
+ minute = ConferenceCallService.xpath_query(xml_doc, "minute").to_s
47
+ hour = ConferenceCallService.xpath_query(xml_doc, "hour").to_s
48
+ day_of_month = ConferenceCallService.xpath_query(xml_doc, "dayOfMonth").to_s
49
+ month = ConferenceCallService.xpath_query(xml_doc, "month").to_s
50
+ year = ConferenceCallService.xpath_query(xml_doc, "year").to_s
51
+ recurring = ConferenceCallService.xpath_query(xml_doc, "recurring").to_s
52
+ notify = ConferenceCallService.xpath_query(xml_doc, "notify").to_s
53
+ new(minute, hour, day_of_month, month, year, recurring, notify)
54
+ end
55
+ end
56
+
57
+ def self.RECURRING_NONE
58
+ @@RECURRING_NONE
59
+ end
60
+
61
+ def self.RECURRING_HOURLY
62
+ @@RECURRING_HOURLY
63
+ end
64
+
65
+ def self.RECURRING_WEEKLY
66
+ @@RECURRING_WEEKLY
67
+ end
68
+
69
+ def self.RECURRING_MONTHLY
70
+ @@RECURRING_MONTHLY
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,20 @@
1
+ require File.dirname(__FILE__) + '/../basic_response'
2
+
3
+ module ConferenceCallService
4
+ class CreateConferenceResponse < BasicResponse
5
+
6
+ attr_accessor :conference_id
7
+
8
+ # Constructor.
9
+ # ===Parameters
10
+ # <tt>response_xml</tt>:: Xml as returned by the corresponding method call.
11
+ # <tt>raise_exception_on_error</tt>:: Raise an exception if an error occurs or not?
12
+ def initialize(response_xml, raise_exception_on_error = true)
13
+ doc = response_xml.document
14
+ @error_code = ConferenceCallService.xpath_query(doc, "statusCode").to_s
15
+ @error_message = ConferenceCallService.xpath_query(doc, "statusMessage").to_s
16
+ @conference_id = ConferenceCallService.xpath_query(doc, "conferenceId").to_s
17
+ raise_on_error(response_xml) if raise_exception_on_error
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,21 @@
1
+ require File.dirname(__FILE__) + '/../basic_response'
2
+
3
+ module ConferenceCallService
4
+ class CreateConferenceTemplateResponse < BasicResponse
5
+ attr_accessor :template_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
+
13
+ doc = response_xml.document
14
+
15
+ @error_code = ConferenceCallService.xpath_query(doc, "statusCode").to_s
16
+ @error_message = ConferenceCallService.xpath_query(doc, "statusMessage").to_s
17
+ @template_id = ConferenceCallService.xpath_query(doc, "templateId").to_s
18
+ raise_on_error(response_xml) if raise_exception_on_error
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,36 @@
1
+ require File.dirname(__FILE__) + '/../basic_response'
2
+
3
+ module ConferenceCallService
4
+ class GetConferenceListResponse < BasicResponse
5
+
6
+ attr_accessor :conference_ids
7
+
8
+ # Constructor.
9
+ # ===Parameters
10
+ # <tt>response_xml</tt>:: Xml as returned by the corresponding method call.
11
+ # <tt>raise_exception_on_error</tt>:: Raise an exception if an error occurs or not?
12
+ def initialize(response_xml, raise_exception_on_error = true)
13
+
14
+ @conference_ids = []
15
+ doc = response_xml.document
16
+
17
+ @error_code = ConferenceCallService.xpath_query(doc, "statusCode").to_s
18
+ @error_message = ConferenceCallService.xpath_query(doc, "statusMessage").to_s
19
+
20
+ ConferenceCallService.xpath_query(doc, "conferenceIds").each do |conference_id_xml|
21
+ @conference_ids << conference_id_xml.to_s
22
+ end
23
+
24
+ raise_on_error(response_xml) if raise_exception_on_error
25
+ end
26
+
27
+ def to_s
28
+ ret = "#{@error_code.to_s}: #{@error_message.to_s}\n"
29
+ ret += "Conference ids:\n"
30
+ @conference_ids.each do |conference_id|
31
+ ret += "\t#{conference_id.to_s}\n"
32
+ end
33
+ ret
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,43 @@
1
+ require File.dirname(__FILE__) + '/../basic_response'
2
+
3
+ module ConferenceCallService
4
+ class GetConferenceStatusResponse < BasicResponse
5
+
6
+ attr_accessor :details, :schedule, :participants, :start_time, :acc
7
+
8
+ # Constructor.
9
+ # ===Parameters
10
+ # <tt>response_xml</tt>:: Xml as returned by the corresponding method call.
11
+ # <tt>raise_exception_on_error</tt>:: Raise an exception if an error occurs or not?
12
+ def initialize(response_xml, raise_exception_on_error = true)
13
+
14
+ @conference_ids = []
15
+ @participants = []
16
+
17
+ doc = response_xml.document
18
+
19
+ @error_code = ConferenceCallService.xpath_query(doc, "statusCode").to_s
20
+ @error_message = ConferenceCallService.xpath_query(doc, "statusMessage").to_s
21
+
22
+ @details = ConferenceDetails.build_from_xml(ConferenceCallService.xpath_query(doc, "detail"))
23
+ @schedule = ConferenceSchedule.build_from_xml(ConferenceCallService.xpath_query(doc, "schedule"))
24
+
25
+ participants_xml = ConferenceCallService.xpath_query(doc, "participants")
26
+ participants_xml.each do |participant_xml|
27
+ @participants << Participant.build_from_xml(participant_xml)
28
+ end
29
+
30
+ raise_on_error(response_xml) if raise_exception_on_error
31
+ end
32
+
33
+ def to_s
34
+ ret = "#{@error_code}: #{@error_message}\n"
35
+ ret += "\t" + details.to_s + "\n" if details
36
+ ret += "\t" + schedule.to_s + "\n" if schedule
37
+ @participants.each do |participant|
38
+ ret += "\t" + participant.to_s + "\n"
39
+ end
40
+ ret
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,36 @@
1
+ require File.dirname(__FILE__) + '/../basic_response'
2
+
3
+ module ConferenceCallService
4
+ class GetConferenceTemplateListResponse < BasicResponse
5
+
6
+ attr_accessor :template_ids
7
+
8
+ # Constructor.
9
+ # ===Parameters
10
+ # <tt>response_xml</tt>:: Xml as returned by the corresponding method call.
11
+ # <tt>raise_exception_on_error</tt>:: Raise an exception if an error occurs or not?
12
+ def initialize(response_xml, raise_exception_on_error = true)
13
+
14
+ @template_ids = []
15
+ doc = response_xml.document
16
+
17
+ @error_code = ConferenceCallService.xpath_query(doc, "statusCode").to_s
18
+ @error_message = ConferenceCallService.xpath_query(doc, "statusMessage").to_s
19
+
20
+ ConferenceCallService.xpath_query(doc, "templateIds").each do |template_id_xml|
21
+ @template_ids << template_id_xml.to_s
22
+ end
23
+
24
+ raise_on_error(response_xml) if raise_exception_on_error
25
+ end
26
+
27
+ def to_s
28
+ ret = "#{@error_code.to_s}: #{@error_message.to_s}\n"
29
+ ret += "Template ids:\n"
30
+ @template_ids.each do |template_id|
31
+ ret += "\t#{template_id.to_s}\n"
32
+ end
33
+ ret
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,19 @@
1
+ require File.dirname(__FILE__) + '/../basic_response'
2
+
3
+ module ConferenceCallService
4
+ class GetConferenceTemplateParticipantResponse < BasicResponse
5
+ attr_accessor :participant
6
+ # Constructor
7
+
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 = ParticipantDetails.build_from_xml(ConferenceCallService.xpath_query(doc, "participant"))
16
+ raise_on_error(response_xml) if raise_exception_on_error
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,27 @@
1
+ require File.dirname(__FILE__) + '/../basic_response'
2
+
3
+ module ConferenceCallService
4
+ class GetConferenceTemplateResponse < BasicResponse
5
+ attr_accessor :details, :participants
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
+ @participants = []
13
+ doc = response_xml.document
14
+ @error_code = ConferenceCallService.xpath_query(doc, "statusCode").to_s
15
+ @error_message = ConferenceCallService.xpath_query(doc, "statusMessage").to_s
16
+
17
+ participants_xml = ConferenceCallService.xpath_query(doc, "participants")
18
+ if participants_xml then
19
+ participants_xml.each do |participant_xml|
20
+ @participants << ParticipantDetails.build_from_xml(participant_xml)
21
+ end
22
+ end
23
+ @details = ConferenceDetails.build_from_xml(ConferenceCallService.xpath_query(doc, "detail"))
24
+ raise_on_error(response_xml) if raise_exception_on_error
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,29 @@
1
+ require File.dirname(__FILE__) + '/../basic_response'
2
+
3
+ module ConferenceCallService
4
+ class GetParticipantStatusResponse < BasicResponse
5
+
6
+ attr_accessor :status
7
+
8
+ # Constructor.
9
+ # ===Parameters
10
+ # <tt>response_xml</tt>:: Xml as returned by the corresponding method call.
11
+ # <tt>raise_exception_on_error</tt>:: Raise an exception if an error occurs or not?
12
+ def initialize(response_xml, raise_exception_on_error = true)
13
+ doc = response_xml.document
14
+ @status = {}
15
+ @error_code = ConferenceCallService.xpath_query(doc, "statusCode").to_s
16
+ @error_message = ConferenceCallService.xpath_query(doc, "statusMessage").to_s
17
+
18
+ status_xml = ConferenceCallService.xpath_query(doc, "status")
19
+ if status_xml then
20
+ status_xml.each do |one_status_xml|
21
+ name = ConferenceCallService.xpath_query(one_status_xml, "name", false).to_s
22
+ value = ConferenceCallService.xpath_query(one_status_xml, "value", false).to_s
23
+ @status[name] = value
24
+ end
25
+ end
26
+ raise_on_error(response_xml) if raise_exception_on_error
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,25 @@
1
+ require File.dirname(__FILE__) + '/../basic_response'
2
+
3
+ module ConferenceCallService
4
+ class GetRunningConferenceResponse < BasicResponse
5
+ attr_accessor :conference_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
+
13
+ @conference_ids = []
14
+ doc = response_xml.document
15
+
16
+ @error_code = ConferenceCallService.xpath_query(doc, "statusCode").to_s
17
+ @error_message = ConferenceCallService.xpath_query(doc, "statusMessage").to_s
18
+ @conference_id = ConferenceCallService.xpath_query(doc, "conferenceId").to_s
19
+
20
+ raise_on_error(response_xml) if raise_exception_on_error
21
+
22
+ end
23
+
24
+ end
25
+ end