gotransverse-tract-api 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gotransverse-tract-api.rb +12 -10
- 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: a256fcddce4972606eddf0e158634df4a8c9ddfd
|
4
|
+
data.tar.gz: a0761ea57d091a504088dfc6883faa777c2bb498
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0752873f7167c7b0cbe07a6952299055fcc607b31e73e7f219bbb5d6181c2c37ee262dd00fdc9f848a64cd98c49f51311575c05f1aa7573bc0befc8a19128edc
|
7
|
+
data.tar.gz: 9d9f4e87b3d4d4eb5af8dd488ee5599caf9a25417412f31e99e43741191b18d0f18349ea1251504460a47b5fc1fc92af9e0911673f4515a5530b78300d082f3a
|
@@ -103,9 +103,9 @@ module GoTransverseTractApi
|
|
103
103
|
# self.get_response_for
|
104
104
|
#
|
105
105
|
# @param {Class} klass
|
106
|
-
# @param {Hash} api_params
|
106
|
+
# @param {Hash} api_params (optional)
|
107
107
|
#
|
108
|
-
def self.get_response_for(klass, api_params)
|
108
|
+
def self.get_response_for(klass, api_params={})
|
109
109
|
|
110
110
|
api_url = GoTransverseTractApi.get_api_url_for(klass)
|
111
111
|
|
@@ -121,9 +121,9 @@ module GoTransverseTractApi
|
|
121
121
|
# self.post_request_for
|
122
122
|
#
|
123
123
|
# @param {Class} klass
|
124
|
-
# @param {Hash} api_params
|
124
|
+
# @param {Hash} api_params (optional)
|
125
125
|
#
|
126
|
-
def self.post_request_for(klass, api_params)
|
126
|
+
def self.post_request_for(klass, api_params={})
|
127
127
|
api_url = GoTransverseTractApi.get_api_url_for(klass)
|
128
128
|
self.call(api_url, api_params, :post)
|
129
129
|
end
|
@@ -132,9 +132,9 @@ module GoTransverseTractApi
|
|
132
132
|
# self.put_request_for
|
133
133
|
#
|
134
134
|
# @param {Class} klass
|
135
|
-
# @param {Hash} api_params
|
135
|
+
# @param {Hash} api_params (optional)
|
136
136
|
#
|
137
|
-
def self.put_request_for(klass, api_params)
|
137
|
+
def self.put_request_for(klass, api_params={})
|
138
138
|
api_url = GoTransverseTractApi.get_api_url_for(klass)
|
139
139
|
self.call(api_url, api_params, :put)
|
140
140
|
end
|
@@ -152,9 +152,9 @@ module GoTransverseTractApi
|
|
152
152
|
# self.get_cached_response_for
|
153
153
|
#
|
154
154
|
# @param {Class} klass
|
155
|
-
# @param {Hash} api_params
|
155
|
+
# @param {Hash} api_params (optional)
|
156
156
|
#
|
157
|
-
def self.get_cached_response_for(klass, api_params)
|
157
|
+
def self.get_cached_response_for(klass, api_params={})
|
158
158
|
key = "#{klass.classname}.#{api_params.sort}"
|
159
159
|
|
160
160
|
return Rails.cache.fetch(key, expires_in: 10.minutes) do
|
@@ -168,13 +168,15 @@ module GoTransverseTractApi
|
|
168
168
|
# self.call
|
169
169
|
#
|
170
170
|
# @param {String} api_url
|
171
|
-
# @param {Hash} api_params
|
171
|
+
# @param {Hash} api_params (optional)
|
172
172
|
# @param {String} method (optional)
|
173
173
|
#
|
174
|
-
def self.call(api_url, api_params, method=:get)
|
174
|
+
def self.call(api_url, api_params={}, method=:get)
|
175
175
|
|
176
176
|
headers = self.get_authentication_headers
|
177
177
|
|
178
|
+
# TODO: Recursively camelize all keys in api_params Hash.
|
179
|
+
|
178
180
|
http_client = HTTPClient.new
|
179
181
|
case method
|
180
182
|
when :get
|