td-client 0.8.76 → 0.8.77

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bed709b18af78da0d5e9be3b5ff11e52cce7b631
4
- data.tar.gz: 3280f6e1a3fa77067adf1ef2695eb05b4b0cd30b
3
+ metadata.gz: 979926070464720f6bd1b6a59807be434867d11e
4
+ data.tar.gz: 4d091e61892417bdf7204db853959364bf22f73d
5
5
  SHA512:
6
- metadata.gz: 3bf28abf67a22673d54c387915701fc9775aeb82f02c1e92e9e73df4009656ba489d1c7089369aa6efa3909ddc50f81c6b45411cb56c190718a8cd8655af94f1
7
- data.tar.gz: c438cc9da912217589d01a3debca817d168eb4a7bdb6840c4c20ae17b8e25a8c2d56a87f481276beacadfc5132da65b3ac7b8c95f6161eea790838342ea093b5
6
+ metadata.gz: 0fc6cd57b053cfd3b88bcfe53e03014c65699a6fd95bd270dd3e35b67bdef565a212e643458283263deed4037775946b9f675859b959a22863c23d68460f775f
7
+ data.tar.gz: c23339a69564b86d9676f825706a49cafde1fb404e485a3e6a7d3eb64ed7051cd4efeddd63ce7288ece545d4ddb0b3a30e769ea9114b84d9e55dbac8eb3dcb38
@@ -251,7 +251,7 @@ private
251
251
  unless ENV['TD_CLIENT_DEBUG'].nil?
252
252
  puts "DEBUG: REST GET call:"
253
253
  puts "DEBUG: header: " + header.to_s
254
- puts "DEBUG: path: " + path.to_s
254
+ puts "DEBUG: path: " + target.to_s
255
255
  puts "DEBUG: params: " + params.to_s
256
256
  end
257
257
 
@@ -267,7 +267,7 @@ private
267
267
  if block
268
268
  current_total_chunk_size = 0
269
269
  response = client.get(target, params, header) {|res, chunk|
270
- current_total_chunk_size += chunk.size
270
+ current_total_chunk_size += chunk.bytesize
271
271
  block.call(res, chunk, current_total_chunk_size)
272
272
  }
273
273
 
@@ -278,7 +278,7 @@ private
278
278
  else
279
279
  response = client.get(target, params, header)
280
280
 
281
- validate_content_length!(response, response.body.size) if @ssl
281
+ validate_content_length!(response, response.body.bytesize) if @ssl
282
282
  end
283
283
 
284
284
  status = response.code
@@ -345,15 +345,15 @@ private
345
345
 
346
346
  # @param [String] url
347
347
  # @param [Hash] params
348
- def post(url, params=nil)
348
+ def post(url, params=nil, &block)
349
349
  guard_no_sslv3 do
350
- do_post(url, params)
350
+ do_post(url, params, &block)
351
351
  end
352
352
  end
353
353
 
354
354
  # @param [String] url
355
355
  # @param [Hash] params
356
- def do_post(url, params=nil)
356
+ def do_post(url, params=nil, &block)
357
357
  target = build_endpoint(url, @host)
358
358
 
359
359
  client, header = new_client
@@ -364,7 +364,7 @@ private
364
364
  unless ENV['TD_CLIENT_DEBUG'].nil?
365
365
  puts "DEBUG: REST POST call:"
366
366
  puts "DEBUG: header: " + header.to_s
367
- puts "DEBUG: path: " + (@base_path + url).to_s
367
+ puts "DEBUG: path: " + target.to_s
368
368
  puts "DEBUG: params: " + params.to_s
369
369
  end
370
370
 
@@ -411,6 +411,8 @@ private
411
411
  end
412
412
  end while false
413
413
 
414
+ body = block ? response.body : inflate_body(response)
415
+
414
416
  begin
415
417
  unless ENV['TD_CLIENT_DEBUG'].nil?
416
418
  puts "DEBUG: REST POST response:"
@@ -418,7 +420,7 @@ private
418
420
  puts "DEBUG: status: " + response.code.to_s
419
421
  puts "DEBUG: body: <omitted>"
420
422
  end
421
- return [response.code.to_s, response.body, response]
423
+ return [response.code.to_s, body, response]
422
424
  ensure
423
425
  # Disconnect keep-alive connection explicitly here, not by GC.
424
426
  client.reset(target) rescue nil
@@ -1,5 +1,5 @@
1
1
  module TreasureData
2
2
  class Client
3
- VERSION = '0.8.76'
3
+ VERSION = '0.8.77'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: td-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.76
4
+ version: 0.8.77
5
5
  platform: ruby
6
6
  authors:
7
7
  - Treasure Data, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-04 00:00:00.000000000 Z
11
+ date: 2015-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack