oneapi 0.0.1

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 (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
@@ -0,0 +1,295 @@
1
+ require "response/payment/AmountReservationTransaction"
2
+ require "response/payment/AmountReservationResponse"
3
+ require 'json'
4
+ require 'uri'
5
+ require 'net/http'
6
+ require 'foundation/FormParameters'
7
+ require 'foundation/JSONRequest'
8
+
9
+ class Reservation
10
+
11
+ def initialize(endpoints, username, password)
12
+ @endpoints=endpoints
13
+ @username=username
14
+ @password=password
15
+ end
16
+ def getEndpoints
17
+ @endpoints
18
+ end
19
+
20
+ def setEndpoints(endpoints)
21
+ @endpoints=endpoints
22
+ end
23
+
24
+ def getUsername
25
+ @username
26
+ end
27
+
28
+ def setUsername(username)
29
+ @username=username
30
+ end
31
+
32
+ def getPassword
33
+ @password
34
+ end
35
+
36
+ def setPassword(password)
37
+ @password=password
38
+ end
39
+
40
+
41
+ def reserveInitialAmount(endUserId,referenceCode,description,currency,amount,code,clientCorrelator,onBehalfOf,purchaseCategoryCode,channel,taxAmount,serviceId,productId)
42
+ baseurl=@endpoints.getAmountReserveEndpoint()
43
+ requestProcessor=JSONRequest.new()
44
+ formparameters=FormParameters.new()
45
+ formparameters.put('endUserId',endUserId)
46
+ if baseurl.index('{endUserId}')!=nil then
47
+ baseurl=baseurl.gsub('{endUserId}',CGI::escape(endUserId.to_s))
48
+ end
49
+ formparameters.put('referenceCode',referenceCode)
50
+ formparameters.put('description',description)
51
+ formparameters.put('currency',currency)
52
+ formparameters.put('amount',amount)
53
+ formparameters.put('code',code)
54
+ formparameters.put('clientCorrelator',clientCorrelator)
55
+ formparameters.put('onBehalfOf',onBehalfOf)
56
+ formparameters.put('purchaseCategoryCode',purchaseCategoryCode)
57
+ formparameters.put('channel',channel)
58
+ formparameters.put('taxAmount',taxAmount)
59
+ formparameters.put('serviceId',serviceId)
60
+ formparameters.put('productId',productId)
61
+ postdata=formparameters.encodeParameters()
62
+ rawresponse=requestProcessor.post(baseurl,postdata,'application/json', @username, @password)
63
+ response=AmountReservationResponse.new()
64
+ if (rawresponse!=nil) && (rawresponse.getContent()!=nil)
65
+ jsondata=JSON.parse(rawresponse.getContent())
66
+ if (jsondata!=nil) && (jsondata['amountReservationTransaction']!=nil) then
67
+ response.setAmountReservationTransactionJSON(jsondata['amountReservationTransaction'])
68
+ end
69
+ end
70
+ if rawresponse.getCode()!=nil then
71
+ response.setHTTPResponseCode(rawresponse.getCode())
72
+ end
73
+ if rawresponse.getLocation()!=nil then
74
+ response.setLocation(rawresponse.getLocation())
75
+ end
76
+ if rawresponse.getContentType()!=nil then
77
+ response.setContentType(rawresponse.getContentType())
78
+ end
79
+ return response
80
+ end
81
+
82
+ def reserveAdditionalAmount(endUserId,transactionId,referenceCode,description,currency,amount,referenceSequence,code,clientCorrelator,onBehalfOf,purchaseCategoryCode,channel,taxAmount,serviceId,productId)
83
+ baseurl=@endpoints.getAmountReserveAdditionalEndpoint()
84
+ requestProcessor=JSONRequest.new()
85
+ formparameters=FormParameters.new()
86
+ formparameters.put('endUserId',endUserId)
87
+ if baseurl.index('{endUserId}')!=nil then
88
+ baseurl=baseurl.gsub('{endUserId}',CGI::escape(endUserId.to_s))
89
+ end
90
+ formparameters.put('transactionId',transactionId)
91
+ if baseurl.index('{transactionId}')!=nil then
92
+ baseurl=baseurl.gsub('{transactionId}',CGI::escape(transactionId.to_s))
93
+ end
94
+ formparameters.put('referenceCode',referenceCode)
95
+ formparameters.put('description',description)
96
+ formparameters.put('currency',currency)
97
+ formparameters.put('amount',amount)
98
+ formparameters.put('referenceSequence',referenceSequence)
99
+ formparameters.put('code',code)
100
+ formparameters.put('clientCorrelator',clientCorrelator)
101
+ formparameters.put('onBehalfOf',onBehalfOf)
102
+ formparameters.put('purchaseCategoryCode',purchaseCategoryCode)
103
+ formparameters.put('channel',channel)
104
+ formparameters.put('taxAmount',taxAmount)
105
+ formparameters.put('serviceId',serviceId)
106
+ formparameters.put('productId',productId)
107
+ postdata=formparameters.encodeParameters()
108
+ rawresponse=requestProcessor.post(baseurl,postdata,'application/json', @username, @password)
109
+ response=AmountReservationResponse.new()
110
+ if (rawresponse!=nil) && (rawresponse.getContent()!=nil)
111
+ jsondata=JSON.parse(rawresponse.getContent())
112
+ if (jsondata!=nil) && (jsondata['amountReservationTransaction']!=nil) then
113
+ response.setAmountReservationTransactionJSON(jsondata['amountReservationTransaction'])
114
+ end
115
+ end
116
+ if rawresponse.getCode()!=nil then
117
+ response.setHTTPResponseCode(rawresponse.getCode())
118
+ end
119
+ if rawresponse.getLocation()!=nil then
120
+ response.setLocation(rawresponse.getLocation())
121
+ end
122
+ if rawresponse.getContentType()!=nil then
123
+ response.setContentType(rawresponse.getContentType())
124
+ end
125
+ return response
126
+ end
127
+
128
+ def reserveAdditionalAmountSimple(endUserId,transactionId,referenceCode,description,currency,amount,referenceSequence,code)
129
+ baseurl=@endpoints.getAmountReserveAdditionalEndpoint()
130
+ requestProcessor=JSONRequest.new()
131
+ formparameters=FormParameters.new()
132
+ formparameters.put('endUserId',endUserId)
133
+ if baseurl.index('{endUserId}')!=nil then
134
+ baseurl=baseurl.gsub('{endUserId}',CGI::escape(endUserId.to_s))
135
+ end
136
+ formparameters.put('transactionId',transactionId)
137
+ if baseurl.index('{transactionId}')!=nil then
138
+ baseurl=baseurl.gsub('{transactionId}',CGI::escape(transactionId.to_s))
139
+ end
140
+ formparameters.put('referenceCode',referenceCode)
141
+ formparameters.put('description',description)
142
+ formparameters.put('currency',currency)
143
+ formparameters.put('amount',amount)
144
+ formparameters.put('referenceSequence',referenceSequence)
145
+ formparameters.put('code',code)
146
+ postdata=formparameters.encodeParameters()
147
+ rawresponse=requestProcessor.post(baseurl,postdata,'application/json', @username, @password)
148
+ response=AmountReservationResponse.new()
149
+ if (rawresponse!=nil) && (rawresponse.getContent()!=nil)
150
+ jsondata=JSON.parse(rawresponse.getContent())
151
+ if (jsondata!=nil) && (jsondata['amountReservationTransaction']!=nil) then
152
+ response.setAmountReservationTransactionJSON(jsondata['amountReservationTransaction'])
153
+ end
154
+ end
155
+ if rawresponse.getCode()!=nil then
156
+ response.setHTTPResponseCode(rawresponse.getCode())
157
+ end
158
+ if rawresponse.getLocation()!=nil then
159
+ response.setLocation(rawresponse.getLocation())
160
+ end
161
+ if rawresponse.getContentType()!=nil then
162
+ response.setContentType(rawresponse.getContentType())
163
+ end
164
+ return response
165
+ end
166
+
167
+ def chargeAmount(endUserId,transactionId,referenceCode,description,currency,amount,referenceSequence,code,clientCorrelator,onBehalfOf,purchaseCategoryCode,channel,taxAmount,serviceId,productId)
168
+ baseurl=@endpoints.getAmountReservationChargeEndpoint()
169
+ requestProcessor=JSONRequest.new()
170
+ formparameters=FormParameters.new()
171
+ formparameters.put('endUserId',endUserId)
172
+ if baseurl.index('{endUserId}')!=nil then
173
+ baseurl=baseurl.gsub('{endUserId}',CGI::escape(endUserId.to_s))
174
+ end
175
+ formparameters.put('transactionId',transactionId)
176
+ if baseurl.index('{transactionId}')!=nil then
177
+ baseurl=baseurl.gsub('{transactionId}',CGI::escape(transactionId.to_s))
178
+ end
179
+ formparameters.put('referenceCode',referenceCode)
180
+ formparameters.put('description',description)
181
+ formparameters.put('currency',currency)
182
+ formparameters.put('amount',amount)
183
+ formparameters.put('referenceSequence',referenceSequence)
184
+ formparameters.put('code',code)
185
+ formparameters.put('clientCorrelator',clientCorrelator)
186
+ formparameters.put('onBehalfOf',onBehalfOf)
187
+ formparameters.put('purchaseCategoryCode',purchaseCategoryCode)
188
+ formparameters.put('channel',channel)
189
+ formparameters.put('taxAmount',taxAmount)
190
+ formparameters.put('serviceId',serviceId)
191
+ formparameters.put('productId',productId)
192
+ postdata=formparameters.encodeParameters()
193
+ rawresponse=requestProcessor.post(baseurl,postdata,'application/json', @username, @password)
194
+ response=AmountReservationResponse.new()
195
+ if (rawresponse!=nil) && (rawresponse.getContent()!=nil)
196
+ jsondata=JSON.parse(rawresponse.getContent())
197
+ if (jsondata!=nil) && (jsondata['amountReservationTransaction']!=nil) then
198
+ response.setAmountReservationTransactionJSON(jsondata['amountReservationTransaction'])
199
+ end
200
+ end
201
+ if rawresponse.getCode()!=nil then
202
+ response.setHTTPResponseCode(rawresponse.getCode())
203
+ end
204
+ if rawresponse.getLocation()!=nil then
205
+ response.setLocation(rawresponse.getLocation())
206
+ end
207
+ if rawresponse.getContentType()!=nil then
208
+ response.setContentType(rawresponse.getContentType())
209
+ end
210
+ return response
211
+ end
212
+
213
+ def chargeAmountWithCallback(endUserId,transactionId,referenceCode,description,currency,amount,referenceSequence,code,callbackURL,clientCorrelator,onBehalfOf,purchaseCategoryCode,channel,taxAmount,serviceId,productId)
214
+ baseurl=@endpoints.getAmountReservationChargeEndpoint()
215
+ requestProcessor=JSONRequest.new()
216
+ formparameters=FormParameters.new()
217
+ formparameters.put('endUserId',endUserId)
218
+ if baseurl.index('{endUserId}')!=nil then
219
+ baseurl=baseurl.gsub('{endUserId}',CGI::escape(endUserId.to_s))
220
+ end
221
+ formparameters.put('transactionId',transactionId)
222
+ if baseurl.index('{transactionId}')!=nil then
223
+ baseurl=baseurl.gsub('{transactionId}',CGI::escape(transactionId.to_s))
224
+ end
225
+ formparameters.put('referenceCode',referenceCode)
226
+ formparameters.put('description',description)
227
+ formparameters.put('currency',currency)
228
+ formparameters.put('amount',amount)
229
+ formparameters.put('referenceSequence',referenceSequence)
230
+ formparameters.put('code',code)
231
+ formparameters.put('callbackURL',callbackURL)
232
+ formparameters.put('clientCorrelator',clientCorrelator)
233
+ formparameters.put('onBehalfOf',onBehalfOf)
234
+ formparameters.put('purchaseCategoryCode',purchaseCategoryCode)
235
+ formparameters.put('channel',channel)
236
+ formparameters.put('taxAmount',taxAmount)
237
+ formparameters.put('serviceId',serviceId)
238
+ formparameters.put('productId',productId)
239
+ postdata=formparameters.encodeParameters()
240
+ rawresponse=requestProcessor.post(baseurl,postdata,'application/json', @username, @password)
241
+ response=AmountReservationResponse.new()
242
+ if (rawresponse!=nil) && (rawresponse.getContent()!=nil)
243
+ jsondata=JSON.parse(rawresponse.getContent())
244
+ if (jsondata!=nil) && (jsondata['amountReservationTransaction']!=nil) then
245
+ response.setAmountReservationTransactionJSON(jsondata['amountReservationTransaction'])
246
+ end
247
+ end
248
+ if rawresponse.getCode()!=nil then
249
+ response.setHTTPResponseCode(rawresponse.getCode())
250
+ end
251
+ if rawresponse.getLocation()!=nil then
252
+ response.setLocation(rawresponse.getLocation())
253
+ end
254
+ if rawresponse.getContentType()!=nil then
255
+ response.setContentType(rawresponse.getContentType())
256
+ end
257
+ return response
258
+ end
259
+
260
+ def releaseReservation(endUserId,transactionId,referenceCode,referenceSequence)
261
+ baseurl=@endpoints.getAmountReservationReleaseEndpoint()
262
+ requestProcessor=JSONRequest.new()
263
+ formparameters=FormParameters.new()
264
+ formparameters.put('endUserId',endUserId)
265
+ if baseurl.index('{endUserId}')!=nil then
266
+ baseurl=baseurl.gsub('{endUserId}',CGI::escape(endUserId.to_s))
267
+ end
268
+ formparameters.put('transactionId',transactionId)
269
+ if baseurl.index('{transactionId}')!=nil then
270
+ baseurl=baseurl.gsub('{transactionId}',CGI::escape(transactionId.to_s))
271
+ end
272
+ formparameters.put('referenceCode',referenceCode)
273
+ formparameters.put('referenceSequence',referenceSequence)
274
+ postdata=formparameters.encodeParameters()
275
+ rawresponse=requestProcessor.post(baseurl,postdata,'application/json', @username, @password)
276
+ response=AmountReservationResponse.new()
277
+ if (rawresponse!=nil) && (rawresponse.getContent()!=nil)
278
+ jsondata=JSON.parse(rawresponse.getContent())
279
+ if (jsondata!=nil) && (jsondata['amountReservationTransaction']!=nil) then
280
+ response.setAmountReservationTransactionJSON(jsondata['amountReservationTransaction'])
281
+ end
282
+ end
283
+ if rawresponse.getCode()!=nil then
284
+ response.setHTTPResponseCode(rawresponse.getCode())
285
+ end
286
+ if rawresponse.getLocation()!=nil then
287
+ response.setLocation(rawresponse.getLocation())
288
+ end
289
+ if rawresponse.getContentType()!=nil then
290
+ response.setContentType(rawresponse.getContentType())
291
+ end
292
+ return response
293
+ end
294
+
295
+ end
@@ -0,0 +1,50 @@
1
+
2
+ class Attachment
3
+
4
+ def initialize
5
+ @name=nil
6
+ @contentType=nil
7
+ @data=nil
8
+ end
9
+
10
+ def initializeJSON(jsondict)
11
+ @name=nil
12
+ if (jsondict!=nil) && (jsondict.has_key?'name') && (jsondict['name']!=nil)
13
+ @name=jsondict['name']
14
+ end
15
+ @contentType=nil
16
+ if (jsondict!=nil) && (jsondict.has_key?'contentType') && (jsondict['contentType']!=nil)
17
+ @contentType=jsondict['contentType']
18
+ end
19
+ @data=nil
20
+ if (jsondict!=nil) && (jsondict.has_key?'data') && (jsondict['data']!=nil)
21
+ @data=jsondict['data']
22
+ end
23
+ end
24
+
25
+ def getName
26
+ @name
27
+ end
28
+
29
+ def setName(name)
30
+ @name=name
31
+ end
32
+
33
+ def getContentType
34
+ @contentType
35
+ end
36
+
37
+ def setContentType(contentType)
38
+ @contentType=contentType
39
+ end
40
+
41
+ def getData
42
+ @data
43
+ end
44
+
45
+ def setData(data)
46
+ @data=data
47
+ end
48
+
49
+
50
+ end
@@ -0,0 +1,63 @@
1
+
2
+ class HTTPResponse
3
+
4
+ def initialize
5
+ @code=0
6
+ @content=nil
7
+ @contentType=nil
8
+ @location=nil
9
+ end
10
+
11
+ def initializeJSON(jsondict)
12
+ @code=0
13
+ if (jsondict!=nil) && (jsondict.has_key?'code') && (jsondict['code']!=nil)
14
+ @code=jsondict['code'].to_i
15
+ end
16
+ @content=nil
17
+ if (jsondict!=nil) && (jsondict.has_key?'content') && (jsondict['content']!=nil)
18
+ @content=jsondict['content']
19
+ end
20
+ @contentType=nil
21
+ if (jsondict!=nil) && (jsondict.has_key?'contentType') && (jsondict['contentType']!=nil)
22
+ @contentType=jsondict['contentType']
23
+ end
24
+ @location=nil
25
+ if (jsondict!=nil) && (jsondict.has_key?'location') && (jsondict['location']!=nil)
26
+ @location=jsondict['location']
27
+ end
28
+ end
29
+
30
+ def getCode
31
+ @code
32
+ end
33
+
34
+ def setCode(code)
35
+ @code=code
36
+ end
37
+
38
+ def getContent
39
+ @content
40
+ end
41
+
42
+ def setContent(content)
43
+ @content=content
44
+ end
45
+
46
+ def getContentType
47
+ @contentType
48
+ end
49
+
50
+ def setContentType(contentType)
51
+ @contentType=contentType
52
+ end
53
+
54
+ def getLocation
55
+ @location
56
+ end
57
+
58
+ def setLocation(location)
59
+ @location=location
60
+ end
61
+
62
+
63
+ end
@@ -0,0 +1,58 @@
1
+
2
+ class PolicyException
3
+
4
+ def initialize
5
+ @messageId=nil
6
+ @text=nil
7
+ @variables=nil
8
+ end
9
+
10
+ def initializeJSON(jsondict)
11
+ @messageId=nil
12
+ if (jsondict!=nil) && (jsondict.has_key?'messageId') && (jsondict['messageId']!=nil)
13
+ @messageId=jsondict['messageId']
14
+ end
15
+ @text=nil
16
+ if (jsondict!=nil) && (jsondict.has_key?'text') && (jsondict['text']!=nil)
17
+ @text=jsondict['text']
18
+ end
19
+ @variables=nil
20
+ if (jsondict!=nil) && (jsondict.has_key?'variables') && (jsondict['variables']!=nil)
21
+ @variables=Array.new()
22
+ fieldValue=jsondict['variables']
23
+ if fieldValue.kind_of?Array
24
+ for item in fieldValue
25
+ @variables[variables.length]=item
26
+ end
27
+ else
28
+ @variables[0]=fieldValue
29
+ end
30
+ end
31
+ end
32
+
33
+ def getMessageId
34
+ @messageId
35
+ end
36
+
37
+ def setMessageId(messageId)
38
+ @messageId=messageId
39
+ end
40
+
41
+ def getText
42
+ @text
43
+ end
44
+
45
+ def setText(text)
46
+ @text=text
47
+ end
48
+
49
+ def getVariables
50
+ @variables
51
+ end
52
+
53
+ def setVariables(variables)
54
+ @variables=variables
55
+ end
56
+
57
+
58
+ end