oneapi 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +37 -0
  6. data/Rakefile +2 -0
  7. data/lib/endpoints/ServiceEndpoints.rb +144 -0
  8. data/lib/foundation/FormParameter.rb +25 -0
  9. data/lib/foundation/FormParameters.rb +39 -0
  10. data/lib/foundation/JSONRequest.rb +109 -0
  11. data/lib/location/Locate.rb +100 -0
  12. data/lib/mms/MMSRetrieve.rb +198 -0
  13. data/lib/mms/MMSSend.rb +205 -0
  14. data/lib/oneapi.rb +6 -0
  15. data/lib/oneapi/version.rb +3 -0
  16. data/lib/payment/Charge.rb +166 -0
  17. data/lib/payment/Reservation.rb +295 -0
  18. data/lib/response/Attachment.rb +50 -0
  19. data/lib/response/HTTPResponse.rb +63 -0
  20. data/lib/response/PolicyException.rb +58 -0
  21. data/lib/response/RequestError.rb +41 -0
  22. data/lib/response/ResourceReference.rb +24 -0
  23. data/lib/response/ServiceException.rb +50 -0
  24. data/lib/response/location/CurrentLocation.rb +76 -0
  25. data/lib/response/location/ErrorInformation.rb +41 -0
  26. data/lib/response/location/LocationResponse.rb +49 -0
  27. data/lib/response/location/TerminalLocation.rb +67 -0
  28. data/lib/response/location/TerminalLocationList.rb +36 -0
  29. data/lib/response/mms/CallbackReference.rb +37 -0
  30. data/lib/response/mms/DeliveryInfo.rb +37 -0
  31. data/lib/response/mms/DeliveryInfoList.rb +49 -0
  32. data/lib/response/mms/DeliveryInfoNotification.rb +39 -0
  33. data/lib/response/mms/DeliveryReceiptSubscription.rb +39 -0
  34. data/lib/response/mms/HTTPResponse.rb +35 -0
  35. data/lib/response/mms/InboundMMSMessage.rb +37 -0
  36. data/lib/response/mms/InboundMessage.rb +91 -0
  37. data/lib/response/mms/InboundMessageList.rb +75 -0
  38. data/lib/response/mms/InboundMessageNotification.rb +39 -0
  39. data/lib/response/mms/MMSDeliveryReceiptSubscriptionResponse.rb +49 -0
  40. data/lib/response/mms/MMSMessageReceiptSubscriptionResponse.rb +49 -0
  41. data/lib/response/mms/MMSSendDeliveryStatusResponse.rb +49 -0
  42. data/lib/response/mms/RetrieveMMSMessageResponse.rb +57 -0
  43. data/lib/response/mms/RetrieveMMSResponse.rb +49 -0
  44. data/lib/response/mms/SendMMSResponse.rb +49 -0
  45. data/lib/response/payment/AmountReservationResponse.rb +49 -0
  46. data/lib/response/payment/AmountReservationTransaction.rb +116 -0
  47. data/lib/response/payment/AmountResponse.rb +49 -0
  48. data/lib/response/payment/AmountTransaction.rb +103 -0
  49. data/lib/response/payment/ChargingInformation.rb +50 -0
  50. data/lib/response/payment/PaymentAmount.rb +51 -0
  51. data/lib/response/sms/CallbackReference.rb +37 -0
  52. data/lib/response/sms/DeliveryInfo.rb +37 -0
  53. data/lib/response/sms/DeliveryInfoList.rb +49 -0
  54. data/lib/response/sms/DeliveryInfoNotification.rb +39 -0
  55. data/lib/response/sms/DeliveryReceiptSubscription.rb +39 -0
  56. data/lib/response/sms/HTTPResponse.rb +35 -0
  57. data/lib/response/sms/InboundSMSMessage.rb +89 -0
  58. data/lib/response/sms/InboundSMSMessageList.rb +75 -0
  59. data/lib/response/sms/InboundSMSMessageNotification.rb +39 -0
  60. data/lib/response/sms/RetrieveSMSResponse.rb +49 -0
  61. data/lib/response/sms/SMSDeliveryReceiptSubscriptionResponse.rb +49 -0
  62. data/lib/response/sms/SMSMessageReceiptSubscriptionResponse.rb +49 -0
  63. data/lib/response/sms/SMSSendDeliveryStatusResponse.rb +49 -0
  64. data/lib/response/sms/SendSMSResponse.rb +49 -0
  65. data/lib/sms/SMSRetrieve.rb +125 -0
  66. data/lib/sms/SMSSend.rb +168 -0
  67. data/oneapi.gemspec +23 -0
  68. metadata +138 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f743ab8ddfda853db244427897eed53311f1685c
