gotransverse-tract-api 0.0.13 → 0.0.14
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/lib/gotransverse-tract-api.rb +13 -10
- data/lib/gotransverse-tract-api/order/people.rb +16 -0
- data/lib/gotransverse-tract-api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad0f7cec69fccec1d2df075d6c64fc61bd6c899d
|
4
|
+
data.tar.gz: 44f090c15f57dcdf69a9e5eac0427256f8b4cd17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58c48ef6e75d0e4cd5899d6975a4e970764d5f93753a7cdf638cff9c5a4e8044fa7fd7fa50b9a4ccbfc0e4a31c0d6ef091546af4f19b1d5de7de176d900ab1e4
|
7
|
+
data.tar.gz: 7e4039550c112ffb7505323da12e43fbd8d7ff4e92730ea0c60f94f7341cf50888e004d06093d7b65070a980a8c6316e530d1a3ffbfacf70b0f45fdda5fd39c2
|
@@ -123,10 +123,13 @@ module GoTransverseTractApi
|
|
123
123
|
#
|
124
124
|
# @param {Class} klass
|
125
125
|
# @param {Hash} api_params (optional)
|
126
|
+
# @param {String} request_body
|
127
|
+
# @param {String} command
|
126
128
|
#
|
127
|
-
def self.post_request_for(klass, api_params={})
|
129
|
+
def self.post_request_for(klass, api_params={}, request_body, command)
|
128
130
|
api_url = GoTransverseTractApi.get_api_url_for(klass)
|
129
|
-
|
131
|
+
api_url = "#{api_url}/#{command}"
|
132
|
+
self.call(api_url, api_params, :post, request_body)
|
130
133
|
end
|
131
134
|
|
132
135
|
#
|
@@ -134,10 +137,11 @@ module GoTransverseTractApi
|
|
134
137
|
#
|
135
138
|
# @param {Class} klass
|
136
139
|
# @param {Hash} api_params (optional)
|
140
|
+
# @param {String} request_body
|
137
141
|
#
|
138
|
-
def self.put_request_for(klass, api_params={})
|
142
|
+
def self.put_request_for(klass, api_params={}, request_body)
|
139
143
|
api_url = GoTransverseTractApi.get_api_url_for(klass)
|
140
|
-
self.call(api_url, api_params, :put)
|
144
|
+
self.call(api_url, api_params, :put, request_body)
|
141
145
|
end
|
142
146
|
|
143
147
|
private
|
@@ -171,23 +175,22 @@ module GoTransverseTractApi
|
|
171
175
|
# @param {String} api_url
|
172
176
|
# @param {Hash} api_params (optional)
|
173
177
|
# @param {String} method (optional)
|
178
|
+
# @param {String} request_body (optional, put/post requests only)
|
174
179
|
#
|
175
|
-
def self.call(api_url, api_params={}, method=:get)
|
180
|
+
def self.call(api_url, api_params={}, method=:get, request_body="")
|
176
181
|
|
177
182
|
headers = self.get_authentication_headers
|
178
183
|
|
179
184
|
# TODO: Camelize all keys in api_params Hash.
|
180
185
|
|
181
|
-
api_uri = URI.parse(api_url)
|
182
|
-
|
183
186
|
http_client = HTTPClient.new
|
184
187
|
case method
|
185
188
|
when :get
|
186
|
-
response = http_client.get(
|
189
|
+
response = http_client.get(api_url, api_params, headers)
|
187
190
|
when :post
|
188
|
-
response = http_client.post(
|
191
|
+
response = http_client.post(api_url, request_body, api_params, headers)
|
189
192
|
when :put
|
190
|
-
response = http_client.put(
|
193
|
+
response = http_client.put(api_url, request_body, api_params, headers)
|
191
194
|
end
|
192
195
|
|
193
196
|
Nokogiri::XML(response.body.to_s)
|
@@ -36,6 +36,22 @@ module GoTransverseTractApi
|
|
36
36
|
GoTransverseTractApi.get_response_for(self, {billing_account_eid: billing_account_eid})
|
37
37
|
end
|
38
38
|
|
39
|
+
#
|
40
|
+
# @param {Long} eid
|
41
|
+
# @param {Nokogiri::XML::Document} people
|
42
|
+
#
|
43
|
+
def self.update eid, people
|
44
|
+
GoTransverseTractApi.put_response_for(self, {eid: eid}, people.to_s)
|
45
|
+
end
|
46
|
+
|
47
|
+
#
|
48
|
+
# @param {Long} eid
|
49
|
+
# @param {Nokogiri::XML::Document} address
|
50
|
+
#
|
51
|
+
def self.add_address eid, address
|
52
|
+
GoTransverseTractApi.post_response_for(self, {eid: eid}, address.to_s, "addAddress")
|
53
|
+
end
|
54
|
+
|
39
55
|
end
|
40
56
|
|
41
57
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gotransverse-tract-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julien DeFrance
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|