gotransverse-tract-api 0.2.2 → 0.2.3

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: 637ae88083aec82a541b55a843415c518d6dd690
4
- data.tar.gz: 7f0742b1c12dad70c9c642344f4abaf0c5d66d6c
3
+ metadata.gz: 7069d33e78b10067c41980c6ae090a5d5246cffa
4
+ data.tar.gz: 3e5aed2f1cdf1e842da35b4c3a1cd52bcbbbf0ed
5
5
  SHA512:
6
- metadata.gz: 68a81eca9b40be18c81dacbcffbdaf378da747d8a19aa184f4637529d7cb431b8643716b61dc6854eaafad073a942d1662cf7746ecc2457db3bb7362417854a7
7
- data.tar.gz: 22a934c25a0d1fbaf2be8c10c3a6008a00717b31a0c3b4f4a078fc167d5bc25ac7f28733fc120da68f00f3842f0aba5210a637d9016278c071ffcb5ccb389acf
6
+ metadata.gz: ca9e11cab8ed683ec3fe79f8630994fedc1b9f4c0e26f02946cc10592f892aa99f22087467248d9269d75d8d701c8b429719fb6955959e86c5e7515899d47eeb
7
+ data.tar.gz: 50132b33bdf4c21c979ba74563a67b4bd32f7c06569a26584ba0b64ad7e248d2ec46c9db96c5c320820f4f37467aaf6aad300fa6216e973bcca63e49f52ebe84
data/Gemfile CHANGED
@@ -3,5 +3,10 @@ source 'https://rubygems.org'
3
3
  gem "httpclient"
4
4
  gem "nokogiri"
5
5
 
6
+ group :development, :test do
7
+ gem "pry-byebug"
8
+ gem "rspec-rails"
9
+ end
10
+
6
11
  # Specify your gem's dependencies in gotransverse-tract-api.gemspec
7
12
  gemspec
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # GoTransverseTractApi Ruby Gem
2
2
 
3
- A ruby gem allowing developers to integrate with GoTransverse's TRACT API.
3
+ A ruby gem allowing developers to conveniently integrate with GoTransverse's TRACT API.
4
4
 
5
5
  Current supported version is 1.28 REST API (XML)
6
6
  https://documentation.gotransverse.com/Content/Archive/site/tract.gotransverse.com/Developer-Guides/TRACT-API-1.28/REST-Endpoints.html
@@ -13,7 +13,7 @@ https://documentation.gotransverse.com/Content/Archive/site/tract.gotransverse.c
13
13
  While we are all gladly contributing to the community...
14
14
 
15
15
  This gem is unofficial, may contain bugs, and its use is at your own risk.
16
- None of the project owners, developers, contributors may be held accountable for any defect or disaster resulting of the use of this gem.
16
+ None of the project owners, developers, contributors may be held accountable for any defect or disaster resulting of the direct or indirect use of this gem.
17
17
 
18
18
 
19
19
  ## Installation
@@ -48,10 +48,15 @@ end
48
48
 
49
49
  ```
50
50
  #!ruby
51
+
51
52
  GoTransverseTractApi::BillingAccount::Invoice.find_by_eid(<eid>)
52
53
 
53
54
  products = GoTransverseTractApi::Product::Product.find_all
55
+
54
56
  product = GoTransverseTractApi::Product::Product.find_by_eid(<eid>)
57
+ product.symbolize_keys!
58
+
59
+ product_price = GoTransverseTractApi::Product::RecurringProductPrice.find_by_product_eid(product[:eid])
55
60
 
56
61
  ```
57
62
 
@@ -94,19 +99,12 @@ Love this project? Use it for your business?
94
99
 
95
100
  Reward our developers and help us keep this project active.
96
101
 
97
- [![Click here to donate][2]][1]
102
+ [![Click here to donate][2]][1] [![Click here to donate][4]][3] [![Click here to donate][6]][5] or more! :)
98
103
 
99
104
  [1]: https://www.bountysource.com/cart?amount=100&currency=USD&team_id=gotransverse-tract-api-rails
100
105
  [2]: http://img.shields.io/badge/donate-$100-brightgreen.svg (Click here to donate)
