gotransverse-tract-api 0.0.13 → 0.0.14

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: cf46f577e8734e36f771885f3389489c4654fce8
4
- data.tar.gz: 25c3079d7656e024dbbef6c8dd6c4f66f69cca07
3
+ metadata.gz: ad0f7cec69fccec1d2df075d6c64fc61bd6c899d
4
+ data.tar.gz: 44f090c15f57dcdf69a9e5eac0427256f8b4cd17
5
5
  SHA512:
6
- metadata.gz: 060a07489fc88e898bed727c61ee76f0d904b57aa65f63f747a3fb83ad798ea1acada6dc18fcb16d3274fb7bbe099fe9c04ac0f0ac9580af33c836ab18af4ddd
7
- data.tar.gz: 5fb36b2e97c815ce453b1e08e6fb38e7bed30c63ab66c6718528ce667e01ff1cb312669bfa66a1b389c900501f1915f2210f50a29dd81fd566dbc2f3df176d2b
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
- self.call(api_url, api_params, :post)
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(api_uri, api_params, headers)
189
+ response = http_client.get(api_url, api_params, headers)
187
190
  when :post
188
- response = http_client.post(api_uri, api_params, headers)
191
+ response = http_client.post(api_url, request_body, api_params, headers)
189
192
  when :put
190
- response = http_client.put(api_uri, api_params, headers)
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
@@ -1,6 +1,6 @@
1
1
  module GoTransverseTractApi
2
2
 
3
- VERSION = "0.0.13"
3
+ VERSION = "0.0.14"
4
4
  TARGET_API_VERSION = "1.19"
5
5
 
6
6
  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.13
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-17 00:00:00.000000000 Z
11
+ date: 2015-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler