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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 991b917a0d5b0f35ea4a30f1072e490376c39215
4
- data.tar.gz: ee0c6d6a5910f7d09487fb3f1e80576377a93369
3
+ metadata.gz: 3a006a5aaaeae6a6d56f4ed22478c393c416cddd
4
+ data.tar.gz: dd75eceecbea5cebc3e05b2f78c0b92c83203cf0
5
5
  SHA512:
6
- metadata.gz: e813bc6870a93ea21159c93d3cadd72c3b75987346b0cb6134e1808eddf05f79d604f26f96f4aee022eb49ef72d511d5fc5005b5abdc77cf1c75db21b63dcbb4
7
- data.tar.gz: 4abf7a83a59a66ebdf194238d6cf496d8d70ab59f79eb682925f8f0ff10f564fe53614c2848e06d57ab7a3ca8e52e479559e38fd4f001c7c2903bd560f22e469
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
- :resumeBillingAccount => {},
149
- :billingAccount => {eid: eid},
150
- :startDate => billing_account[:start_date],
151
- :notes => billing_account[:notes]
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
- :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]
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
- :changeService => {},
189
- :service => {
188
+ changeService: {},
189
+ service: {
190
190
  eid: billing_account[:service][:eid]
191
191
  },
192
- :order => {
193
- :attributes => {
194
- :note => billing_account[:order][:note]
192
+ order: {
193
+ attributes: {
194
+ note: billing_account[:order][:note]
195
195
  },
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]
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
- :products => get_products(billing_account)
203
+ products: get_products(billing_account)
204
204
  }
205
205
  },
206
- :billingAccount => {eid: eid}
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
- :addCustomFieldValue => {},
220
- :billingAccount => {eid: eid},
221
- :customFieldValue => {
222
- :value => billing_account[:custom_field_value][:value]
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
- :removeCustomFieldValue => {},
236
- :billingAccount => {eid: eid},
237
- :customFieldValue => {
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
- :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]
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
- :addresses => GoTransverseTractApi::ApiData.new.get_addresses(billing_account[:person])
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
- :removePersonFromBillingAccount => {},
274
- :billingAccount => { eid: eid },
275
- :person => { eid: billing_account[:person][:eid] }
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
- :createDraftOrder => {},
289
- :salesOrder => GoTransverseTractApi::ApiData.new.sales_order_details(billing_account[:sales_order])
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
- :voidDraftOrder => {},
303
- :salesOrder => GoTransverseTractApi::ApiData.new.sales_order_details(billing_account[:sales_order])
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
- :billingAccount => {
325
- :billType => billing_account[:bill_type]
324
+ billingAccount: {
325
+ billType: billing_account[:bill_type]
326
326
  },
327
- :dailyBillCycle => {
327
+ dailyBillCycle: {
328
328
  eid: billing_account[:daily_bill_cycle][:eid]
329
329
  },
330
- :organization => {
331
- :attributes => {
332
- :name => billing_account[:organization][:name]
330
+ organization: {
331
+ attributes: {
332
+ name: billing_account[:organization][:name]
333
333
  },
334
- :addresses => GoTransverseTractApi::ApiData.new.get_addresses(billing_account[:organization])
334
+ addresses: GoTransverseTractApi::ApiData.new.get_addresses(billing_account[:organization])
335
335
  },
336
- :billingAccountCategory => {
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
- GoTransverseTractApi.put_request_for(self, {eid: eid}, billing_account)
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
- :product => {
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 update eid, counter
70
- GoTransverseTractApi.put_request_for(self, {eid: eid}, counter)
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
- GoTransverseTractApi.put_request_for(self, {eid: eid}, gl_aggregate_batch)
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
- GoTransverseTractApi.put_request_for(self, {eid: eid}, gl_transaction_batch)
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
- GoTransverseTractApi.put_request_for(self, {eid: eid}, people)
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
  #