3scale_client 2.6.0 → 2.6.1

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: eafe101dd72cc961938abaf17d09052111b9d15c
4
- data.tar.gz: 129167bf9d3634b14419156acf1e63a331dc3999
3
+ metadata.gz: 593092ff29ce5dffe0c5d1394c0f879d04b5c0b9
4
+ data.tar.gz: 93907838adc4147c174bb648748fa9e2469db24a
5
5
  SHA512:
6
- metadata.gz: c2ab554edee66aa884bac24b9b26ab9a34f40d486f3c38662dc8aaa2e26a309190807120043a11edc32472d98d60b08edf852b739c3ad98fc4f0e447118bceca
7
- data.tar.gz: 7f244c5699e88b858e94d9cb416180ebca0c29d0b4622bca6b658387a529e43efb22ceb71430a525ba8a2399fc70f71f1be6a57478a10f774e725702b6fb2229
6
+ metadata.gz: ef225fb8331fcdac33b2b63ba27d93c760e3b621316b06169795e7dc8866fd401ae01f25cfe77175b4197badba6aac166d768e8d55ed5ddd5c9c5dc782ae36eb
7
+ data.tar.gz: ae2145f23b2edc3bc9ff1e177a130190b8b10daa7cb762f2d3b623dac2f74d0888a917757ad541e9f27196b3524c950a9f154af72c53c9d54a7351a91fa33a3e
data/CHANGELOG.md CHANGED
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
5
5
  ### Fixed
6
6
  ### Added
7
7
 
8
+ ## [2.6.1] - 2016-01-04
9
+ ### Fixed
10
+ - Fixed double escaping of post parameters (https://github.com/3scale/3scale_ws_api_for_ruby/pull/24)
11
+
8
12
  ## [2.6.0] - 2015-12-28
9
13
 
10
14
  ### Added
data/lib/3scale/client.rb CHANGED
@@ -268,24 +268,24 @@ module ThreeScale
268
268
  result = {}
269
269
 
270
270
  transactions.each_with_index do |transaction, index|
271
- append_encoded_value(result, index, [:app_id], transaction[:app_id])
272
- append_encoded_value(result, index, [:timestamp], transaction[:timestamp])
273
- append_encoded_value(result, index, [:client_ip], transaction[:client_ip])
271
+ append_value(result, index, [:app_id], transaction[:app_id])
272
+ append_value(result, index, [:timestamp], transaction[:timestamp])
273
+ append_value(result, index, [:client_ip], transaction[:client_ip])
274
274
 
275
275
  transaction[:usage].each do |name, value|
276
- append_encoded_value(result, index, [:usage, name], value)
276
+ append_value(result, index, [:usage, name], value)
277
277
  end
278
278
 
279
279
  transaction.fetch(:log, {}).each do |name, value|
280
- append_encoded_value(result, index, [:log, name], value)
280
+ append_value(result, index, [:log, name], value)
281
281
  end
282
282
  end
283
283
 
284
284
  result
285
285
  end
286
286
 
287
- def append_encoded_value(result, index, names, value)
288
- result["transactions[#{index}][#{names.join('][')}]"] = CGI.escape(value.to_s) if value
287
+ def append_value(result, index, names, value)
288
+ result["transactions[#{index}][#{names.join('][')}]"] = value if value
289
289
  end
290
290
 
291
291
  def build_report_response
@@ -1,5 +1,5 @@
1
1
  module ThreeScale
2
2
  class Client
3
- VERSION = '2.6.0'
3
+ VERSION = '2.6.1'
4
4
  end
5
5
  end
data/test/client_test.rb CHANGED
@@ -335,25 +335,21 @@ class ThreeScale::ClientTest < MiniTest::Test
335
335
  end
336
336
 
337
337
  def test_report_encodes_transactions
338
- http_response = stub
339
- Net::HTTPSuccess.stubs(:===).with(http_response).returns(true)
340
-
341
338
  payload = {
342
339
  'transactions[0][app_id]' => 'foo',
343
- 'transactions[0][timestamp]' => CGI.escape('2010-04-27 15:42:17 0200'),
340
+ 'transactions[0][timestamp]' => '2010-04-27 15:42:17 0200',
344
341
  'transactions[0][usage][hits]' => '1',
345
342
  'transactions[0][log][request]' => 'foo',
346
343
  'transactions[0][log][response]' => 'bar',
347
344
  'transactions[0][log][code]' => '200',
348
345
  'transactions[1][app_id]' => 'bar',
349
- 'transactions[1][timestamp]' => CGI.escape('2010-04-27 15:55:12 0200'),
346
+ 'transactions[1][timestamp]' => Time.local(2010, 4, 27, 15, 00).to_s,
350
347
  'transactions[1][usage][hits]' => '1',
351
348
  'provider_key' => '1234abcd'
352
349
  }
353
350
 
354
- @client.http.expects(:post)
355
- .with('/transactions.xml', payload)
356
- .returns(http_response)
351
+ FakeWeb.register_uri(:post, "http://#{@host}/transactions.xml",
352
+ :status => ['200', 'OK'])
357
353
 
358
354
  @client.report({:app_id => 'foo',
359
355
  :usage => {'hits' => 1},
@@ -367,7 +363,11 @@ class ThreeScale::ClientTest < MiniTest::Test
367
363
 
368
364
  {:app_id => 'bar',
369
365
  :usage => {'hits' => 1},
370
- :timestamp => '2010-04-27 15:55:12 0200'})
366
+ :timestamp => Time.local(2010, 4, 27, 15, 00)})
367
+
368
+ request = FakeWeb.last_request
369
+
370
+ assert_equal URI.encode_www_form(payload), request.body
371
371
  end
372
372
 
373
373
  def test_failed_report
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: 3scale_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.0
4
+ version: 2.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michal Cichra
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2015-12-28 00:00:00.000000000 Z
15
+ date: 2016-01-04 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: bundler
@@ -190,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
190
  version: '0'
191
191
  requirements: []
192
192
  rubyforge_project:
193
- rubygems_version: 2.4.8
193
+ rubygems_version: 2.5.1
194
194
  signing_key:
195
195
  specification_version: 4
196
196
  summary: Client for 3scale Web Service Management System API