gotransverse-tract-api 0.7.4 → 0.7.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/lib/gotransverse-tract-api.rb +0 -1
  3. data/lib/gotransverse-tract-api/api_data.rb +6 -0
  4. data/lib/gotransverse-tract-api/billing_account/adjustment.rb +38 -20
  5. data/lib/gotransverse-tract-api/billing_account/adjustment_application.rb +12 -6
  6. data/lib/gotransverse-tract-api/billing_account/adjustment_reason.rb +30 -14
  7. data/lib/gotransverse-tract-api/billing_account/billing_account.rb +103 -50
  8. data/lib/gotransverse-tract-api/billing_account/counter.rb +50 -26
  9. data/lib/gotransverse-tract-api/billing_account/custom_field.rb +36 -17
  10. data/lib/gotransverse-tract-api/billing_account/custom_field_value.rb +72 -35
  11. data/lib/gotransverse-tract-api/billing_account/invoice.rb +54 -27
  12. data/lib/gotransverse-tract-api/billing_account/invoice_item.rb +18 -9
  13. data/lib/gotransverse-tract-api/billing_account/invoice_item_charge.rb +6 -3
  14. data/lib/gotransverse-tract-api/billing_account/payment.rb +44 -23
  15. data/lib/gotransverse-tract-api/billing_account/reason.rb +24 -11
  16. data/lib/gotransverse-tract-api/billing_account/recurring_payment.rb +24 -11
  17. data/lib/gotransverse-tract-api/billing_account/refund.rb +30 -43
  18. data/lib/gotransverse-tract-api/billing_account/scheduled_charge.rb +30 -14
  19. data/lib/gotransverse-tract-api/billing_account/standard_invoice_adjustment_application.rb +12 -6
  20. data/lib/gotransverse-tract-api/general_ledger/general_ledger.rb +42 -25
  21. data/lib/gotransverse-tract-api/general_ledger/gl_account.rb +24 -12
  22. data/lib/gotransverse-tract-api/general_ledger/gl_account_category.rb +18 -9
  23. data/lib/gotransverse-tract-api/general_ledger/gl_accounting_entry.rb +36 -18
  24. data/lib/gotransverse-tract-api/general_ledger/gl_accounting_transaction.rb +42 -21
  25. data/lib/gotransverse-tract-api/general_ledger/gl_adjustment_accounting_transaction.rb +1 -61
  26. data/lib/gotransverse-tract-api/general_ledger/gl_aggregate_batch.rb +37 -19
  27. data/lib/gotransverse-tract-api/general_ledger/gl_aggregate_entry.rb +53 -34
  28. data/lib/gotransverse-tract-api/general_ledger/gl_invoice_accounting_transaction.rb +1 -1
  29. data/lib/gotransverse-tract-api/general_ledger/gl_payment_accounting_transaction.rb +1 -1
  30. data/lib/gotransverse-tract-api/general_ledger/gl_transaction_batch.rb +32 -17
  31. data/lib/gotransverse-tract-api/order/adjustment_category.rb +24 -11
  32. data/lib/gotransverse-tract-api/order/agreement.rb +55 -26
  33. data/lib/gotransverse-tract-api/order/bill_cycle.rb +36 -17
  34. data/lib/gotransverse-tract-api/order/billing_account_category.rb +26 -11
  35. data/lib/gotransverse-tract-api/order/order_item.rb +48 -24
  36. data/lib/gotransverse-tract-api/order/order_item_charge.rb +42 -21
  37. data/lib/gotransverse-tract-api/order/organization.rb +24 -11
  38. data/lib/gotransverse-tract-api/order/party_category.rb +30 -14
  39. data/lib/gotransverse-tract-api/order/payment_term.rb +33 -17
  40. data/lib/gotransverse-tract-api/order/people.rb +30 -14
  41. data/lib/gotransverse-tract-api/order/product_relation.rb +18 -9
  42. data/lib/gotransverse-tract-api/order/renewal_order.rb +61 -31
  43. data/lib/gotransverse-tract-api/order/sales_order.rb +66 -32
  44. data/lib/gotransverse-tract-api/product/action.rb +12 -6
  45. data/lib/gotransverse-tract-api/product/billing_account_segment_field.rb +30 -15
  46. data/lib/gotransverse-tract-api/product/discount.rb +30 -15
  47. data/lib/gotransverse-tract-api/product/discount_category.rb +24 -11
  48. data/lib/gotransverse-tract-api/product/discount_code.rb +60 -30
  49. data/lib/gotransverse-tract-api/product/discount_identifier.rb +24 -11
  50. data/lib/gotransverse-tract-api/product/one_time_product_price.rb +6 -3
  51. data/lib/gotransverse-tract-api/product/operation.rb +12 -5
  52. data/lib/gotransverse-tract-api/product/operation_attribute.rb +12 -6
  53. data/lib/gotransverse-tract-api/product/price_list.rb +18 -8
  54. data/lib/gotransverse-tract-api/product/product.rb +96 -47
  55. data/lib/gotransverse-tract-api/product/product_price.rb +42 -21
  56. data/lib/gotransverse-tract-api/product/product_price_range.rb +36 -18
  57. data/lib/gotransverse-tract-api/product/product_tag.rb +26 -13
  58. data/lib/gotransverse-tract-api/product/recurring_product_price.rb +42 -21
  59. data/lib/gotransverse-tract-api/service/service.rb +60 -31
  60. data/lib/gotransverse-tract-api/service/service_device_inventory_item.rb +24 -12
  61. data/lib/gotransverse-tract-api/service/service_period.rb +30 -15
  62. data/lib/gotransverse-tract-api/service/service_price.rb +30 -15
  63. data/lib/gotransverse-tract-api/service/service_price_range.rb +12 -6
  64. data/lib/gotransverse-tract-api/service/service_resource.rb +42 -21
  65. data/lib/gotransverse-tract-api/service/service_resource_category.rb +24 -11
  66. data/lib/gotransverse-tract-api/usage/global_usage_rule.rb +24 -11
  67. data/lib/gotransverse-tract-api/usage/order_item_usage_rule.rb +18 -9
  68. data/lib/gotransverse-tract-api/usage/product_usage_rule.rb +24 -12
  69. data/lib/gotransverse-tract-api/usage/rate_table.rb +12 -6
  70. data/lib/gotransverse-tract-api/usage/service_usage_rule.rb +18 -9
  71. data/lib/gotransverse-tract-api/usage/usage_event.rb +48 -24
  72. data/lib/gotransverse-tract-api/usage/usage_lookup_table.rb +19 -10
  73. data/lib/gotransverse-tract-api/usage/usage_lookup_table_entry.rb +24 -12
  74. data/lib/gotransverse-tract-api/usage/usage_price_category.rb +19 -9
  75. data/lib/gotransverse-tract-api/usage/usage_rule.rb +12 -6
  76. data/lib/gotransverse-tract-api/version.rb +1 -1
  77. data/spec/gotransverse-tract-api/order/sales_order_spec.rb +44 -0
  78. data/spec/gotransverse-tract-api/product/product_spec.rb +1 -1
  79. metadata +2 -3
  80. data/lib/gotransverse-tract-api/product/usage_rule.rb +0 -27
