gotransverse-tract-api 0.20.1 → 0.20.2

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: 63e045d923b6e03ece724ae375551ddd066f4821
4
- data.tar.gz: 3a77aabde9c7e8b6748c5c89378565064625bcbc
3
+ metadata.gz: 5c91ea0793c86a852f94944cd0d2ba0c2f43922d
4
+ data.tar.gz: 4167f32e281efb0dbd18d44b7689bebfb5fb7d94
5
5
  SHA512:
6
- metadata.gz: 01f884bade4e5213d64e4c8bedd162a06ee0fd892e61825be20e04e0254eacffbf5004d9b66596a32100876a7f4ecf6b165837b664b1927c96563a487f5a9a31
7
- data.tar.gz: f0f097bc5971c8b07b32b3106ee3dc33a53a02296f5b272d5d181f55cc8a503f70d554e3ea854220515fe38950a3b800daa4fd10c666f040bc19481e1265a0ac
6
+ metadata.gz: 97e3406e72541e8d876220e930c27aea7e4d881d4ce610aef84c1200cb99094c4afd5f865e4c99f182040095a28942a9b5513ffde37fb3b3085f676557a75721
7
+ data.tar.gz: 78e8cc8e3e496bf547f9557138b4abdeb0d85bc9d5475cec1c17f84a09b91201ed48df5cdd8613cdcb1b64e497d7d925ad3946a05784e5e57e70690b1c1e78c5
data/README.md CHANGED
@@ -90,7 +90,7 @@ Please keep version number increments under control :)
90
90
  ## Authors
91
91
 
92
92
  * Julien DeFrance
93
- * Ravikumar Gudipati
93
+ * Daniel Ng
94
94
 
95
95
 
96
96
  ## Donations
@@ -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 hsh
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 (val.is_a?Hash)
322
- if (val.has_key?(:attributes))
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
- elsif (val.is_a?Array)
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 eid, options={}
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 product_order_item_eid, options={}
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
@@ -1,8 +1,6 @@
1
1
  module GoTransverseTractApi
2
2
 
3
- VERSION = "0.20.1"
3
+ VERSION = "0.20.2"
4
4
  TARGET_API_VERSION = "1.29"
5
5
 
6
6
  end
7
-
8
-
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.1
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-04 00:00:00.000000000 Z
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.8
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