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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a006a5aaaeae6a6d56f4ed22478c393c416cddd
|
4
|
+
data.tar.gz: dd75eceecbea5cebc3e05b2f78c0b92c83203cf0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d18ab13ad5bb93485dbc545d4f6fe6c29f6e229d74392e28183f278b4b1e5bcdac959d54ac5ff0d0da975855f69e389edc691d2320a6183322fc2ee42d292e9b
|
7
|
+
data.tar.gz: f3964ace33739b0247208969bbcf2b7707fce8a4fa6b74d9a6a7c19b6cdfc287a6e904e44fec6d8118b4bf0c0f477de906c5199848afd39d667c330df23a4d66
|
@@ -145,10 +145,10 @@ module GoTransverseTractApi
|
|
145
145
|
#
|
146
146
|
def resume eid, billing_account
|
147
147
|
data = {
|
148
|
-
:
|
149
|
-
:
|
150
|
-
:
|
151
|
-
:
|
148
|
+
resumeBillingAccount: {},
|
149
|
+
billingAccount: {eid: eid},
|
150
|
+
startDate: billing_account[:start_date],
|
151
|
+
notes: billing_account[:notes]
|
152
152
|
}
|
153
153
|
|
154
154
|
xml_data = GoTransverseTractApi.generateXML(data, 'resumeBillingAccount')
|
@@ -161,16 +161,16 @@ module GoTransverseTractApi
|
|
161
161
|
#
|
162
162
|
def add_recurring_payment eid, billing_account
|
163
163
|
data = {
|
164
|
-
:
|
165
|
-
:
|
166
|
-
:
|
167
|
-
:
|
168
|
-
:
|
169
|
-
:
|
170
|
-
:
|
171
|
-
:
|
172
|
-
:
|
173
|
-
:
|
164
|
+
addRecurringPaymentToBillingAccount: {},
|
165
|
+
billingAccount: {eid: eid},
|
166
|
+
recurringPayment: {
|
167
|
+
attributes: {},
|
168
|
+
creditCardPaymentMethod: {
|
169
|
+
cardType: billing_account[:recurring_payment][:credit_card_payment_method][:card_type],
|
170
|
+
cardHolderFirstName: billing_account[:recurring_payment][:credit_card_payment_method][:card_holder_first_name],
|
171
|
+
cardHolderLastName: billing_account[:recurring_payment][:credit_card_payment_method][:card_holder_last_name],
|
172
|
+
cardIdentifierNumber: billing_account[:recurring_payment][:credit_card_payment_method][:card_identifier_number],
|
173
|
+
cardExpiration: billing_account[:recurring_payment][:credit_card_payment_method][:card_expiration]
|
174
174
|
}
|
175
175
|
}
|
176
176
|
}
|
@@ -185,25 +185,25 @@ module GoTransverseTractApi
|
|
185
185
|
#
|
186
186
|
def change_service eid, billing_account
|
187
187
|
data = {
|
188
|
-
:
|
189
|
-
:
|
188
|
+
changeService: {},
|
189
|
+
service: {
|
190
190
|
eid: billing_account[:service][:eid]
|
191
191
|
},
|
192
|
-
:
|
193
|
-
:
|
194
|
-
:
|
192
|
+
order: {
|
193
|
+
attributes: {
|
194
|
+
note: billing_account[:order][:note]
|
195
195
|
},
|
196
|
-
:
|
197
|
-
:
|
198
|
-
:
|
199
|
-
:
|
200
|
-
:
|
201
|
-
:
|
196
|
+
orderItems: {
|
197
|
+
attributes: {},
|
198
|
+
orderItem: {
|
199
|
+
attributes: {
|
200
|
+
quantity: billing_account[:order][:order_items][:order_item][:quantity],
|
201
|
+
description: billing_account[:order][:order_items][:order_item][:description]
|
202
202
|
},
|
203
|
-
:
|
203
|
+
products: get_products(billing_account)
|
204
204
|
}
|
205
205
|
},
|
206
|
-
:
|
206
|
+
billingAccount: {eid: eid}
|
207
207
|
}
|
208
208
|
}
|
209
209
|
xml_data = GoTransverseTractApi.generateXML(data, 'changeService')
|
@@ -216,10 +216,10 @@ module GoTransverseTractApi
|
|
216
216
|
#
|
217
217
|
def add_custom_field_value eid, billing_account
|
218
218
|
data = {
|
219
|
-
:
|
220
|
-
:
|
221
|
-
:
|
222
|
-
:
|
219
|
+
addCustomFieldValue: {},
|
220
|
+
billingAccount: {eid: eid},
|
221
|
+
customFieldValue: {
|
222
|
+
value: billing_account[:custom_field_value][:value]
|
223
223
|
}
|
224
224
|
}
|
225
225
|
xml_data = GoTransverseTractApi.generateXML(data, 'addCustomFieldValue')
|
@@ -232,9 +232,9 @@ module GoTransverseTractApi
|
|
232
232
|
#
|
233
233
|
def remove_custom_field_value eid, billing_account
|
234
234
|
data = {
|
235
|
-
:
|
236
|
-
:
|
237
|
-
:
|
235
|
+
removeCustomFieldValue: {},
|
236
|
+
billingAccount: {eid: eid},
|
237
|
+
customFieldValue: {
|
238
238
|
eid: billing_account[:custom_field_value][:eid]
|
239
239
|
}
|
240
240
|
}
|
@@ -248,15 +248,15 @@ module GoTransverseTractApi
|
|
248
248
|
#
|
249
249
|
def add_person eid, billing_account
|
250
250
|
data = {
|
251
|
-
:
|
252
|
-
:
|
253
|
-
:
|
254
|
-
:
|
255
|
-
:
|
256
|
-
:
|
257
|
-
:
|
251
|
+
addPersonToBillingAccount: {},
|
252
|
+
billingAccount: {eid: eid},
|
253
|
+
person: {
|
254
|
+
attributes: {
|
255
|
+
firstName: billing_account[:person][:first_name],
|
256
|
+
lastName: billing_account[:person][:last_name],
|
257
|
+
middleName: billing_account[:person][:middle_name]
|
258
258
|
},
|
259
|
-
:
|
259
|
+
addresses: GoTransverseTractApi::ApiData.new.get_addresses(billing_account[:person])
|
260
260
|
}
|
261
261
|
}
|
262
262
|
|
@@ -270,9 +270,9 @@ module GoTransverseTractApi
|
|
270
270
|
#
|
271
271
|
def remove_billing_account eid, billing_account
|
272
272
|
data = {
|
273
|
-
:
|
274
|
-
:
|
275
|
-
:
|
273
|
+
removePersonFromBillingAccount: {},
|
274
|
+
billingAccount: { eid: eid },
|
275
|
+
person: { eid: billing_account[:person][:eid] }
|
276
276
|
}
|
277
277
|
|
278
278
|
xml_data = GoTransverseTractApi.generateXML(data, 'removePersonFromBillingAccount')
|
@@ -285,8 +285,8 @@ module GoTransverseTractApi
|
|
285
285
|
#
|
286
286
|
def create_draft_order eid, billing_account
|
287
287
|
data = {
|
288
|
-
:
|
289
|
-
:
|
288
|
+
createDraftOrder: {},
|
289
|
+
salesOrder: GoTransverseTractApi::ApiData.new.sales_order_details(billing_account[:sales_order])
|
290
290
|
}
|
291
291
|
|
292
292
|
xml_data = GoTransverseTractApi.generateXML(data, 'createDraftOrder')
|
@@ -299,8 +299,8 @@ module GoTransverseTractApi
|
|
299
299
|
#
|
300
300
|
def void_draft_order eid, billing_account
|
301
301
|
data = {
|
302
|
-
:
|
303
|
-
:
|
302
|
+
voidDraftOrder: {},
|
303
|
+
salesOrder: GoTransverseTractApi::ApiData.new.sales_order_details(billing_account[:sales_order])
|
304
304
|
}
|
305
305
|
|
306
306
|
xml_data = GoTransverseTractApi.generateXML(data, 'voidDraftOrder')
|
@@ -321,19 +321,19 @@ module GoTransverseTractApi
|
|
321
321
|
#
|
322
322
|
def create_billing_account billing_account
|
323
323
|
data = {
|
324
|
-
:
|
325
|
-
:
|
324
|
+
billingAccount: {
|
325
|
+
billType: billing_account[:bill_type]
|
326
326
|
},
|
327
|
-
:
|
327
|
+
dailyBillCycle: {
|
328
328
|
eid: billing_account[:daily_bill_cycle][:eid]
|
329
329
|
},
|
330
|
-
:
|
331
|
-
:
|
332
|
-
:
|
330
|
+
organization: {
|
331
|
+
attributes: {
|
332
|
+
name: billing_account[:organization][:name]
|
333
333
|
},
|
334
|
-
:
|
334
|
+
addresses: GoTransverseTractApi::ApiData.new.get_addresses(billing_account[:organization])
|
335
335
|
},
|
336
|
-
:
|
336
|
+
billingAccountCategory: {
|
337
337
|
eid: billing_account[:billing_account_category][:eid]
|
338
338
|
}
|
339
339
|
}
|
@@ -346,7 +346,19 @@ module GoTransverseTractApi
|
|
346
346
|
# @param {Hash} billing_account
|
347
347
|
#
|
348
348
|
def update eid, billing_account
|
349
|
-
|
349
|
+
data = {
|
350
|
+
billingAccount: {
|
351
|
+
eid: eid,
|
352
|
+
billType: billing_account[:bill_type],
|
353
|
+
automaticRecurringPayment: billing_account[:automatic_recurring_payment]
|
354
|
+
},
|
355
|
+
billingAccountCategory: {
|
356
|
+
eid: billing_account[:billing_account_category][:eid]
|
357
|
+
}
|
358
|
+
}
|
359
|
+
|
360
|
+
xml_data = GoTransverseTractApi.generateXML(data, 'billingAccount')
|
361
|
+
GoTransverseTractApi.put_request_for(self, {eid: eid}, xml_data)
|
350
362
|
end
|
351
363
|
|
352
364
|
private
|
@@ -357,7 +369,7 @@ module GoTransverseTractApi
|
|
357
369
|
|
358
370
|
(0..qty - 1).each do|i|
|
359
371
|
products << {
|
360
|
-
:
|
372
|
+
product: {
|
361
373
|
eid: billing_account[:order][:order_items][:order_item][:products][i][:eid]
|
362
374
|
}
|
363
375
|
}
|
@@ -66,8 +66,43 @@ module GoTransverseTractApi
|
|
66
66
|
# @param {Long} eid
|
67
67
|
# @param {Hash} counter
|
68
68
|
#
|
69
|
-
def
|
70
|
-
|
69
|
+
def update_usage_charge eid, counter
|
70
|
+
xml_data = get_data_struct(counter, 'usageChargeCounter')
|
71
|
+
GoTransverseTractApi.put_request_for(self, {eid: eid}, xml_data)
|
72
|
+
end
|
73
|
+
|
74
|
+
#
|
75
|
+
# @param {Long} eid
|
76
|
+
# @param {Hash} counter
|
77
|
+
#
|
78
|
+
def update_usage_event eid, counter
|
79
|
+
xml_data = get_data_struct(counter, 'usageEventCounter')
|
80
|
+
GoTransverseTractApi.put_request_for(self, {eid: eid}, xml_data)
|
81
|
+
end
|
82
|
+
|
83
|
+
#
|
84
|
+
# @param {Long} eid
|
85
|
+
# @param {Hash} counter
|
86
|
+
#
|
87
|
+
def update_usage_rule eid, counter
|
88
|
+
xml_data = get_data_struct(counter, 'usageRuleCounter')
|
89
|
+
GoTransverseTractApi.put_request_for(self, {eid: eid}, xml_data)
|
90
|
+
end
|
91
|
+
|
92
|
+
private
|
93
|
+
|
94
|
+
def get_data_struct(counter, root_elem)
|
95
|
+
root_elem =~ /usage(.*?)Counter/
|
96
|
+
child_attr = $1.downcase
|
97
|
+
|
98
|
+
data = {
|
99
|
+
"#{root_elem}": {
|
100
|
+
eid: counter[:eid],
|
101
|
+
charge: counter["#{child_attr}".to_sym]
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
GoTransverseTractApi.generateXML(data, root_elem)
|
71
106
|
end
|
72
107
|
|
73
108
|
end
|
@@ -53,7 +53,15 @@ module GoTransverseTractApi
|
|
53
53
|
# @param {Hash} gl_aggregate_batch
|
54
54
|
#
|
55
55
|
def update eid, gl_aggregate_batch
|
56
|
-
|
56
|
+
data = {
|
57
|
+
glAggregateBatch: {
|
58
|
+
eid: eid,
|
59
|
+
exported: 'true'
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
xml_data = GoTransverseTractApi.generateXML(data, 'glAggregateBatch')
|
64
|
+
GoTransverseTractApi.put_request_for(self, {eid: eid}, xml_data)
|
57
65
|
end
|
58
66
|
|
59
67
|
end
|
@@ -46,7 +46,12 @@ module GoTransverseTractApi
|
|
46
46
|
# @param {Hash} gl_transaction_batch
|
47
47
|
#
|
48
48
|
def update eid, gl_transaction_batch
|
49
|
-
|
49
|
+
data = {
|
50
|
+
glTransactionBatch: { eid: eid, exported: gl_transaction_batch[:exported] }
|
51
|
+
}
|
52
|
+
|
53
|
+
xml_data = GoTransverseTractApi.generateXML(data, 'glTransactionBatch')
|
54
|
+
GoTransverseTractApi.put_request_for(self, {eid: eid}, xml_data)
|
50
55
|
end
|
51
56
|
|
52
57
|
end
|
@@ -41,7 +41,16 @@ module GoTransverseTractApi
|
|
41
41
|
# @param {Hash} people
|
42
42
|
#
|
43
43
|
def self.update eid, people
|
44
|
-
|
44
|
+
data = {
|
45
|
+
person: {
|
46
|
+
eid: eid,
|
47
|
+
name: people[:name],
|
48
|
+
taxIdNumber: people[:tax_id_number]
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
xml_data = GoTransverseTractApi.generateXML(data, 'person')
|
53
|
+
GoTransverseTractApi.put_request_for(self, {eid: eid}, xml_data)
|
45
54
|
end
|
46
55
|
|
47
56
|
#
|