@@ -8,26 +8,35 @@ module GoTransverseTractApi
8
8
 
9
9
  #
10
10
  # @param {Long} eid
11
- # @param {String} query_scope (default: 'SHALLOW')
11
+ # @param {Hash} options
12
12
  #
13
- def find_by_eid eid, query_scope=nil
14
- GoTransverseTractApi.get_response_for(self, {eid: eid, queryScope: query_scope})
13
+ def find_by_eid eid, options=nil
14
+ return nil unless eid.present?
15
+
16
+ params ||= GoTransverseTractApi::ApiData.new.get_query_params({eid: eid}, options)
17
+ GoTransverseTractApi.get_response_for(self, params)
15
18
  end
16
19
 
17
20
  #
18
- # @param {String} name
19
- # @param {String} query_scope (default: 'SHALLOW')
21
+ # @param {Boolean} name
22
+ # @param {Hash} options
20
23
  #
21
- def find_by_name name, query_scope=nil
22
- GoTransverseTractApi.get_response_for(self, {name: name, queryScope: query_scope})
24
+ def find_by_name name, options=nil
25
+ return nil unless name.present?
26
+
27
+ params ||= GoTransverseTractApi::ApiData.new.get_query_params({name: name}, options)
28
+ GoTransverseTractApi.get_response_for(self, params)
23
29
  end