101
-
102
- [![Click here to donate][4]][3]
103
-
104
- [3]: https://www.bountysource.com/cart?amount=250&currency=USD&team_id=gotransverse-tract-api-rails
105
- [4]: http://img.shields.io/badge/donate-$250-brightgreen.svg (Click here to donate)
106
-
107
- [![Click here to donate][6]][5]
108
-
106
+ [3]: https://www.bountysource.com/cart?amount=250&currency=USD&team_id=gotransverse-tract-api-rails
107
+ [4]: http://img.shields.io/badge/donate-$250-brightgreen.svg (Click here to donate)
109
108
  [5]: https://www.bountysource.com/cart?amount=500&currency=USD&team_id=gotransverse-tract-api-rails
110
109
  [6]: http://img.shields.io/badge/donate-$500-brightgreen.svg (Click here to donate)
111
110
 
112
- Or more! :)
@@ -128,7 +128,6 @@ module GoTransverseTractApi
128
128
  def self.get_response_for(klass, api_params={})
129
129
 
130
130
  api_url = GoTransverseTractApi.get_api_url_for(klass)
131
-
132
131
  pp "api_url: " + api_url
133
132
 
134
133
  if GoTransverseTractApi.configuration.cache_enabled
@@ -216,6 +215,8 @@ module GoTransverseTractApi
216
215
 
217
216
  hsh = hsh[klass.pluralize.camelize(:lower)][klass.camelize(:lower)] rescue Hash.from_xml(xml_response.to_s)[klass.camelize(:lower)]
218
217
  return hsh
218
+ rescue
219
+ {}
219
220
  end
220
221
 
221
222
  #
@@ -1,6 +1,8 @@
1
1
  module GoTransverseTractApi
2
2
 
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.3"
4
4
  TARGET_API_VERSION = "1.28"
5
5
 
6
6
  end
7
+
8
+
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ module GoTransverseTractApi
4
+
5
+ RSpec.describe Product::Product do
6
+ before(:each) { http_auth }
7
+
8
+ context ".find_all" do
9
+ it "returns all products" do
10
+ response = described_class.find_all
11
+ num_of_products = response.css('products').children.count
12
+ expect(num_of_products).to be > 1
13
+ end
14
+ end
15
+
16
+ context ".find_by_eid" do
17
+ it "returns a product for the given eid" do
18
+ response = described_class.find_by_eid(50)
19
+ data = Hash.from_xml(response.to_s)
20
+ expect(data['products']['product']['eid']).to eq('50')
21
+ end
22
+ end
23
+ end
24
+ end
25
+
@@ -0,0 +1,23 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ ENV["RAILS_ENV"] ||= 'test'
3
+
4
+ require 'gotransverse-tract-api'
5
+ require 'rspec'
6
+ require 'pry'
7
+ require 'active_support/all'
8
+
9
+ #require 'factory_girl'
10
+ #require 'ffaker'
11
+ #require 'shoulda'
12
+
13
+
14
+ #Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
15
+
16
+ # Checks for pending migrations before tests are run.
17
+ # If you are not using ActiveRecord, you can remove this line.
18
+
19
+ RSpec.configure do |config|
20
+ #config.include FactoryGirl::Syntax::Methods
21
+
22
+ config.include AuthHelper
23
+ 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.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien DeFrance
@@ -191,6 +191,8 @@ files:
191
191
  - lib/gotransverse-tract-api/usage/usage_lookup_table_entry.rb
192
192
  - lib/gotransverse-tract-api/usage/usage_rule.rb
193
193
  - lib/gotransverse-tract-api/version.rb
194
+ - spec/gotransverse-tract-api/product/product_spec.rb
195
+ - spec/spec_helper.rb
194
196
  homepage: https://rubygems.org/gems/gotransverse-tract-api
195
197
  licenses:
196
198
  - MIT
@@ -215,4 +217,6 @@ rubygems_version: 2.4.5.1
215
217
  signing_key:
216
218
  specification_version: 4
217
219
  summary: A ruby gem allowing developers to integrate with GoTransverse's TRACT API.
218
- test_files: []
220
+ test_files:
221
+ - spec/gotransverse-tract-api/product/product_spec.rb
222
+ - spec/spec_helper.rb