gotransverse-tract-api 0.20.1 → 0.20.2
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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/gotransverse-tract-api.gemspec +1 -1
- data/lib/gotransverse-tract-api.rb +9 -7
- data/lib/gotransverse-tract-api/order/order_item.rb +7 -2
- data/lib/gotransverse-tract-api/product/operation_attribute.rb +22 -2
- data/lib/gotransverse-tract-api/version.rb +1 -3
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c91ea0793c86a852f94944cd0d2ba0c2f43922d
|
4
|
+
data.tar.gz: 4167f32e281efb0dbd18d44b7689bebfb5fb7d94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97e3406e72541e8d876220e930c27aea7e4d881d4ce610aef84c1200cb99094c4afd5f865e4c99f182040095a28942a9b5513ffde37fb3b3085f676557a75721
|
7
|
+
data.tar.gz: 78e8cc8e3e496bf547f9557138b4abdeb0d85bc9d5475cec1c17f84a09b91201ed48df5cdd8613cdcb1b64e497d7d925ad3946a05784e5e57e70690b1c1e78c5
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@ require 'gotransverse-tract-api/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "gotransverse-tract-api"
|
8
8
|
spec.version = GoTransverseTractApi::VERSION
|
9
|
-
spec.authors = ["Julien DeFrance", "Ravikumar Gudipati"]
|
9
|
+
spec.authors = ["Julien DeFrance", "Ravikumar Gudipati", "Daniel Ng"]
|
10
10
|
spec.email = ["jdefrance@smartzip.com"]
|
11
11
|
spec.summary = "A ruby gem allowing developers to conveniently integrate with GoTransverse's TRACT API."
|
12
12
|
spec.description = "A ruby gem allowing developers to conveniently integrate with GoTransverse's TRACT API. TRACT is a billing engine edited by GoTransverse that supports various revenue models like one-time purchases, simple subscriptions, and more complex, usage-based models."
|
@@ -208,8 +208,8 @@ module GoTransverseTractApi
|
|
208
208
|
tract_api_ver = GoTransverseTractApi::TARGET_API_VERSION
|
209
209
|
data[root_elem.to_sym][:xmlns] = "http://www.tractbilling.com/billing/" + tract_api_ver.tr('.','_') + "/domain"
|
210
210
|
|
211
|
-
builder = Nokogiri::XML::Builder.new do|xml|
|
212
|
-
xml.send(root_elem,Hash[data[root_elem.to_sym]]) do
|
211
|
+
builder = Nokogiri::XML::Builder.new do |xml|
|
212
|
+
xml.send(root_elem, Hash[data[root_elem.to_sym]]) do
|
213
213
|
arr = []
|
214
214
|
arr << root_elem.to_sym
|
215
215
|
self.process_data(data, arr, xml)
|
@@ -305,7 +305,7 @@ module GoTransverseTractApi
|
|
305
305
|
#
|
306
306
|
# @param {hash} hsh
|
307
307
|
#
|
308
|
-
def self.camelize_keys
|
308
|
+
def self.camelize_keys(hsh)
|
309
309
|
hsh.keys.each do |k|
|
310
310
|
new_key = k.to_s.camelize(:lower)
|
311
311
|
new_key = new_key.to_sym if k.is_a? Symbol
|
@@ -315,11 +315,11 @@ module GoTransverseTractApi
|
|
315
315
|
end
|
316
316
|
|
317
317
|
def self.process_data(data, arr, xml)
|
318
|
-
data.each do|key,val|
|
318
|
+
data.each do |key,val|
|
319
319
|
next if arr.include?(key)
|
320
320
|
|
321
|
-
if
|
322
|
-
if
|
321
|
+
if val.is_a?(Hash)
|
322
|
+
if val.has_key?(:attributes)
|
323
323
|
xml.send(key, Hash[data[key][:attributes]]) do
|
324
324
|
arr << 'attributes'.to_sym
|
325
325
|
self.process_data(data[key],arr,xml)
|
@@ -327,10 +327,12 @@ module GoTransverseTractApi
|
|
327
327
|
else
|
328
328
|
xml.send(key, Hash[data[key]])
|
329
329
|
end
|
330
|
-
|
330
|
+
|
331
|
+
elsif val.is_a?(Array)
|
331
332
|
val.each do|item|
|
332
333
|
self.process_data(item,arr,xml)
|
333
334
|
end
|
335
|
+
|
334
336
|
else
|
335
337
|
xml.send(key, val)
|
336
338
|
end
|
@@ -265,6 +265,10 @@ module GoTransverseTractApi
|
|
265
265
|
selected_agreement = Agreement.get_selected_agreement(order_item[:selected_agreement])
|
266
266
|
end
|
267
267
|
|
268
|
+
if order_item.has_key?(:operation_attributes)
|
269
|
+
operation_attributes = Product::OperationAttribute.get_operation_attributes(order_item[:operation_attributes])
|
270
|
+
end
|
271
|
+
|
268
272
|
if order_item.has_key?(:onetime_product_price)
|
269
273
|
# We can add later this one as a separate class for getting all other attributes
|
270
274
|
onetime_product_price = {
|
@@ -301,7 +305,7 @@ module GoTransverseTractApi
|
|
301
305
|
sequence: order_item[:sequence],
|
302
306
|
description: order_item[:description],
|
303
307
|
eid: order_item[:eid]
|
304
|
-
}.delete_if{|k,v| v.nil?},
|
308
|
+
}.delete_if{ |k,v| v.nil? },
|
305
309
|
parentService: parent_service,
|
306
310
|
orderItemUsageRules: order_item_usage_rules,
|
307
311
|
recurringProductPrice: Product::RecurringProductPrice.get_recurring_product_price(order_item[:recurring_product_price]),
|
@@ -315,7 +319,8 @@ module GoTransverseTractApi
|
|
315
319
|
inventoryItem: inventory_item,
|
316
320
|
agreementConfiguration: agreement_configuration,
|
317
321
|
scheduledCharges: scheduled_charges,
|
318
|
-
discountConfigurations: discount_configurations
|
322
|
+
discountConfigurations: discount_configurations,
|
323
|
+
operationAttributes: operation_attributes
|
319
324
|
}
|
320
325
|
|
321
326
|
orderItem.delete_if{|k,v| v.nil?}
|
@@ -8,7 +8,7 @@ module GoTransverseTractApi
|
|
8
8
|
# @param {Long} eid
|
9
9
|
# @param {Hash} options
|
10
10
|
#
|
11
|
-
def self.find_by_eid
|
11
|
+
def self.find_by_eid(eid, options={})
|
12
12
|
return nil unless eid.present?
|
13
13
|
|
14
14
|
params ||= GoTransverseTractApi::ApiData.new.get_query_params({eid: eid}, options)
|
@@ -19,13 +19,33 @@ module GoTransverseTractApi
|
|
19
19
|
# @param {Long} product_order_item_eid
|
20
20
|
# @param {Hash} options
|
21
21
|
#
|
22
|
-
def self.find_by_product_order_item_eid
|
22
|
+
def self.find_by_product_order_item_eid(product_order_item_eid, options={})
|
23
23
|
return nil unless product_order_item_eid.present?
|
24
24
|
|
25
25
|
params ||= GoTransverseTractApi::ApiData.new.get_query_params({product_order_item_eid: product_order_item_eid}, options)
|
26
26
|
GoTransverseTractApi.get_response_for(self, params)
|
27
27
|
end
|
28
28
|
|
29
|
+
# TODO: add specs
|
30
|
+
#
|
31
|
+
# @param {Hash} operation_attributes
|
32
|
+
#
|
33
|
+
def self.get_operation_attributes(operation_attributes={})
|
34
|
+
return nil unless operation_attributes.has_key?(:product_sale_operation_attribute) && operation_attributes.has_key?(:approval_operation)
|
35
|
+
|
36
|
+
operation_details = {
|
37
|
+
attributes: {},
|
38
|
+
productSaleOperationAttribute: {
|
39
|
+
attributes: {autoApproveDate: operation_attributes[:product_sale_operation_attribute][:auto_approve_date]},
|
40
|
+
approvalOperation: {
|
41
|
+
attributes: {eid: operation_attributes[:approval_operation][:eid]}
|
42
|
+
}
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
operation_details
|
47
|
+
end
|
48
|
+
|
29
49
|
end
|
30
50
|
|
31
51
|
end
|
metadata
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gotransverse-tract-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.20.
|
4
|
+
version: 0.20.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julien DeFrance
|
8
8
|
- Ravikumar Gudipati
|
9
|
+
- Daniel Ng
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date: 2016-10-
|
13
|
+
date: 2016-10-20 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: bundler
|
@@ -259,7 +260,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
259
260
|
version: '0'
|
260
261
|
requirements: []
|
261
262
|
rubyforge_project:
|
262
|
-
rubygems_version: 2.4.
|
263
|
+
rubygems_version: 2.4.5.1
|
263
264
|
signing_key:
|
264
265
|
specification_version: 4
|
265
266
|
summary: A ruby gem allowing developers to conveniently integrate with GoTransverse's
|