24
30
 
25
31
  #
26
32
  # @param {String} status
27
- # @param {String} query_scope (default: 'SHALLOW')
33
+ # @param {Hash} options
28
34
  #
29
- def find_by_status status, query_scope=nil
30
- GoTransverseTractApi.get_response_for(self, {status: status, queryScope: query_scope})
35
+ def find_by_status status, options=nil
36
+ return nil unless status.present?
37
+
38
+ params ||= GoTransverseTractApi::ApiData.new.get_query_params({status: status}, options)
39
+ GoTransverseTractApi.get_response_for(self, params)
31
40
  end
32
41
 
33
42
  end
@@ -8,34 +8,46 @@ module GoTransverseTractApi
8
8
 
9
9
  #
10
10
  # @param {Long} eid
11
- # @param {String} query_scope (default: 'SHALLOW')
11
+ # @param {Hash} options
12
12
  #
13
- def find_by_eid eid, query_scope=nil
14
- GoTransverseTractApi.get_response_for(self, {eid: eid, queryScope: query_scope})
13
+ def find_by_eid eid, options=nil
14
+ return nil unless eid.present?
15
+
16
+ params ||= GoTransverseTractApi::ApiData.new.get_query_params({eid: eid}, options)
17
+ GoTransverseTractApi.get_response_for(self, params)
15
18
  end
16
19
 
17
20
  #
18
21
  # @param {Long} usage_lookup_table_eid
19
- # @param {String} query_scope (default: 'SHALLOW')
22
+ # @param {Hash} options
20
23
  #
21
- def find_by_usage_lookup_table_eid usage_lookup_table_eid, query_scope=nil
22
- GoTransverseTractApi.get_response_for(self, {usage_lookup_table_eid: usage_lookup_table_eid, queryScope: query_scope})
24
+ def find_by_usage_lookup_table_usage_lookup_table_eid usage_lookup_table_usage_lookup_table_eid, options=nil
25
+ return nil unless usage_lookup_table_eid.present?
26
+
27
+ params ||= GoTransverseTractApi::ApiData.new.get_query_params({usage_lookup_table_eid: usage_lookup_table_eid}, options)
28
+ GoTransverseTractApi.get_response_for(self, params)
23
29
  end
24
30
 
25
31
  #
26
32
  # @param {String} key
27
- # @param {String} query_scope (default: 'SHALLOW')
33
+ # @param {Hash} options
28
34
  #
29
- def find_by_key key, query_scope=nil
30
- GoTransverseTractApi.get_response_for(self, {key: key, queryScope: query_scope})
35
+ def find_by_key key, options=nil
36
+ return nil unless key.present?
37
+
38
+ params ||= GoTransverseTractApi::ApiData.new.get_query_params({key: key}, options)
39
+ GoTransverseTractApi.get_response_for(self, params)
31
40
  end
32
41
 
33
42
  #
34
43
  # @param {String} value
35
- # @param {String} query_scope (default: 'SHALLOW')
44
+ # @param {Hash} options
36
45
  #
