gotransverse-tract-api 0.4.3 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gotransverse-tract-api/billing_account/billing_account.rb +71 -59
- data/lib/gotransverse-tract-api/billing_account/counter.rb +37 -2
- data/lib/gotransverse-tract-api/general_ledger/gl_aggregate_batch.rb +9 -1
- data/lib/gotransverse-tract-api/general_ledger/gl_transaction_batch.rb +6 -1
- data/lib/gotransverse-tract-api/order/people.rb +10 -1
- data/lib/gotransverse-tract-api/service/service.rb +143 -135
- data/lib/gotransverse-tract-api/service/service_resource.rb +39 -30
- data/lib/gotransverse-tract-api/usage/usage_event.rb +28 -14
- data/lib/gotransverse-tract-api/version.rb +1 -1
- data/lib/gotransverse-tract-api.rb +4 -3
- data/spec/gotransverse-tract-api/billing_account/billing_account_spec.rb +50 -34
- data/spec/gotransverse-tract-api/billing_account/counter_spec.rb +21 -0
- data/spec/gotransverse-tract-api/general_ledger/gl_aggregate_batch_spec.rb +21 -0
- data/spec/gotransverse-tract-api/general_ledger/gl_transaction_batch_spec.rb +21 -0
- data/spec/gotransverse-tract-api/order/people_spec.rb +12 -0
- data/spec/gotransverse-tract-api/product/product_price_spec.rb +23 -0
- data/spec/gotransverse-tract-api/product/product_spec.rb +3 -3
- data/spec/gotransverse-tract-api/service/service_resource_spec.rb +9 -0
- data/spec/gotransverse-tract-api/service/service_spec.rb +10 -1
- data/spec/gotransverse-tract-api/usage/usage_event_spec.rb +2 -2
- metadata +10 -2
@@ -82,8 +82,8 @@ module GoTransverseTractApi
|
|
82
82
|
#
|
83
83
|
def resume eid, service
|
84
84
|
data = {
|
85
|
-
:
|
86
|
-
:
|
85
|
+
resumeService: {},
|
86
|
+
service: {eid: eid}
|
87
87
|
}
|
88
88
|
|
89
89
|
xml_data = GoTransverseTractApi.generateXML(data, 'resumeService')
|
@@ -96,8 +96,8 @@ module GoTransverseTractApi
|
|
96
96
|
#
|
97
97
|
def suspend eid, service
|
98
98
|
data = {
|
99
|
-
:
|
100
|
-
:
|
99
|
+
suspendService: {},
|
100
|
+
service: {eid: eid}
|
101
101
|
}
|
102
102
|
|
103
103
|
xml_data = GoTransverseTractApi.generateXML(data, 'suspendService')
|
@@ -110,13 +110,13 @@ module GoTransverseTractApi
|
|
110
110
|
#
|
111
111
|
def add_service_resource eid, service
|
112
112
|
data = {
|
113
|
-
:
|
114
|
-
:
|
115
|
-
:
|
116
|
-
:
|
117
|
-
:
|
113
|
+
addServiceResourceToService: {},
|
114
|
+
service: {eid: eid},
|
115
|
+
serviceResource: {
|
116
|
+
attributes: {
|
117
|
+
identifier: service[:service_resource][:identifier]
|
118
118
|
},
|
119
|
-
:
|
119
|
+
category: {
|
120
120
|
eid: :service[:service_resource][:category][:eid]
|
121
121
|
}
|
122
122
|
}
|
@@ -132,9 +132,9 @@ module GoTransverseTractApi
|
|
132
132
|
#
|
133
133
|
def remove_service_resource eid, service
|
134
134
|
data = {
|
135
|
-
:
|
136
|
-
:
|
137
|
-
:
|
135
|
+
removeServiceResourceFromService: {},
|
136
|
+
service: {eid: eid},
|
137
|
+
serviceResource: {eid: service[:service_resource][:eid]}
|
138
138
|
}
|
139
139
|
|
140
140
|
xml_data = GoTransverseTractApi.generateXML(data, 'removeServiceResourceFromService')
|
@@ -147,31 +147,31 @@ module GoTransverseTractApi
|
|
147
147
|
#
|
148
148
|
def add_service_usage_rule_to_service eid, service
|
149
149
|
data = {
|
150
|
-
:
|
151
|
-
:
|
152
|
-
:
|
153
|
-
:
|
154
|
-
:
|
155
|
-
:
|
156
|
-
:
|
157
|
-
:
|
158
|
-
:
|
159
|
-
:
|
160
|
-
:
|
161
|
-
:
|
162
|
-
:
|
163
|
-
:
|
164
|
-
:
|
165
|
-
:
|
150
|
+
addServiceUsageRuleToService: {},
|
151
|
+
service: {eid: eid},
|
152
|
+
matchAllServiceUsageRule: {
|
153
|
+
attributes: {
|
154
|
+
limit: service[:match_all_service_usage_rule][:limit],
|
155
|
+
usageUom: service[:match_all_service_usage_rule][:usage_uom],
|
156
|
+
name: service[:match_all_service_usage_rule][:name],
|
157
|
+
order: service[:match_all_service_usage_rule][:order],
|
158
|
+
proratedOnOrder: service[:match_all_service_usage_rule][:prorated_on_order],
|
159
|
+
proratedOnCancel: service[:match_all_service_usage_rule][:prorated_on_cancel],
|
160
|
+
rollOverType: service[:match_all_service_usage_rule][:roll_over_type],
|
161
|
+
allowanceType: service[:match_all_service_usage_rule][:allowance_type],
|
162
|
+
validFrom: service[:match_all_service_usage_rule][:valid_from],
|
163
|
+
validTo: service[:match_all_service_usage_rule][:valid_to],
|
164
|
+
ruleType: service[:match_all_service_usage_rule][:rule_type],
|
165
|
+
status: service[:match_all_service_usage_rule][:status]
|
166
166
|
},
|
167
|
-
:
|
167
|
+
chargeCategory: {
|
168
168
|
eid: service[:match_all_service_usage_rule][:charge_categroy][:eid]
|
169
169
|
},
|
170
|
-
:
|
171
|
-
:
|
172
|
-
:
|
173
|
-
:
|
174
|
-
:
|
170
|
+
flatUsageRate: {
|
171
|
+
uom: service[:match_all_service_usage_rule][:flat_usage_rate][:uom],
|
172
|
+
validFrom: service[:match_all_service_usage_rule][:flat_usage_rate][:valid_from],
|
173
|
+
validTo: service[:match_all_service_usage_rule][:flat_usage_rate][:valid_to],
|
174
|
+
rate: service[:match_all_service_usage_rule][:flat_usage_rate][:rate]
|
175
175
|
}
|
176
176
|
}
|
177
177
|
}
|
@@ -186,9 +186,9 @@ module GoTransverseTractApi
|
|
186
186
|
#
|
187
187
|
def remove_service_usage_rule_from_service eid, service
|
188
188
|
data = {
|
189
|
-
:
|
190
|
-
:
|
191
|
-
:
|
189
|
+
removeServiceUsageRuleFromService: {},
|
190
|
+
service: {eid: eid},
|
191
|
+
matchAllServiceUsageRule: {
|
192
192
|
eid: service[:match_all_service_usage_rule][:eid]
|
193
193
|
}
|
194
194
|
}
|
@@ -202,15 +202,15 @@ module GoTransverseTractApi
|
|
202
202
|
#
|
203
203
|
def add_agreement eid, service
|
204
204
|
data = {
|
205
|
-
:
|
206
|
-
:
|
207
|
-
:
|
208
|
-
:
|
209
|
-
:
|
210
|
-
:
|
211
|
-
:
|
205
|
+
addAgreementToService: {},
|
206
|
+
service: {eid: eid},
|
207
|
+
agreementService: {
|
208
|
+
attributes: {
|
209
|
+
endAction: service[:agreement_service][:end_action],
|
210
|
+
endDate: service[:agreement_service][:end_date],
|
211
|
+
startDate: service[:agreement_service][:start_date]
|
212
212
|
},
|
213
|
-
:
|
213
|
+
agreement: {
|
214
214
|
eid: service[:agreement_service][:agreement][:eid]
|
215
215
|
}
|
216
216
|
}
|
@@ -226,18 +226,18 @@ module GoTransverseTractApi
|
|
226
226
|
#
|
227
227
|
def add_counter eid, service
|
228
228
|
data = {
|
229
|
-
:
|
230
|
-
:
|
231
|
-
:
|
232
|
-
:
|
233
|
-
:
|
234
|
-
:
|
235
|
-
:
|
236
|
-
:
|
237
|
-
:
|
238
|
-
:
|
229
|
+
addCounterToService: {},
|
230
|
+
service: {eid: eid},
|
231
|
+
usageRuleCounter: {
|
232
|
+
attributes: {
|
233
|
+
name: service[:usage_rule_counter][:name],
|
234
|
+
description: service[:usage_rule_counter][:description],
|
235
|
+
status: service[:usage_rule_counter][:status],
|
236
|
+
entityRelationType: service[:usage_rule_counter][:entity_relation_type],
|
237
|
+
uom: service[:usage_rule_counter][:uom],
|
238
|
+
threshold: service[:usage_rule_counter][:threshold]
|
239
239
|
},
|
240
|
-
:
|
240
|
+
servicePeriodCounterResetCriteria: {}
|
241
241
|
}
|
242
242
|
}
|
243
243
|
|
@@ -251,13 +251,13 @@ module GoTransverseTractApi
|
|
251
251
|
#
|
252
252
|
def add_custom_field_value eid, service
|
253
253
|
data = {
|
254
|
-
:
|
255
|
-
:
|
256
|
-
:
|
257
|
-
:
|
258
|
-
:
|
254
|
+
addCustomFieldValueToService: {},
|
255
|
+
service: {eid: eid},
|
256
|
+
customFieldValue: {
|
257
|
+
attributes: {
|
258
|
+
value: service[:custom_field_value][:value]
|
259
259
|
},
|
260
|
-
:
|
260
|
+
customField: {
|
261
261
|
eid: service[:custom_field_value][:custom_field][:eid]
|
262
262
|
}
|
263
263
|
}
|
@@ -273,9 +273,9 @@ module GoTransverseTractApi
|
|
273
273
|
#
|
274
274
|
def remove_custom_field_value eid, service
|
275
275
|
data = {
|
276
|
-
:
|
277
|
-
:
|
278
|
-
:
|
276
|
+
removeCustomFieldValueFromService: {},
|
277
|
+
service: {eid: eid},
|
278
|
+
customFieldValue: {
|
279
279
|
eid: service[:custom_field_value][:eid]
|
280
280
|
}
|
281
281
|
}
|
@@ -292,44 +292,44 @@ module GoTransverseTractApi
|
|
292
292
|
api_data = GoTransverseTractApi::ApiData.new
|
293
293
|
|
294
294
|
data = {
|
295
|
-
:
|
296
|
-
:
|
297
|
-
:
|
298
|
-
:
|
299
|
-
:
|
300
|
-
:
|
301
|
-
:
|
302
|
-
:
|
295
|
+
addDiscountIdentifierToService: {},
|
296
|
+
service: {
|
297
|
+
attributes: {
|
298
|
+
amount: service[:amount],
|
299
|
+
startDate: service[:start_date],
|
300
|
+
status: service[:status],
|
301
|
+
description: service[:description],
|
302
|
+
renewalCount: service[:renewal_count],
|
303
303
|
eid: service[:eid],
|
304
|
-
:
|
304
|
+
queryScope: service[:query_scope]
|
305
305
|
},
|
306
|
-
:
|
306
|
+
billingAccount: {
|
307
307
|
eid: service[:billing_account][:eid],
|
308
|
-
:
|
308
|
+
queryScope: service[:billing_account][:query_scope]
|
309
309
|
},
|
310
|
-
:
|
311
|
-
:
|
310
|
+
serviceResources: GoTransverseTractApi::ApiData.new.get_page_info(service[:service_resources]),
|
311
|
+
product: {
|
312
312
|
eid: service[:product][:eid],
|
313
|
-
:
|
313
|
+
queryScope: service[:product][:query_scope]
|
314
314
|
},
|
315
|
-
:
|
316
|
-
:
|
317
|
-
:
|
318
|
-
:
|
319
|
-
:
|
315
|
+
servicePeriods: api_data.get_page_info(service[:service_periods]),
|
316
|
+
servicePrices: api_data.get_page_info(service[:service_prices]),
|
317
|
+
serviceUsageRules: api_data.get_page_info(service[:service_usage_rules]),
|
318
|
+
counters: api_data.get_page_info(service[:counters]),
|
319
|
+
customFieldValues: api_data.get_page_info(service[:custom_field_values])
|
320
320
|
},
|
321
|
-
:
|
322
|
-
:
|
323
|
-
:
|
324
|
-
:
|
325
|
-
:
|
326
|
-
:
|
321
|
+
discountIdentifier: {
|
322
|
+
attributes: {
|
323
|
+
status: service[:discount_identifier][:status],
|
324
|
+
unlimited: service[:discount_identifier][:unlimited],
|
325
|
+
uses: service[:discount_identifier][:uses],
|
326
|
+
identifier: service[:discount_identifier][:identifier],
|
327
327
|
eid: service[:discount_identifier][:eid],
|
328
|
-
:
|
328
|
+
queryScope: service[:discount_identifier][:query_scope]
|
329
329
|
},
|
330
|
-
:
|
330
|
+
category: {
|
331
331
|
eid: service[:discount_identifier][:category][:eid],
|
332
|
-
:
|
332
|
+
queryScope: service[:discount_identifier][:category][:query_scope]
|
333
333
|
}
|
334
334
|
}
|
335
335
|
}
|
@@ -344,11 +344,11 @@ module GoTransverseTractApi
|
|
344
344
|
#
|
345
345
|
def change_price eid, service
|
346
346
|
data = {
|
347
|
-
:
|
348
|
-
:
|
349
|
-
:
|
347
|
+
changeServicePrice: {
|
348
|
+
attributes: {
|
349
|
+
newRecurringUnitPrice: service[:new_recurring_unit_price]
|
350
350
|
},
|
351
|
-
:
|
351
|
+
service: {eid: eid}
|
352
352
|
}
|
353
353
|
}
|
354
354
|
|
@@ -362,12 +362,12 @@ module GoTransverseTractApi
|
|
362
362
|
#
|
363
363
|
def change_quantity eid, service
|
364
364
|
data = {
|
365
|
-
:
|
366
|
-
:
|
367
|
-
:
|
368
|
-
:
|
365
|
+
changeServiceQuantity: {
|
366
|
+
attributes: {
|
367
|
+
newQuantity: service[:new_quantity],
|
368
|
+
effectiveDate: service[:effective_date]
|
369
369
|
},
|
370
|
-
:
|
370
|
+
service: {eid: eid}
|
371
371
|
}
|
372
372
|
}
|
373
373
|
|
@@ -381,46 +381,46 @@ module GoTransverseTractApi
|
|
381
381
|
#
|
382
382
|
def renew eid, service
|
383
383
|
data = {
|
384
|
-
:
|
385
|
-
:
|
386
|
-
:
|
387
|
-
:
|
384
|
+
renewService: {},
|
385
|
+
service: {
|
386
|
+
attributes: {eid: eid},
|
387
|
+
billingAccount: {
|
388
388
|
eid: service[:billing_account][:eid]
|
389
389
|
}
|
390
390
|
},
|
391
|
-
:
|
392
|
-
:
|
393
|
-
:
|
394
|
-
:
|
395
|
-
:
|
396
|
-
:
|
397
|
-
:
|
398
|
-
:
|
391
|
+
order: {
|
392
|
+
attributes: {},
|
393
|
+
orderItems: {
|
394
|
+
attributes: {},
|
395
|
+
orderItem: {
|
396
|
+
attributes: {
|
397
|
+
quantity: service[:order][:order_items][:order_item][:quantity],
|
398
|
+
sequence: service[:order][:order_items][:order_item][:sequence]
|
399
399
|
},
|
400
|
-
:
|
400
|
+
product: {
|
401
401
|
eid: service[:order][:order_items][:order_item][:product][:eid]
|
402
402
|
},
|
403
|
-
:
|
403
|
+
selectedAgreement: {
|
404
404
|
eid: service[:order][:order_items][:order_item][:selected_agreement][:eid]
|
405
405
|
}
|
406
406
|
}
|
407
407
|
},
|
408
|
-
:
|
409
|
-
:
|
410
|
-
:
|
411
|
-
:
|
412
|
-
:
|
413
|
-
:
|
414
|
-
:
|
408
|
+
billingAccount: { eid: service[:order][:billing_account][:eid] },
|
409
|
+
payments: {
|
410
|
+
attributes: {},
|
411
|
+
payment: {
|
412
|
+
attributes: {
|
413
|
+
amount: service[:order][:payments][:payment][:amount],
|
414
|
+
description: service[:order][:payments][:payment][:description]
|
415
415
|
},
|
416
|
-
:
|
417
|
-
:
|
418
|
-
:
|
419
|
-
:
|
420
|
-
:
|
421
|
-
:
|
422
|
-
:
|
423
|
-
:
|
416
|
+
billingAccount: { eid: service[:order][:payments][:payment][:billing_account][:eid] },
|
417
|
+
creditCardPayment: {
|
418
|
+
cardType: service[:order][:payments][:payment][:credit_card_payment][:card_type],
|
419
|
+
cardHolderFirstName: service[:order][:payments][:payment][:credit_card_payment][:card_holder_first_name],
|
420
|
+
cardHolderMiddleName: service[:order][:payments][:payment][:credit_card_payment][:card_holder_middle_name],
|
421
|
+
cardHolderLastName: service[:order][:payments][:payment][:credit_card_payment][:card_holder_last_name],
|
422
|
+
cardIdentifierNumber: service[:order][:payments][:payment][:credit_card_payment][:card_identifier_number],
|
423
|
+
cardExpiration: service[:order][:payments][:payment][:credit_card_payment][:card_expiration]
|
424
424
|
}
|
425
425
|
}
|
426
426
|
}
|
@@ -437,8 +437,8 @@ module GoTransverseTractApi
|
|
437
437
|
#
|
438
438
|
def deactivate eid, service
|
439
439
|
data = {
|
440
|
-
:
|
441
|
-
:
|
440
|
+
deactivateService: {},
|
441
|
+
service: {eid: eid}
|
442
442
|
}
|
443
443
|
|
444
444
|
xml_data = GoTransverseTractApi.generateXML(data, 'deactivateService')
|
@@ -450,7 +450,15 @@ module GoTransverseTractApi
|
|
450
450
|
# @param {Hash} service
|
451
451
|
#
|
452
452
|
def update eid, service
|
453
|
-
|
453
|
+
data = {
|
454
|
+
service: {
|
455
|
+
eid: eid,
|
456
|
+
description: service[:description]
|
457
|
+
}
|
458
|
+
}
|
459
|
+
|
460
|
+
xml_data = GoTransverseTractApi.generateXML(data, 'service')
|
461
|
+
GoTransverseTractApi.put_request_for(self, {eid: eid}, xml_data)
|
454
462
|
end
|
455
463
|
|
456
464
|
end
|
@@ -60,12 +60,12 @@ module GoTransverseTractApi
|
|
60
60
|
#
|
61
61
|
def request service_resource
|
62
62
|
data = {
|
63
|
-
:
|
64
|
-
:
|
65
|
-
:
|
66
|
-
:
|
63
|
+
requestServiceResource: {
|
64
|
+
identifier: service_resource[:identifier],
|
65
|
+
status: service_resource[:status],
|
66
|
+
description: service_resource[:description]
|
67
67
|
},
|
68
|
-
:
|
68
|
+
serviceResourceCategory: {eid: service_resource[:service_resource_category][:eid]}
|
69
69
|
}
|
70
70
|
xml_data = GoTransverseTractApi.generateXML(data, 'requestServiceResource')
|
71
71
|
GoTransverseTractApi.post_request_for(self, {}, xml_data, "request")
|
@@ -77,15 +77,15 @@ module GoTransverseTractApi
|
|
77
77
|
#
|
78
78
|
def change eid, service_resource
|
79
79
|
data = {
|
80
|
-
:
|
81
|
-
:
|
82
|
-
:
|
83
|
-
:
|
84
|
-
:
|
85
|
-
:
|
86
|
-
:
|
80
|
+
changeServiceResource: {},
|
81
|
+
serviceResource: {eid: eid},
|
82
|
+
changeToServiceResource: {
|
83
|
+
attributes: {
|
84
|
+
identifier: service_resource[:change_to_service_resource][:identifier],
|
85
|
+
status: service_resource[:change_to_service_resource][:status],
|
86
|
+
description: service_resource[:change_to_service_resource][:description]
|
87
87
|
},
|
88
|
-
:
|
88
|
+
category: {eid: service_resource[:category][:eid]}
|
89
89
|
}
|
90
90
|
}
|
91
91
|
|
@@ -99,8 +99,8 @@ module GoTransverseTractApi
|
|
99
99
|
#
|
100
100
|
def deactivate eid, service_resource
|
101
101
|
data = {
|
102
|
-
:
|
103
|
-
:
|
102
|
+
deactivateServiceResource: {},
|
103
|
+
serviceResource: {eid: eid}
|
104
104
|
}
|
105
105
|
|
106
106
|
xml_data = GoTransverseTractApi.generateXML(data, 'deactivateServiceResource')
|
@@ -112,12 +112,12 @@ module GoTransverseTractApi
|
|
112
112
|
#
|
113
113
|
def create_service_resource service_resource
|
114
114
|
data = {
|
115
|
-
:
|
116
|
-
:
|
117
|
-
:
|
118
|
-
:
|
115
|
+
serviceResource: {
|
116
|
+
identifier: service_resource[:identifier],
|
117
|
+
status: service_resource[:status],
|
118
|
+
description: service_resource[:description]
|
119
119
|
},
|
120
|
-
:
|
120
|
+
category: {eid: service_resource[:category][:eid]}
|
121
121
|
}
|
122
122
|
|
123
123
|
xml_data = GoTransverseTractApi.generateXML(data, 'serviceResource')
|
@@ -129,7 +129,16 @@ module GoTransverseTractApi
|
|
129
129
|
# @param {Hash} service_resource
|
130
130
|
#
|
131
131
|
def update eid, service_resource
|
132
|
-
|
132
|
+
data = {
|
133
|
+
serviceResource: {
|
134
|
+
eid: eid,
|
135
|
+
identifier: service_resource[:identifier],
|
136
|
+
description: service_resource[:description]
|
137
|
+
}
|
138
|
+
}
|
139
|
+
|
140
|
+
xml_data = GoTransverseTractApi.generateXML(data, 'serviceResource')
|
141
|
+
GoTransverseTractApi.put_request_for(self, {eid: eid}, xml_data)
|
133
142
|
end
|
134
143
|
|
135
144
|
#
|
@@ -138,13 +147,13 @@ module GoTransverseTractApi
|
|
138
147
|
#
|
139
148
|
def add_service_resource eid, service_resource
|
140
149
|
data = {
|
141
|
-
:
|
142
|
-
:
|
143
|
-
:
|
144
|
-
:
|
145
|
-
:
|
150
|
+
addServiceResourceToService: {},
|
151
|
+
service: {eid: eid},
|
152
|
+
serviceResource: {
|
153
|
+
attributes: {
|
154
|
+
identifier: service_resource[:identifier]
|
146
155
|
},
|
147
|
-
:
|
156
|
+
category: {eid: service_resource[:category][:eid]}
|
148
157
|
}
|
149
158
|
}
|
150
159
|
|
@@ -158,9 +167,9 @@ module GoTransverseTractApi
|
|
158
167
|
#
|
159
168
|
def self.remove_service_resource eid, service_resource
|
160
169
|
data = {
|
161
|
-
:
|
162
|
-
:
|
163
|
-
:
|
170
|
+
removeServiceResourceFromService: {},
|
171
|
+
service: {eid: eid},
|
172
|
+
serviceResource: {eid: service_resource[:eid]}
|
164
173
|
}
|
165
174
|
|
166
175
|
xml_data = GoTransverseTractApi.generateXML(data, 'removeServiceResourceFromService')
|
@@ -70,13 +70,7 @@ module GoTransverseTractApi
|
|
70
70
|
#
|
71
71
|
def create_usage_event usage_event
|
72
72
|
data = {
|
73
|
-
usageEvent:
|
74
|
-
startTime: usage_event[:start_time],
|
75
|
-
serviceResourceId: usage_event[:service_resource_id],
|
76
|
-
usageUom: usage_event[:usage_uom],
|
77
|
-
usageAmount: usage_event[:usage_amount],
|
78
|
-
number01: usage_event[:number01]
|
79
|
-
},
|
73
|
+
usageEvent: get_usage_event(usage_event),
|
80
74
|
serviceResourceType: usage_event[:service_resource_type]
|
81
75
|
}
|
82
76
|
|
@@ -126,13 +120,7 @@ module GoTransverseTractApi
|
|
126
120
|
usage_event.each do|event|
|
127
121
|
events << {
|
128
122
|
usageEvent: {
|
129
|
-
attributes:
|
130
|
-
startTime: event[:start_time],
|
131
|
-
serviceResourceId: event[:service_resource_id],
|
132
|
-
usageUom: event[:usage_uom],
|
133
|
-
usageAmount: event[:usage_amount],
|
134
|
-
description: event[:description]
|
135
|
-
},
|
123
|
+
attributes: get_usage_event(event),
|
136
124
|
serviceResourceType: event[:service_resource_type]
|
137
125
|
}
|
138
126
|
}
|
@@ -141,6 +129,32 @@ module GoTransverseTractApi
|
|
141
129
|
events
|
142
130
|
end
|
143
131
|
|
132
|
+
#
|
133
|
+
# params: Usage Event
|
134
|
+
#
|
135
|
+
# Returns A single usage event for XML
|
136
|
+
#
|
137
|
+
def get_usage_event(event)
|
138
|
+
udfs = {}
|
139
|
+
|
140
|
+
(1..5).each do|i|
|
141
|
+
udfs["text0#{i}".to_sym] = event["text0#{i}".to_sym]
|
142
|
+
udfs["number0#{i}".to_sym] = event["number0#{i}".to_sym]
|
143
|
+
udfs["date0#{i}".to_sym] = event["date0#{i}".to_sym]
|
144
|
+
end
|
145
|
+
|
146
|
+
({
|
147
|
+
description: event[:description],
|
148
|
+
startTime: event[:start_time],
|
149
|
+
endTime: event[:end_time],
|
150
|
+
serviceResourceId: event[:service_resource_id],
|
151
|
+
usageUom: event[:usage_uom],
|
152
|
+
usageAmount: event[:usage_amount],
|
153
|
+
referenceId: event[:reference_id],
|
154
|
+
sequenceId: event[:sequence_id]
|
155
|
+
}.merge udfs).delete_if{|k,v| v.nil?}
|
156
|
+
end
|
157
|
+
|
144
158
|
end
|
145
159
|
|
146
160
|
end
|
@@ -186,7 +186,7 @@ module GoTransverseTractApi
|
|
186
186
|
|
187
187
|
def self.generateXML(data, root_elem)
|
188
188
|
tract_api_ver = GoTransverseTractApi::TARGET_API_VERSION
|
189
|
-
data[root_elem.to_sym][:xmlns] = "http://www.tractbilling.com/billing
|
189
|
+
data[root_elem.to_sym][:xmlns] = "http://www.tractbilling.com/billing/" + tract_api_ver.tr('.','_') + "/domain"
|
190
190
|
|
191
191
|
builder = Nokogiri::XML::Builder.new do|xml|
|
192
192
|
xml.send(root_elem,Hash[data[root_elem.to_sym]]) do
|
@@ -196,7 +196,8 @@ module GoTransverseTractApi
|
|
196
196
|
end
|
197
197
|
end
|
198
198
|
|
199
|
-
builder.doc.root.to_xml
|
199
|
+
xml_str = builder.doc.root.to_xml
|
200
|
+
xml_str.tr!('"', "'")
|
200
201
|
end
|
201
202
|
|
202
203
|
private
|
@@ -249,7 +250,7 @@ module GoTransverseTractApi
|
|
249
250
|
hsh = Hash.from_xml(xml_response.to_s).recursive_symbolize_keys!
|
250
251
|
|
251
252
|
if method == :get
|
252
|
-
hsh = hsh[klass.pluralize.camelize(:lower).to_sym]
|
253
|
+
hsh = hsh[klass.pluralize.camelize(:lower).to_sym] rescue Hash.from_xml(xml_response.to_s)[klass.camelize(:lower).to_sym]
|
253
254
|
end
|
254
255
|
|
255
256
|
return hsh
|