mints 0.0.23 → 0.0.24
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/client.rb +48 -42
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 825f5aa3ced7f329fc47b7f6276e271e620b400b68cc257fcfac4185df953543
|
4
|
+
data.tar.gz: 9136839108a6d5d1ee3e8271ecfbe81f6550dd70c4e4e040249082b42ee3b7c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a05c9402ab40f78be94ec937db4b2cc1d91237f43ef10a3dd64aa338ec19ff95d9bd0a9fad7bbfcf939a7dfba09246c1627cdbce94462dc2afc0f418581bc3a
|
7
|
+
data.tar.gz: a3b352f0ac1b8c9ca527e370e02deba90417d510dda2c127616e319937277dc3102666eabcbd9b4d0c3763fbb3af16249076a50c044ddea9ecaab077f463985f
|
data/lib/client.rb
CHANGED
@@ -61,14 +61,7 @@ module Mints
|
|
61
61
|
if only_tracking
|
62
62
|
headers = {"Only-Tracking" => "true"}
|
63
63
|
#when is already in redis notify to California to register the object usage
|
64
|
-
cali_response = self.send("#{@scope}_#{action}", "#{full_url}", headers, compatibility_options)
|
65
|
-
if @debug
|
66
|
-
puts "CALI TRACKING RESPONSE: #{cali_response}"
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
if @debug
|
71
|
-
puts "REDIS RESPONSE: #{redis_response}"
|
64
|
+
#cali_response = self.send("#{@scope}_#{action}", "#{full_url}", headers, compatibility_options)
|
72
65
|
end
|
73
66
|
else
|
74
67
|
response = self.send("#{@scope}_#{action}", "#{full_url}", nil, compatibility_options)
|
@@ -95,13 +88,26 @@ module Mints
|
|
95
88
|
action = 'delete'
|
96
89
|
response = self.send("#{@scope}_#{action}", "#{full_url}", data, compatibility_options)
|
97
90
|
end
|
91
|
+
|
98
92
|
begin
|
99
93
|
if result_from_cache
|
94
|
+
if @debug
|
95
|
+
puts "Method: #{action} \nURL: #{url} \nOptions: #{options.to_json} \nOnly tracking: #{only_tracking} \nResponse from: REDIS"
|
96
|
+
if (data)
|
97
|
+
puts "Data: #{data.to_json}"
|
98
|
+
end
|
99
|
+
end
|
100
100
|
return JSON.parse(response)
|
101
101
|
else
|
102
102
|
if (response.response.code == "404")
|
103
103
|
raise 'NotFoundError'
|
104
104
|
end
|
105
|
+
if @debug
|
106
|
+
puts "Method: #{action} \nURL: #{url} \nOptions: #{options.to_json} \nOnly tracking: #{only_tracking} \nResponse from: CALI"
|
107
|
+
if (data)
|
108
|
+
puts "Data: #{data.to_json}"
|
109
|
+
end
|
110
|
+
end
|
105
111
|
return JSON.parse(response.body)
|
106
112
|
end
|
107
113
|
rescue
|
@@ -207,55 +213,55 @@ module Mints
|
|
207
213
|
##### HTTTP CLIENTS ######
|
208
214
|
# Simple HTTP GET
|
209
215
|
def http_get(url, headers = nil)
|
210
|
-
if @debug
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
end
|
216
|
+
# if @debug
|
217
|
+
# puts "Url:"
|
218
|
+
# puts url
|
219
|
+
# puts "Headers:"
|
220
|
+
# puts headers
|
221
|
+
# puts "Method: get"
|
222
|
+
# end
|
217
223
|
return headers ? HTTParty.get(url, :headers => headers) : HTTParty.get(url)
|
218
224
|
end
|
219
225
|
|
220
226
|
# Simple HTTP POST
|
221
227
|
def http_post(url, headers = nil, data = nil)
|
222
|
-
if @debug
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
end
|
228
|
+
# if @debug
|
229
|
+
# puts "Url:"
|
230
|
+
# puts url
|
231
|
+
# puts "Headers:"
|
232
|
+
# puts headers
|
233
|
+
# puts "Data:"
|
234
|
+
# puts data
|
235
|
+
# puts "Method: post"
|
236
|
+
# end
|
231
237
|
return headers ? HTTParty.post(url, :headers=> headers, :body => data) : HTTParty.post(url, :body => data)
|
232
238
|
end
|
233
239
|
|
234
240
|
# Simple HTTP PUT
|
235
241
|
def http_put(url, headers = nil, data = nil)
|
236
|
-
if @debug
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
end
|
242
|
+
# if @debug
|
243
|
+
# puts "Url:"
|
244
|
+
# puts url
|
245
|
+
# puts "Headers:"
|
246
|
+
# puts headers
|
247
|
+
# puts "Data:"
|
248
|
+
# puts data
|
249
|
+
# puts "Method: put"
|
250
|
+
# end
|
245
251
|
return headers ? HTTParty.put(url, :headers=> headers, :body => data) : HTTParty.put(url, :body => data)
|
246
252
|
end
|
247
253
|
|
248
254
|
# Simple HTTP DELETE
|
249
255
|
def http_delete(url, headers = nil, data = nil)
|
250
|
-
if @debug
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
end
|
256
|
+
# if @debug
|
257
|
+
# puts "Url:"
|
258
|
+
# puts url
|
259
|
+
# puts "Headers:"
|
260
|
+
# puts headers
|
261
|
+
# puts "Data:"
|
262
|
+
# puts data
|
263
|
+
# puts "Method: delete"
|
264
|
+
# end
|
259
265
|
return headers ? HTTParty.delete(url, :headers=> headers, :body => data) : HTTParty.delete(url, :body => data)
|
260
266
|
end
|
261
267
|
|