37
- def find_by_value value, query_scope=nil
38
- GoTransverseTractApi.get_response_for(self, {value: value, queryScope: query_scope})
46
+ def find_by_value value, options=nil
47
+ return nil unless value.present?
48
+
49
+ params ||= GoTransverseTractApi::ApiData.new.get_query_params({value: value}, options)
50
+ GoTransverseTractApi.get_response_for(self, params)
39
51
  end
40
52
 
41
53
  end
@@ -6,24 +6,34 @@ module GoTransverseTractApi
6
6
 
7
7
  class << self
8
8
 
9
- def find_by_all
10
- GoTransverseTractApi.get_response_for(self)
9
+ #
10
+ # @param {Hash} options
11
+ #
12
+ def find_all options=nil
13
+ params ||= GoTransverseTractApi::ApiData.new.get_query_params({}, options)
14
+ GoTransverseTractApi.get_response_for(self, params)
11
15
  end
12
16
 
13
17
  #
14
18
  # @param {Long} eid
15
- # @param {String} query_scope (default: 'SHALLOW')
19
+ # @param {Hash} options
16
20
  #
17
- def find_by_eid eid, query_scope=nil
18
- GoTransverseTractApi.get_response_for(self, {eid: eid, queryScope: query_scope})
21
+ def find_by_eid eid, options=nil
22
+ return nil unless eid.present?
23
+
24
+ params ||= GoTransverseTractApi::ApiData.new.get_query_params({eid: eid}, options)
25
+ GoTransverseTractApi.get_response_for(self, params)
19
26
  end
20
27
 
21
28
  #
22
- # @param {String} name
23
- # @param {String} query_scope (default: 'SHALLOW')
29
+ # @param {Boolean} name
30
+ # @param {Hash} options
24
31
  #
25
- def find_by_name name, query_scope=nil
26
- GoTransverseTractApi.get_response_for(self, {name: name, queryScope: query_scope})
32
+ def find_by_name name, options=nil
33
+ return nil unless name.present?
34
+
35
+ params ||= GoTransverseTractApi::ApiData.new.get_query_params({name: name}, options)
36
+ GoTransverseTractApi.get_response_for(self, params)
27
37
  end
28
38
 
29
39
  end
@@ -8,18 +8,24 @@ module GoTransverseTractApi
8
8
 
9
9
  #
10
10
  # @param {Long} eid
11
- # @param {String} query_scope (default: 'SHALLOW')
11
+ # @param {Hash} options
12
12
  #
13
- def find_by_eid eid, query_scope=nil
14
- GoTransverseTractApi.get_response_for(self, {eid: eid, queryScope: query_scope})
13
+ def find_by_eid eid, options=nil
14
+ return nil unless eid.present?
15
+
16
+ params ||= GoTransverseTractApi::ApiData.new.get_query_params({eid: eid}, options)
17
+ GoTransverseTractApi.get_response_for(self, params)
15
18
  end
16
19
 
17
20
  #
18
21
  # @param {Long} service_period_eid
19
- # @param {String} query_scope (default: 'SHALLOW')
22
+ # @param {Hash} options
20
23
  #
21
- def find_by_service_period_eid service_period_eid, query_scope=nil
22
- GoTransverseTractApi.get_response_for(self, {service_period_eid: service_period_eid, queryScope: query_scope})
24
+ def find_by_service_period_eid service_period_eid, options=nil
25
+ return nil unless service_period_eid.present?
26
+
27
+ params ||= GoTransverseTractApi::ApiData.new.get_query_params({service_period_eid: service_period_eid}, options)
28
+ GoTransverseTractApi.get_response_for(self, params)
23
29
  end
24
30
 
25
31
  end
@@ -1,6 +1,6 @@
1
1
  module GoTransverseTractApi
2
2
 
3
- VERSION = "0.7.4"
3
+ VERSION = "0.7.5"
4
4
  TARGET_API_VERSION = "1.29"
5
5
 
6
6
  end
@@ -8,6 +8,26 @@ module GoTransverseTractApi
8
8
  let(:eid) { '296'}