4
+ data.tar.gz: 8c0fa4bab46c3a1ceb663459e6a375e14997ecf0
5
+ SHA512:
6
+ metadata.gz: 19c32c7b6fae7c69fc2eb23d5b2bb13edbe5db408cdfe8d42794e7b0da3c4dcf4aecefbfb10f553420b925231cb64145bbc298a9d8a7d8cad80a5c2359bfef50
7
+ data.tar.gz: 7c959bcc07f433548b77c3cce5d003513005c40e3fcef2b53d2c4c131dadc95235a93932f80d0c2021937806376f5a1d70ddb5677727b09ac02bb3ab66e35aaa
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in oneapi.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Hasan Kumar Reddy A
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # Oneapi
2
+
3
+ Code taken from https://github.com/OneAPI/GSMA-OneAPI/tree/master/Ruby
4
+
5
+ ## Installation
6
+
7
+ TODO: Not yet published in rubygems server. Install it directly from git for now
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'oneapi'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install oneapi
22
+
23
+ ## Usage
24
+
25
+ See http://www.gsma.com/oneapi/ruby-examples/ for examples
26
+
27
+ #TODO: Explain configuration part
28
+
29
+ #TODO: Add examples for vodafone
30
+
31
+ ## Contributing
32
+
33
+ 1. Fork it ( https://github.com/mintuhouse/oneapi/fork )
34
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
35
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
36
+ 4. Push to the branch (`git push origin my-new-feature`)
37
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,144 @@
1
+
2
+ class ServiceEndpoints
3
+
4
+ def initialize(protocol = "http", server_root = "localhost:8080", server_path = "oneapiserver", api_version = "1", services = {})
5
+ services = {
6
+ "AmountChargeService" =>"AmountChargeService",
7
+ "AmountRefundService" =>"AmountRefundService",
8
+ "AmountReserveService" =>"AmountReserveService",
9
+ "AmountReserveAdditionalService" =>"AmountReserveAdditionalService",
10
+ "AmountReserveChargeService" =>"AmountReserveChargeService",
11
+ "AmountReserveReleaseService" =>"AmountReserveReleaseService",
12
+ "LocationService" =>"LocationService",
13
+ "SendSMSService" =>"SendSMSService",
14
+ "QuerySMSService" =>"QuerySMSService",
15
+ "SMSDeliveryService" =>"SMSDeliveryService",
16
+ "CancelSMSDeliveryService" =>"CancelSMSDeliveryService",
17
+ "RetrieveSMSService" =>"RetrieveSMSService",
18
+ "SMSReceiptService" =>"SMSReceiptService",
19
+ "CancelSMSReceiptService" =>"CancelSMSReceiptService",
20
+ "SendMMSService" =>"SendMMSService",
21
+ "QueryMMSService" =>"QueryMMSService",
22
+ "MMSDeliveryService" =>"MMSDeliveryService",
23
+ "CancelMMSDeliveryService" =>"CancelMMSDeliveryService",
24
+ "RetrieveMMSService" =>"RetrieveMMSService",
25
+ "RetrieveMMSMessageService" =>"RetrieveMMSMessageService",
26
+ "MMSReceiptService" =>"MMSReceiptService",
27
+ "CancelMMSReceiptService" =>"CancelMMSReceiptService"
28
+ }.merge(services)
29
+
30
+ base_path = "#{protocol}://#{server_root}/#{server_path}"
31
+
32
+ @AmountCharge ="#{base_path}/#{services["AmountChargeService"]}/#{api_version}/payment/{endUserId}/transactions/amount"
33
+ @AmountRefund ="#{base_path}/#{services["AmountRefundService"]}/#{api_version}/payment/{endUserId}/transactions/amount"
34
+ @AmountReserve ="#{base_path}/#{services["AmountReserveService"]}/#{api_version}/payment/{endUserId}/transactions/amountReservation"
35
+ @AmountReserveAdditional ="#{base_path}/#{services["AmountReserveAdditionalService"]}/#{api_version}/payment/{endUserId}/transactions/amountReservation/{transactionId}"
36
+ @AmountReservationCharge ="#{base_path}/#{services["AmountReserveChargeService"]}/#{api_version}/payment/{endUserId}/transactions/amountReservation/{transactionId}"
37
+ @AmountReservationRelease ="#{base_path}/#{services["AmountReserveReleaseService"]}/#{api_version}/payment/{endUserId}/transactions/amountReservation/{transactionId}"
38
+ @Location ="#{base_path}/#{services["LocationService"]}/#{api_version}/location/queries/location"
39
+ @SendSMS ="#{base_path}/#{services["SendSMSService"]}/#{api_version}/smsmessaging/outbound/{senderAddress}/requests"
40
+ @QuerySMSDelivery ="#{base_path}/#{services["QuerySMSService"]}/#{api_version}/smsmessaging/outbound/{senderAddress}/requests/{requestId}/deliveryInfos"
41
+ @SMSDeliverySubscriptions ="#{base_path}/#{services["SMSDeliveryService"]}/#{api_version}/smsmessaging/outbound/{senderAddress}/subscriptions"
42
+ @CancelSMSDeliverySubscription ="#{base_path}/#{services["CancelSMSDeliveryService"]}/#{api_version}/smsmessaging/outbound/subscriptions/{subscriptionId}"
43
+ @RetrieveSMS ="#{base_path}/#{services["RetrieveSMSService"]}/#{api_version}/smsmessaging/inbound/registrations/{registrationId}/messages/?maxBatchSize={maxBatchSize}"
44
+ @SMSReceiptSubscriptions ="#{base_path}/#{services["SMSReceiptService"]}/#{api_version}/smsmessaging/inbound/subscriptions"
45
+ @CancelSMSReceiptSubscription ="#{base_path}/#{services["CancelSMSReceiptService"]}/#{api_version}/smsmessaging/inbound/subscriptions/{subscriptionId}"
46
+ @SendMMS ="#{base_path}/#{services["SendMMSService"]}/#{api_version}/messaging/outbound/{senderAddress}/requests"
47
+ @QueryMMSDelivery ="#{base_path}/#{services["QueryMMSService"]}/#{api_version}/messaging/outbound/{senderAddress}/requests/{requestId}/deliveryInfos"
48
+ @MMSDeliverySubscriptions ="#{base_path}/#{services["MMSDeliveryService"]}/#{api_version}/messaging/outbound/{senderAddress}/subscriptions"
49
+ @CancelMMSDeliverySubscription ="#{base_path}/#{services["CancelMMSDeliveryService"]}/#{api_version}/messaging/outbound/subscriptions/{subscriptionId}"
50
+ @RetrieveMMS ="#{base_path}/#{services["RetrieveMMSService"]}/#{api_version}/messaging/inbound/registrations/{registrationId}/messages/?maxBatchSize={maxBatchSize}"
51
+ @RetrieveMMSMessage ="#{base_path}/#{services["RetrieveMMSMessageService"]}/#{api_version}/messaging/inbound/registrations/{registrationId}/messages/{messageId}?resFormat={resFormat}"
52
+ @MMSReceiptSubscriptions ="#{base_path}/#{services["MMSReceiptService"]}/#{api_version}/messaging/inbound/subscriptions"
53
+ @CancelMMSReceiptSubscription ="#{base_path}/#{services["CancelMMSReceiptService"]}/#{api_version}/messaging/inbound/subscriptions/{subscriptionId}"
54
+ end
55
+
56
+ def getAmountChargeEndpoint
57
+ @AmountCharge
58
+ end
59
+
60
+ def getAmountRefundEndpoint
61
+ @AmountRefund
62
+ end
63
+
64
+ def getAmountReserveEndpoint
65
+ @AmountReserve
66
+ end
67
+
68
+ def getAmountReserveAdditionalEndpoint
69
+ @AmountReserveAdditional
70
+ end
71
+
72
+ def getAmountReservationChargeEndpoint
73
+ @AmountReservationCharge
74
+ end
75
+
76
+ def getAmountReservationReleaseEndpoint
77
+ @AmountReservationRelease
78
+ end
79
+
80
+ def getLocationEndpoint
81
+ @Location;
82
+ end
83
+
84
+ def getSendSMSEndpoint
85
+ @SendSMS
86
+ end
87
+
88
+ def getQuerySMSDeliveryEndpoint
89
+ @QuerySMSDelivery
90
+ end
91
+
92
+ def getSMSDeliverySubscriptionsEndpoint
93
+ @SMSDeliverySubscriptions
94
+ end
95
+
96
+ def getCancelSMSDeliverySubscriptionEndpoint
97
+ @CancelSMSDeliverySubscription
98
+ end
99
+
100
+ def getRetrieveSMSEndpoint
101
+ @RetrieveSMS
102
+ end
103
+
104
+ def getSMSReceiptSubscriptionsEndpoint
105
+ @SMSReceiptSubscriptions
106
+ end
107
+
108
+ def getCancelSMSReceiptSubscriptionEndpoint
109
+ @CancelSMSReceiptSubscription
110
+ end
111
+
112
+ def getSendMMSEndpoint
113
+ @SendMMS
114
+ end
115
+
116
+ def getQueryMMSDeliveryEndpoint
117
+ @QueryMMSDelivery
118
+ end
119
+
120
+ def getMMSDeliverySubscriptionsEndpoint
121
+ @MMSDeliverySubscriptions
122
+ end
123
+
124
+ def getCancelMMSDeliverySubscriptionEndpoint
125
+ @CancelMMSDeliverySubscription
126
+ end
127
+
128
+ def getRetrieveMMSEndpoint
129
+ @RetrieveMMS
130
+ end
131
+
132
+ def getRetrieveMMSMessageEndpoint
133
+ @RetrieveMMSMessage
134
+ end
135
+
136
+ def getMMSReceiptSubscriptionsEndpoint
137
+ @MMSReceiptSubscriptions
138
+ end
139
+
140
+ def getCancelMMSReceiptSubscriptionEndpoint
141
+ @CancelMMSReceiptSubscription
142
+ end
143
+ end
144
+
@@ -0,0 +1,25 @@
1
+
2
+ class FormParameter
3
+
4
+ def initialize(key=nil, value=nil)
5
+ @key=key
6
+ @value=value
7
+ end
8
+
9
+ def getKey
10
+ @key
11
+ end
12
+
13
+ def getValue
14
+ @value
15
+ end
16
+
17
+ def setKey(key)
18
+ @key=key
19
+ end
20
+
21
+ def setValue(value)
22
+ @value=value
23
+ end
24
+
25
+ end
@@ -0,0 +1,39 @@
1
+
2
+ require 'cgi'
3
+
4
+ require 'foundation/FormParameter'
5
+
6
+ class FormParameters
7
+
8
+ def initialize
9
+ @parameterSet=Array.new()
10
+ end
11
+
12
+ def put(key, value)
13
+ fp=FormParameter.new(key, value)
14
+ @parameterSet[@parameterSet.length]=fp
15
+ end
16
+
17
+ def getParameterSet
18
+ @parameterSet
19
+ end
20
+
21
+ def encodeParameters
22
+ rv=""
23
+ i=0
24
+ for fp in @parameterSet
25
+ if (fp.getKey!=nil) && (fp.getValue!=nil)
26
+ if i>0
27
+ rv << "&"
28
+ end
29
+ rv << CGI::escape(fp.getKey.to_s)
30
+ rv << '='
31
+ rv << CGI::escape(fp.getValue.to_s)
32
+ i=i+1
33
+ end
34
+ end
35
+ return rv
36
+ end
37
+
38
+ end
39
+
@@ -0,0 +1,109 @@
1
+
2
+ require 'uri'
3
+ require 'net/http'
4
+ require 'cgi'
5
+ require 'response/HTTPResponse'
6
+
7
+ class JSONRequest
8
+
9
+ def initialized
10
+
11
+ end
12
+
13
+ def addQueryParameter(url, parameter, value)
14
+ if (parameter!=nil) && (value!=nil) then
15
+ if url.index('?')!=nil then
16
+ url << '&'
17
+ else
18
+ url << '?'
19
+ end
20
+ url << CGI::escape(parameter.to_s)
21
+ url << '='
22
+ url << CGI::escape(value.to_s)
23
+ end
24
+ return url
25
+ end
26
+
27
+ def get(url, responsetype, username, password)
28
+ uri=URI.parse(url)
29
+ req = Net::HTTP::Get.new(uri.request_uri)
30
+ if responsetype!=nil then
31
+ req["Accept"]="application/json"
32
+ end
33
+ req.basic_auth username, password
34
+ response=HTTPResponse.new()
35
+ begin
36
+ httpresponse = Net::HTTP.new(uri.host, uri.port).start { |http| http.request(req) }
37
+ response.setCode(httpresponse.code)
38
+ response.setContent(httpresponse.body)
39
+ response.setContentType(httpresponse.header['Content-Type'])
40
+ response.setLocation(httpresponse.header['Location'])
41
+ rescue => e
42
+ print 'exception handled'
43
+ end
44
+ return response
45
+ end
46
+
47
+ def post(url, postdata, responsetype, username, password)
48
+ uri=URI.parse(url)
49
+ req = Net::HTTP::Post.new(uri.request_uri)
50
+ if responsetype!=nil then
51
+ req["Accept"]="application/json"
52
+ end
53
+ req.basic_auth username, password
54
+ req.body=postdata
55
+ response=HTTPResponse.new()
56
+ begin
57
+ httpresponse = Net::HTTP.new(uri.host, uri.port).start { |http| http.request(req) }
58
+ response.setCode(httpresponse.code)
59
+ response.setContent(httpresponse.body)
60
+ response.setContentType(httpresponse.header['Content-Type'])
61
+ response.setLocation(httpresponse.header['Location'])
62
+ rescue => e
63
+ print 'exception handled'
64
+ end
65
+ return response
66
+ end
67
+
68
+ def postMultipart(url, postdata, responsetype, username, password, boundary)
69
+ uri=URI.parse(url)
70
+ req = Net::HTTP::Post.new(uri.request_uri)
71
+ if responsetype!=nil then
72
+ req["Accept"]="application/json"
73
+ end
74
+
75
+ req["Content-Type"]='multipart/mixed; boundary="'+boundary+'"';
76
+
77
+ req.basic_auth username, password
78
+ req.body=postdata
79
+ response=HTTPResponse.new()
80
+ begin
81
+ httpresponse = Net::HTTP.new(uri.host, uri.port).start { |http| http.request(req) }
82
+ response.setCode(httpresponse.code)
83
+ response.setContent(httpresponse.body)
84
+ response.setContentType(httpresponse.header['Content-Type'])
85
+ response.setLocation(httpresponse.header['Location'])
86
+ rescue => e
87
+ print 'exception handled'
88
+ end
89
+ return response
90
+ end
91
+
92
+ def delete(url, username, password)
93
+ uri=URI.parse(url)
94
+ req = Net::HTTP::Delete.new(uri.request_uri)
95
+ req.basic_auth username, password
96
+ response=HTTPResponse.new()
97
+ begin
98
+ httpresponse = Net::HTTP.new(uri.host, uri.port).start { |http| http.request(req) }
99
+ response.setCode(httpresponse.code)
100
+ response.setContent(httpresponse.body)
101
+ response.setContentType(httpresponse.header['Content-Type'])
102
+ response.setLocation(httpresponse.header['Location'])
103
+ rescue => e
104
+ print 'exception handled'
105
+ end
106
+ return response
107
+ end
108
+
109
+ end
@@ -0,0 +1,100 @@
1
+ require "response/location/CurrentLocation"
2
+ require "response/ServiceException"
3
+ require "response/PolicyException"
4
+ require "response/location/ErrorInformation"
5
+ require "response/location/TerminalLocation"
6
+ require "response/location/TerminalLocationList"
7
+ require "response/location/LocationResponse"
8
+ require 'json'
9
+ require 'uri'
10
+ require 'net/http'
11
+ require 'foundation/FormParameters'
12
+ require 'foundation/JSONRequest'
13
+
14
+ class Locate
15
+
16
+ def initialize(endpoints, username, password)
17
+ @endpoints=endpoints
18
+ @username=username
19
+ @password=password
20
+ end
21
+ def getEndpoints
22
+ @endpoints
23
+ end
24
+
25
+ def setEndpoints(endpoints)
26
+ @endpoints=endpoints
27
+ end
28
+
29
+ def getUsername
30
+ @username
31
+ end
32
+
33
+ def setUsername(username)
34
+ @username=username
35
+ end
36
+
37
+ def getPassword
38
+ @password
39
+ end
40
+
41
+ def setPassword(password)
42
+ @password=password
43
+ end
44
+
45
+
46
+ def locateTerminal(address,requestedAccuracy)
47
+ baseurl=@endpoints.getLocationEndpoint()
48
+ requestProcessor=JSONRequest.new()
49
+ baseurl=requestProcessor.addQueryParameter(baseurl,'address', address)
50
+ baseurl=requestProcessor.addQueryParameter(baseurl,'requestedAccuracy', requestedAccuracy)
51
+ rawresponse=requestProcessor.get(baseurl,'application/json', @username, @password)
52
+ response=LocationResponse.new()
53
+ if (rawresponse!=nil) && (rawresponse.getContent()!=nil)
54
+ jsondata=JSON.parse(rawresponse.getContent())
55
+ if (jsondata!=nil) && (jsondata['terminalLocationList']!=nil) then
56
+ response.setTerminalLocationListJSON(jsondata['terminalLocationList'])
57
+ end
58
+ end
59
+ if rawresponse.getCode()!=nil then
60
+ response.setHTTPResponseCode(rawresponse.getCode())
61
+ end
62
+ if rawresponse.getLocation()!=nil then
63
+ response.setLocation(rawresponse.getLocation())
64
+ end
65
+ if rawresponse.getContentType()!=nil then
66
+ response.setContentType(rawresponse.getContentType())
67
+ end
68
+ return response
69
+ end
70
+
71
+ def locateMultipleTerminals(address,requestedAccuracy)
72
+ baseurl=@endpoints.getLocationEndpoint()
73
+ requestProcessor=JSONRequest.new()
74
+ if address!=nil
75
+ for item in address
76
+ baseurl=requestProcessor.addQueryParameter(baseurl,'address',item)
77
+ end
78
+ end
79
+ baseurl=requestProcessor.addQueryParameter(baseurl,'requestedAccuracy', requestedAccuracy)
80
+ rawresponse=requestProcessor.get(baseurl,'application/json', @username, @password)
81
+ response=LocationResponse.new()
82
+ if (rawresponse!=nil) && (rawresponse.getContent()!=nil)
83
+ jsondata=JSON.parse(rawresponse.getContent())
84
+ if (jsondata!=nil) && (jsondata['terminalLocationList']!=nil) then
85
+ response.setTerminalLocationListJSON(jsondata['terminalLocationList'])
86
+ end
87
+ end
88
+ if rawresponse.getCode()!=nil then
89
+ response.setHTTPResponseCode(rawresponse.getCode())
90
+ end
91
+ if rawresponse.getLocation()!=nil then
92
+ response.setLocation(rawresponse.getLocation())
93
+ end
94
+ if rawresponse.getContentType()!=nil then
95
+ response.setContentType(rawresponse.getContentType())
96
+ end
97
+ return response
98
+ end
99
+
100
+ end