gotransverse-tract-api 0.0.1

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.
Files changed (73) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +22 -0
  3. data/.idea/.name +1 -0
  4. data/.idea/.rakeTasks +7 -0
  5. data/.idea/gotransverse_tract_api.iml +19 -0
  6. data/.idea/misc.xml +14 -0
  7. data/.idea/modules.xml +8 -0
  8. data/.idea/vcs.xml +6 -0
  9. data/.idea/workspace.xml +906 -0
  10. data/.ruby-gemset +1 -0
  11. data/.ruby-version +1 -0
  12. data/Gemfile +7 -0
  13. data/LICENSE.txt +22 -0
  14. data/README.md +79 -0
  15. data/Rakefile +2 -0
  16. data/gotransverse-tract-api.gemspec +26 -0
  17. data/lib/gotransverse-tract-api.rb +181 -0
  18. data/lib/gotransverse-tract-api/billing_account/adjustment.rb +11 -0
  19. data/lib/gotransverse-tract-api/billing_account/adjustment_reason.rb +11 -0
  20. data/lib/gotransverse-tract-api/billing_account/billing_account.rb +11 -0
  21. data/lib/gotransverse-tract-api/billing_account/custom_field.rb +11 -0
  22. data/lib/gotransverse-tract-api/billing_account/custom_field_value.rb +11 -0
  23. data/lib/gotransverse-tract-api/billing_account/invoice.rb +11 -0
  24. data/lib/gotransverse-tract-api/billing_account/invoice_item.rb +11 -0
  25. data/lib/gotransverse-tract-api/billing_account/invoice_item_charge.rb +11 -0
  26. data/lib/gotransverse-tract-api/billing_account/payment.rb +11 -0
  27. data/lib/gotransverse-tract-api/billing_account/reason.rb +11 -0
  28. data/lib/gotransverse-tract-api/billing_account/recurring_payment.rb +11 -0
  29. data/lib/gotransverse-tract-api/billing_account/refund.rb +11 -0
  30. data/lib/gotransverse-tract-api/billing_account/scheduled_charge.rb +11 -0
  31. data/lib/gotransverse-tract-api/configuration.rb +39 -0
  32. data/lib/gotransverse-tract-api/general/system_setting.rb +11 -0
  33. data/lib/gotransverse-tract-api/general_ledger/gl_account.rb +11 -0
  34. data/lib/gotransverse-tract-api/general_ledger/gl_account_category.rb +11 -0
  35. data/lib/gotransverse-tract-api/general_ledger/gl_accounting_entry.rb +11 -0
  36. data/lib/gotransverse-tract-api/general_ledger/gl_aggregate_batch.rb +11 -0
  37. data/lib/gotransverse-tract-api/general_ledger/gl_aggregate_entry.rb +11 -0
  38. data/lib/gotransverse-tract-api/order/agreement.rb +11 -0
  39. data/lib/gotransverse-tract-api/order/bill_cycle.rb +11 -0
  40. data/lib/gotransverse-tract-api/order/billing_account_category.rb +11 -0
  41. data/lib/gotransverse-tract-api/order/order_item.rb +11 -0
  42. data/lib/gotransverse-tract-api/order/order_item_charge.rb +11 -0
  43. data/lib/gotransverse-tract-api/order/organization.rb +11 -0
  44. data/lib/gotransverse-tract-api/order/party_category.rb +11 -0
  45. data/lib/gotransverse-tract-api/order/person.rb +11 -0
  46. data/lib/gotransverse-tract-api/order/product_relation.rb +11 -0
  47. data/lib/gotransverse-tract-api/order/renewal_order.rb +11 -0
  48. data/lib/gotransverse-tract-api/order/sales_order.rb +11 -0
  49. data/lib/gotransverse-tract-api/product/action.rb +11 -0
  50. data/lib/gotransverse-tract-api/product/operation.rb +11 -0
  51. data/lib/gotransverse-tract-api/product/price_list.rb +11 -0
  52. data/lib/gotransverse-tract-api/product/price_range.rb +11 -0
  53. data/lib/gotransverse-tract-api/product/product.rb +11 -0
  54. data/lib/gotransverse-tract-api/product/product_category.rb +11 -0
  55. data/lib/gotransverse-tract-api/product/product_price.rb +11 -0
  56. data/lib/gotransverse-tract-api/product/usage_rule.rb +11 -0
  57. data/lib/gotransverse-tract-api/service/service.rb +11 -0
  58. data/lib/gotransverse-tract-api/service/service_device_inventory_item.rb +11 -0
  59. data/lib/gotransverse-tract-api/service/service_period.rb +11 -0
  60. data/lib/gotransverse-tract-api/service/service_price.rb +11 -0
  61. data/lib/gotransverse-tract-api/service/service_price_range.rb +11 -0
  62. data/lib/gotransverse-tract-api/service/service_resource.rb +11 -0
  63. data/lib/gotransverse-tract-api/service/service_resource_category.rb +11 -0
  64. data/lib/gotransverse-tract-api/usage/order_item_usage_rule.rb +11 -0
  65. data/lib/gotransverse-tract-api/usage/product_usage_rule.rb +11 -0
  66. data/lib/gotransverse-tract-api/usage/rate_table.rb +11 -0
  67. data/lib/gotransverse-tract-api/usage/service_usage_rule.rb +11 -0
  68. data/lib/gotransverse-tract-api/usage/usage_event.rb +11 -0
  69. data/lib/gotransverse-tract-api/usage/usage_lookup_table.rb +11 -0
  70. data/lib/gotransverse-tract-api/usage/usage_lookup_table_entry.rb +11 -0
  71. data/lib/gotransverse-tract-api/usage/usage_rule.rb +11 -0
  72. data/lib/gotransverse-tract-api/version.rb +6 -0
  73. metadata +173 -0
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ gotransverse-tract-api
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.2.3
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem "httpclient"
4
+ gem "nokogiri"
5
+
6
+ # Specify your gem's dependencies in gotransverse-tract-api.gemspec
7
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Julien DeFrance
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,79 @@
1
+ # GoTransverseTractApi Ruby Gem
2
+
3
+ A ruby gem allowing developers to integrate with GoTransverse's TRACT API.
4
+
5
+ Current supported version is 1.19 REST API (XML)
6
+ http://devdoc.gotransverse.com.php53-14.ord1-1.websitetestlink.com/Developer-Guides/TRACT-API-1.19/API-1.19-REST-Mount-Points
7
+
8
+ For more details, please refer to GoTransverse's TRACT API Documentation available at:
9
+ http://devdoc.gotransverse.com.php53-14.ord1-1.websitetestlink.com/Developer-Guide
10
+
11
+
12
+ ## Disclaimer
13
+
14
+ While we are all gladly contributing to the community...
15
+
16
+ This gem is unofficial, may contain bugs, and its use is at your own risk.
17
+ None of the project owners, developers, contributors may be held accountable for any defect or disaster resulting of the use of this gem.
18
+
19
+
20
+ ## Installation
21
+
22
+ Add this line to your application's Gemfile:
23
+
24
+ gem 'gotransverse-tract-api'
25
+
26
+ And then execute:
27
+
28
+ $ bundle
29
+
30
+ Or install it yourself as:
31
+
32
+ $ gem install gotransverse-tract-api
33
+
34
+
35
+ ## Configuration
36
+
37
+ From the application utilizing the gem, create a gotransverse-tract-api.rb file to your config/initializers folder, with content:
38
+
39
+ ```
40
+ #!ruby
41
+ GoTransverseTractApi.configure do |config|
42
+ config.user_id = <gotransverse_tract_user_id>
43
+ config.password = <gotransverse_tract_password>
44
+ end
45
+ ```
46
+
47
+
48
+ ## Usage
49
+
50
+ ```
51
+ #!ruby
52
+ GoTransverseTractApi::BillingAccount::Invoice.find_by_eid(<eid>)
53
+ ```
54
+
55
+ ## Version History & Changelog
56
+
57
+ Visit https://rubygems.org/gems/gotransverse-tract-api
58
+
59
+
60
+ ## Roadmap
61
+
62
+ Nov 2015: Initial Release, basic REST/XML API Support
63
+ Dec 2015: PCI-Compliant Hosted Payment Page URL Support
64
+ Q1 2016: Automated Test Coverage
65
+ Q2 2016: REST/JSON API Support
66
+
67
+
68
+ ## Contributing
69
+
70
+ Help and advice is gladly appreciated! :)
71
+ Feel free to contribute and be part of this project, helping the community staying on top of any new API version release.
72
+
73
+ Please keep version number increments under control :)
74
+
75
+ 1. Fork it ( https://github.com/[my-github-username]/gotransverse-tract-api/fork )
76
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
77
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
78
+ 4. Push to the branch (`git push origin my-new-feature`)
79
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'gotransverse-tract-api/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "gotransverse-tract-api"
8
+ spec.version = GoTransverseTractApi::VERSION
9
+ spec.authors = ["Julien DeFrance"]
10
+ spec.email = ["jdefrance@smartzip.com"]
11
+ spec.summary = "A ruby gem allowing developers to integrate with GoTransverse's TRACT API."
12
+ spec.description = "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."
13
+ spec.homepage = "https://rubygems.org/gems/gotransverse-tract-api"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake"
23
+
24
+ spec.add_runtime_dependency 'httpclient'
25
+ spec.add_runtime_dependency 'nokogiri'
26
+ end
@@ -0,0 +1,181 @@
1
+ require "gotransverse-tract-api/version"
2
+ require "gotransverse-tract-api/configuration"
3
+
4
+ require "gotransverse-tract-api/billing_account/adjustment"
5
+ require "gotransverse-tract-api/billing_account/adjustment_reason"
6
+ require "gotransverse-tract-api/billing_account/billing_account"
7
+ require "gotransverse-tract-api/billing_account/custom_field"
8
+ require "gotransverse-tract-api/billing_account/custom_field_value"
9
+ require "gotransverse-tract-api/billing_account/invoice"
10
+ require "gotransverse-tract-api/billing_account/invoice_item"
11
+ require "gotransverse-tract-api/billing_account/invoice_item_charge"
12
+ require "gotransverse-tract-api/billing_account/payment"
13
+ require "gotransverse-tract-api/billing_account/reason"
14
+ require "gotransverse-tract-api/billing_account/recurring_payment"
15
+ require "gotransverse-tract-api/billing_account/refund"
16
+ require "gotransverse-tract-api/billing_account/scheduled_charge"
17
+
18
+ require "gotransverse-tract-api/general/system_setting"
19
+
20
+ require "gotransverse-tract-api/general_ledger/gl_account"
21
+ require "gotransverse-tract-api/general_ledger/gl_account_category"
22
+ require "gotransverse-tract-api/general_ledger/gl_accounting_entry"
23
+ require "gotransverse-tract-api/general_ledger/gl_aggregate_batch"
24
+ require "gotransverse-tract-api/general_ledger/gl_aggregate_entry"
25
+
26
+ require "gotransverse-tract-api/order/agreement"
27
+ require "gotransverse-tract-api/order/bill_cycle"
28
+ require "gotransverse-tract-api/order/billing_account_category"
29
+ require "gotransverse-tract-api/order/order_item"
30
+ require "gotransverse-tract-api/order/order_item_charge"
31
+ require "gotransverse-tract-api/order/organization"
32
+ require "gotransverse-tract-api/order/party_category"
33
+ require "gotransverse-tract-api/order/person"
34
+ require "gotransverse-tract-api/order/product_relation"
35
+ require "gotransverse-tract-api/order/renewal_order"
36
+ require "gotransverse-tract-api/order/sales_order"
37
+
38
+ require "gotransverse-tract-api/product/action"
39
+ require "gotransverse-tract-api/product/operation"
40
+ require "gotransverse-tract-api/product/price_list"
41
+ require "gotransverse-tract-api/product/price_range"
42
+ require "gotransverse-tract-api/product/product"
43
+ require "gotransverse-tract-api/product/product_category"
44
+ require "gotransverse-tract-api/product/product_price"
45
+ require "gotransverse-tract-api/product/usage_rule"
46
+
47
+ require "gotransverse-tract-api/service/service"
48
+ require "gotransverse-tract-api/service/service_device_inventory_item"
49
+ require "gotransverse-tract-api/service/service_period"
50
+ require "gotransverse-tract-api/service/service_price"
51
+ require "gotransverse-tract-api/service/service_price_range"
52
+ require "gotransverse-tract-api/service/service_resource"
53
+ require "gotransverse-tract-api/service/service_resource_category"
54
+
55
+ require "gotransverse-tract-api/usage/order_item_usage_rule"
56
+ require "gotransverse-tract-api/usage/product_usage_rule"
57
+ require "gotransverse-tract-api/usage/rate_table"
58
+ require "gotransverse-tract-api/usage/service_usage_rule"
59
+ require "gotransverse-tract-api/usage/usage_event"
60
+ require "gotransverse-tract-api/usage/usage_lookup_table"
61
+ require "gotransverse-tract-api/usage/usage_lookup_table_entry"
62
+ require "gotransverse-tract-api/usage/usage_rule"
63
+
64
+ require "httpclient"
65
+ require "nokogiri"
66
+
67
+ module GoTransverseTractApi
68
+
69
+ class << self
70
+ attr_accessor :configuration
71
+ end
72
+
73
+ #
74
+ # self.configure
75
+ #
76
+ # Call this method to modify defaults in your initializers.
77
+ # Yields SmartZipSDK configuration
78
+ #
79
+ # Examples:
80
+ #
81
+ # GoTransverseTractApi.configure do |config|
82
+ # config.user_id = <gotransverse_tract_user_id>
83
+ # config.password = <gotransverse_tract_password>
84
+ # end
85
+ #
86
+ def self.configure
87
+ self.configuration ||= Configuration.new
88
+ yield(configuration)
89
+ end
90
+
91
+ #
92
+ # self.get_api_url_for
93
+ #
94
+ # @param {Class} klass
95
+ #
96
+ def self.get_api_url_for klass
97
+ "#{GoTransverseTractApi.configuration.tract_api_url}/#{klass.classname.camelize(:lower).pluralize}"
98
+ end
99
+
100
+ #
101
+ # self.get_response_from
102
+ #
103
+ # @param {String} api_url
104
+ # @param {Hash} api_params
105
+ # @param {Hash} headers (optional)
106
+ #
107
+ def self.get_response_from(api_url, api_params, headers={})
108
+
109
+ if GoTransverseTractApi.configuration.cache_enabled
110
+ return self.get_cached_response_from(api_url, api_params, headers)
111
+ end
112
+
113
+ # Unless cached
114
+ self.call(api_url, api_params, headers, :get)
115
+ end
116
+
117
+ #
118
+ # self.post_request_to
119
+ #
120
+ # @param {String} api_url
121
+ # @param {Hash} api_params
122
+ # @param {Hash} headers (optional)
123
+ #
124
+ def self.post_request_to(api_url, api_params, headers={})
125
+ self.call(api_url, api_params, headers, :post)
126
+ end
127
+
128
+ #
129
+ # self.put_request_to
130
+ #
131
+ # @param {String} api_url
132
+ # @param {Hash} api_params
133
+ # @param {Hash} headers (optional)
134
+ #
135
+ def self.put_request_to(api_url, api_params, headers={})
136
+ self.call(api_url, api_params, headers, :put)
137
+ end
138
+
139
+ private
140
+
141
+ #
142
+ # self.get_cached_response_from
143
+ #
144
+ # @param {String} api_url
145
+ # @param {Hash} api_params
146
+ # @param {Hash} headers (optional)
147
+ #
148
+ def self.get_cached_response_from(api_url, api_params, headers={})
149
+ key = "#{api_url}.#{api_params.sort}"
150
+
151
+ return Rails.cache.fetch(key, expires_in: 10.minutes) do
152
+ self.get_response_from(api_url, api_params, headers)
153
+ end
154
+
155
+ return self.get_response_from(api_url, api_params, headers)
156
+ end
157
+
158
+ #
159
+ # self.call
160
+ #
161
+ # @param {String} api_url
162
+ # @param {Hash} api_params
163
+ # @param {Hash} headers (optional)
164
+ # @param {String} method (optional)
165
+ #
166
+ def self.call(api_url, api_params, headers={}, method=:get)
167
+
168
+ http_client = HTTPClient.new
169
+ case method
170
+ when :get
171
+ response = http_client.get(api_url, api_params, headers)
172
+ when :post
173
+ response = http_client.post(api_url, api_params, headers)
174
+ when :put
175
+ response = http_client.put(api_url, api_params, headers)
176
+ end
177
+
178
+ Nokogiri::XML(response.body.to_s)
179
+ end
180
+
181
+ end
@@ -0,0 +1,11 @@
1
+ module GoTransverseTractApi
2
+
3
+ module BillingAccount
4
+
5
+ class Adjustment
6
+
7
+ end
8
+
9
+ end
10
+
11
+ end
@@ -0,0 +1,11 @@
1
+ module GoTransverseTractApi
2
+
3
+ module BillingAccount
4
+
5
+ class AdjustmentReason
6
+
7
+ end
8
+
9
+ end
10
+
11
+ end
@@ -0,0 +1,11 @@
1
+ module GoTransverseTractApi
2
+
3
+ module BillingAccount
4
+
5
+ class BillingAccount
6
+
7
+ end
8
+
9
+ end
10
+
11
+ end
@@ -0,0 +1,11 @@
1
+ module GoTransverseTractApi
2
+
3
+ module BillingAccount
4
+
5
+ class CustomField
6
+
7
+ end
8
+
9
+ end
10
+
11
+ end
@@ -0,0 +1,11 @@
1
+ module GoTransverseTractApi
2
+
3
+ module BillingAccount
4
+
5
+ class CustomFieldValue
6
+
7
+ end
8
+
9
+ end
10
+
11
+ end
@@ -0,0 +1,11 @@
1
+ module GoTransverseTractApi
2
+
3
+ module BillingAccount
4
+
5
+ class Invoice
6
+
7
+ end
8
+
9
+ end
10
+
11
+ end
@@ -0,0 +1,11 @@
1
+ module GoTransverseTractApi
2
+
3
+ module BillingAccount
4
+
5
+ class InvoiceItem
6
+
7
+ end
8
+
9
+ end
10
+
11
+ end
@@ -0,0 +1,11 @@
1
+ module GoTransverseTractApi
2
+
3
+ module BillingAccount
4
+
5
+ class InvoiceItemCharge
6
+
7
+ end
8
+
9
+ end
10
+
11
+ end
@@ -0,0 +1,11 @@
1
+ module GoTransverseTractApi
2
+
3
+ module BillingAccount
4
+
5
+ class Payment
6
+
7
+ end
8
+
9
+ end
10
+
11
+ end