9
9
  let(:response) { {a: 'b', c: 'd'} }
10
10
 
11
+ # As per TRACT documentation the API call exists
12
+ # but never works
13
+ describe ".find_all" do
14
+ context "when no options present" do
15
+ it "returns all sales orders" do
16
+ data = described_class.find_all
17
+ expect(data).to be_nil
18
+ end
19
+ end
20
+
21
+ context "when options present" do
22
+ it "returns all sales orders based on options" do
23
+ options = { pageSize: 10, pageNumber: 2 }
24
+
25
+ data = described_class.find_all options
26
+ expect(data).to be_nil
27
+ end
28
+ end
29
+ end
30
+
11
31
  context ".find_by_eid" do
12
32
  it "returns a sales order for the given eid" do
13
33
  data = described_class.find_by_eid(eid)
@@ -15,6 +35,30 @@ module GoTransverseTractApi
15
35
  end
16
36
  end
17
37
 
38
+ describe ".find_by_account_num" do
39
+ it "returns nil if no account number is given" do
40
+ account_num = nil
41
+ options = {}
42
+
43
+ data = described_class.find_by_account_num(account_num, options)
44
+ expect(data).to be_nil
45
+ end
46
+
47
+ it "returns a sales order for the given account number" do
48
+ account_num = 180
49
+ options = { pageSize: 100, pageNumber: 1, queryScope: 'DEEP' }
50
+
51
+ data = described_class.find_by_account_num(account_num, options)
52
+ expect(data).to_not be_nil
53
+ end
54
+ it "returns a sales order for the given account number and no options" do
55
+ account_num = 180
56
+
57
+ data = described_class.find_by_account_num(account_num)
58
+ expect(data).to_not be_nil
59
+ end
60
+ end
61
+
18
62
  context ".add_custom_field_value" do
19
63
  it "adds custom field value for the sales order" do
20
64
  data = { value: 'yes' }
@@ -21,7 +21,7 @@ module GoTransverseTractApi
21
21
 
22
22
  context ".find_by_name" do
23
23
  it "returns a product for the given name" do
24
- data = described_class.find_by_name('Postcards 1st Class', 'DEEP')
24
+ data = described_class.find_by_name('Postcards 1st Class', {query_scope: 'DEEP'})
25
25
  expect(data).to_not be_nil
26
26
  end
27
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gotransverse-tract-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.4
4
+ version: 0.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien DeFrance
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-02-23 00:00:00.000000000 Z
12
+ date: 2016-03-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -184,7 +184,6 @@ files:
184
184
  - lib/gotransverse-tract-api/product/product_price_range.rb
185
185
  - lib/gotransverse-tract-api/product/product_tag.rb
186
186
  - lib/gotransverse-tract-api/product/recurring_product_price.rb
187
- - lib/gotransverse-tract-api/product/usage_rule.rb
188
187
  - lib/gotransverse-tract-api/service/service.rb
189
188
  - lib/gotransverse-tract-api/service/service_device_inventory_item.rb
190
189
  - lib/gotransverse-tract-api/service/service_period.rb
@@ -1,27 +0,0 @@
1
- module GoTransverseTractApi
2
-
3
- module Product
4
-
5
- class UsageRule
6
-
7
- #
8
- # @param {Long} eid
9
- # @param {String} query_scope (default: 'SHALLOW')
10
- #
11
- def self.find_by_eid eid, query_scope=nil
12
- GoTransverseTractApi.get_response_for(self, {eid: eid, queryScope: query_scope})
13
- end
14
-
15
- #
16
- # @param {Long} service_period_eid
17
- # @param {String} query_scope (default: 'SHALLOW')
18
- #
19
- def self.find_by_service_period_eid service_period_eid, query_scope=nil
20
- GoTransverseTractApi.get_response_for(self, {service_period_eid: service_period_eid, queryScope: query_scope})
21
- end
22
-
23
- end
24
-
25
- end
26
-
27
- end