gotransverse-tract-api 0.3.2 → 0.3.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: e5a9ba40d1ab238ebadd20647f44852f54bb939d
4
- data.tar.gz: 13d0b06686570068eecdf42e01fd08b43a7c4c8a
3
+ metadata.gz: 48f41714e64767b6c7273705a2fe3af7f6c9dd2c
4
+ data.tar.gz: cbb1a75f305bb14d79ebae9657dd83995609d22b
5
5
  SHA512:
6
- metadata.gz: 910213b5526838dcea57fa1149439cc5e357f0f2351f6c1be57a290e200e65ff96d4eb0c26f6841ce65a4ebef04acb3551f6aeaee483dfe9d0e62c81939ed58d
7
- data.tar.gz: cd3dcf2ead01c8fb85fedc2cb08bbc536a358398c47e265846cb49765996cba9b8198eefc667369da1a0bc3ffd4267332a3837339971b6472975fb59a87e00df
6
+ metadata.gz: 622f1f761d62bcef02d21f1ad3b14a82768688703fca15161b422d7a655eae8b8b75dd0cccd73db28a329b7b2266ca5312bc6e2029d0657649cc8fc368b931b5
7
+ data.tar.gz: a1a75a6ca2b79f459ce59abd511f267abc0435ca4b5570b4e8b4816a2768f558084100ca272441af38c7a20e8032ec65b7aa28a220687adf0697603dc4b9c039
@@ -154,7 +154,8 @@ module GoTransverseTractApi
154
154
  def self.post_request_for(klass, api_params={}, request_body, command)
155
155
  api_url = GoTransverseTractApi.get_api_url_for(klass)
156
156
  api_url = "#{api_url}/#{command}"
157
- self.call(klass, api_url, api_params, :post, request_body.to_xml)
157
+
158
+ self.call(klass, api_url, api_params, :post, request_body)
158
159
  end
159
160
 
160
161
  #
@@ -208,7 +209,7 @@ module GoTransverseTractApi
208
209
  when :get
209
210
  response = http_client.get(api_url, api_params)
210
211
  when :post
211
- response = http_client.post(api_url, request_body, api_params)
212
+ response = http_client.post(api_url, request_body, {'Content-Type' => 'application/xml'})
212
213
  when :put
213
214
  response = http_client.put(api_url, request_body, api_params)
214
215
  end
@@ -217,13 +218,15 @@ module GoTransverseTractApi
217
218
 
218
219
  klass = klass.to_s.split("::").last
219
220
  hsh = Hash.from_xml(xml_response.to_s)
220
- hsh = hsh[klass.pluralize.camelize(:lower)][klass.camelize(:lower)] rescue Hash.from_xml(xml_response.to_s)[klass.camelize(:lower)]
221
+ if method == :get
222
+ hsh = hsh[klass.pluralize.camelize(:lower)][klass.camelize(:lower)] rescue Hash.from_xml(xml_response.to_s)[klass.camelize(:lower)]
223
+ end
221
224
 
222
225
  return hsh
223
226
  rescue
224
227
  {}
225
228
  end
226
-
229
+
227
230
  #
228
231
  # self.camelize_keys
229
232
  #
@@ -58,8 +58,14 @@ module GoTransverseTractApi
58
58
  # @param {String} cancel_url
59
59
  # @param {String} complete_url
60
60
  #
61
- def self.add_referrer_token_for error_url, cancel_url, complete_url
62
- GoTransverseTractApi.post_request_for(self, {error_url: error_url, cancel_url: cancel_url, complete_url: complete_url}, {}, "referrerToken")
61
+ def self.referrer_token error_url, cancel_url, complete_url
62
+ body = "<generatePaymentCollectionReferrerToken xmlns='http://www.tractbilling.com/billing/1_28/domain'>
63
+ <errorUrl>#{error_url}</errorUrl>
64
+ <cancelUrl>#{cancel_url}</cancelUrl>
65
+ <completeUrl>#{complete_url}</completeUrl>
66
+ </generatePaymentCollectionReferrerToken>"
67
+
68
+ GoTransverseTractApi.post_request_for(self, body, "referrerToken")
63
69
  end
64
70
 
65
71
  #
@@ -1,6 +1,6 @@
1
1
  module GoTransverseTractApi
2
2
 
3
- VERSION = "0.3.2"
3
+ VERSION = "0.3.3"
4
4
  TARGET_API_VERSION = "1.28"
5
5
 
6
6
  end
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ module GoTransverseTractApi
4
+
5
+ RSpec.describe BillingAccount::Payment do
6
+ before(:each) { http_auth }
7
+
8
+ context ".find_by_eid" do
9
+ it "returns a payment for the given eid" do
10
+ #data = described_class.find_by_eid(1)
11
+ #expect(data['eid']).to eq('1')
12
+ end
13
+ end
14
+
15
+ context ".referrer_token" do
16
+ it "returns a token" do
17
+ error_url = "http://smartzip-error.com"
18
+ cancel_url = "http://smartzip-cancel.com"
19
+ complete_url = "http://smartzip-complete.com"
20
+
21
+ actual_response = described_class.referrer_token(error_url,cancel_url,complete_url)
22
+ expect(actual_response['referrer']['referrerToken']).to_not be_nil
23
+ end
24
+
25
+ end
26
+
27
+ end
28
+ end
29
+
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.3.2
4
+ version: 0.3.3
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: 2015-11-27 00:00:00.000000000 Z
12
+ date: 2015-12-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -198,6 +198,7 @@ files:
198
198
  - lib/gotransverse-tract-api/usage/usage_rule.rb
199
199
  - lib/gotransverse-tract-api/version.rb
200
200
  - spec/auth_helper.rb
201
+ - spec/gotransverse-tract-api/billing_account/payment_spec.rb
201
202
  - spec/gotransverse-tract-api/product/product_spec.rb
202
203
  - spec/spec_helper.rb
203
204
  homepage: https://rubygems.org/gems/gotransverse-tract-api
@@ -227,5 +228,6 @@ summary: A ruby gem allowing developers to conveniently integrate with GoTransve
227
228
  TRACT API.
228
229
  test_files:
229
230
  - spec/auth_helper.rb
231
+ - spec/gotransverse-tract-api/billing_account/payment_spec.rb
230
232
  - spec/gotransverse-tract-api/product/product_spec.rb
231
233
  - spec/spec_helper.rb