gotransverse-tract-api 0.1.9 → 0.1.10
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.
- checksums.yaml +4 -4
- data/README.md +1 -5
- data/lib/gotransverse-tract-api.rb +5 -12
- data/lib/gotransverse-tract-api/configuration.rb +1 -21
- data/lib/gotransverse-tract-api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fceec5debc29dd90850d8f84ffea81b46270f0db
|
4
|
+
data.tar.gz: acfd5e386f10c83c36e7a91b1c0106e4a5b1a2e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b730b1e88e04848428de3e9506f583287fe8f2018bad59cd881481da020a897414671b05450aa4d0ce77e9b28ad525df76001eb5bf8231d85e61a907e37af16
|
7
|
+
data.tar.gz: ecdd1375ed305d537f7828b13a287e3920fb3d0da3ed3608c8467e2a4f82c2fd402434902b9a1bc52b2a99473cb5e4b508ea49d66c7a8f2b588903aa2b465308
|
data/README.md
CHANGED
@@ -38,16 +38,12 @@ From the application utilizing the gem, create a gotransverse_tract_api.rb file
|
|
38
38
|
```
|
39
39
|
#!ruby
|
40
40
|
GoTransverseTractApi.configure do |config|
|
41
|
-
config.
|
41
|
+
config.username = <gotransverse_tract_username>
|
42
42
|
config.password = <gotransverse_tract_password>
|
43
43
|
config.tract_api_host = <gotransverse_tract_api_host>
|
44
44
|
end
|
45
45
|
```
|
46
46
|
|
47
|
-
Your credentials will automatically be encoded in Base64 following TRACT API's Web Service Login recommendations available at:
|
48
|
-
http://devdoc.gotransverse.com.php53-14.ord1-1.websitetestlink.com/Developer-Guides/API-Reference/API-Security-and-Login
|
49
|
-
|
50
|
-
|
51
47
|
## Usage
|
52
48
|
|
53
49
|
```
|
@@ -150,13 +150,6 @@ module GoTransverseTractApi
|
|
150
150
|
|
151
151
|
private
|
152
152
|
|
153
|
-
#
|
154
|
-
# self.get_authentication_headers
|
155
|
-
#
|
156
|
-
def self.get_authentication_headers
|
157
|
-
{"basic-credentials" => GoTransverseTractApi.configuration.basic_credentials}
|
158
|
-
end
|
159
|
-
|
160
153
|
#
|
161
154
|
# self.get_cached_response_for
|
162
155
|
#
|
@@ -183,18 +176,18 @@ module GoTransverseTractApi
|
|
183
176
|
#
|
184
177
|
def self.call(api_url, api_params={}, method=:get, request_body="")
|
185
178
|
|
186
|
-
headers = self.get_authentication_headers
|
187
|
-
|
188
179
|
# TODO: Camelize all keys in api_params Hash.
|
189
180
|
|
190
181
|
http_client = HTTPClient.new
|
182
|
+
http_client.set_auth(nil, GoTransverseTractApi.configuration.username, GoTransverseTractApi.configuration.password)
|
183
|
+
|
191
184
|
case method
|
192
185
|
when :get
|
193
|
-
response = http_client.get(api_url, api_params
|
186
|
+
response = http_client.get(api_url, api_params)
|
194
187
|
when :post
|
195
|
-
response = http_client.post(api_url, request_body, api_params
|
188
|
+
response = http_client.post(api_url, request_body, api_params)
|
196
189
|
when :put
|
197
|
-
response = http_client.put(api_url, request_body, api_params
|
190
|
+
response = http_client.put(api_url, request_body, api_params)
|
198
191
|
end
|
199
192
|
|
200
193
|
Nokogiri::XML(response.body.to_s)
|
@@ -2,9 +2,8 @@ module GoTransverseTractApi
|
|
2
2
|
|
3
3
|
class Configuration
|
4
4
|
|
5
|
-
attr_accessor :
|
5
|
+
attr_accessor :username
|
6
6
|
attr_accessor :password
|
7
|
-
attr_accessor :basic_credentials
|
8
7
|
|
9
8
|
attr_accessor :cache_enabled
|
10
9
|
|
@@ -15,7 +14,6 @@ module GoTransverseTractApi
|
|
15
14
|
#
|
16
15
|
def initialize
|
17
16
|
@tract_api_host = "https://my.tractbilling.com"
|
18
|
-
set_basic_credentials
|
19
17
|
end
|
20
18
|
|
21
19
|
#
|
@@ -25,23 +23,5 @@ module GoTransverseTractApi
|
|
25
23
|
"#{@tract_api_host}/t/s/r/#{GoTransverseTractApi::TARGET_API_VERSION}"
|
26
24
|
end
|
27
25
|
|
28
|
-
private
|
29
|
-
|
30
|
-
#
|
31
|
-
# set_basic_credentials
|
32
|
-
#
|
33
|
-
def set_basic_credentials
|
34
|
-
|
35
|
-
# Perform Base-64 encoding of API login information
|
36
|
-
user_pass = "#{@user_id.to_s}:#{@password.to_s}"
|
37
|
-
|
38
|
-
# Sets basic_credentials attr_accessor
|
39
|
-
@basic_credentials = Base64.encode64(user_pass)
|
40
|
-
|
41
|
-
# Erase in-clear credentials
|
42
|
-
@user_id = @password = nil
|
43
|
-
|
44
|
-
end
|
45
|
-
|
46
26
|
end
|
47
27
|
end
|