3scale_client 2.5.0 → 2.6.0

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: 303ebb36b8ecc494d886bfd138dab48c971ac2df
4
- data.tar.gz: ce3cec845d48ee1fb376fa98b5f07d5eb4f285e9
3
+ metadata.gz: eafe101dd72cc961938abaf17d09052111b9d15c
4
+ data.tar.gz: 129167bf9d3634b14419156acf1e63a331dc3999
5
5
  SHA512:
6
- metadata.gz: e28bdc9a3e385adb6b7f7facb3008a49c626c023965fc36aab95d3292d0818121d4a0fa61afaed68c1ae630ade4c7e57632a3625f1407d6be5817814cd44204d
7
- data.tar.gz: fa3a5341087146e026d460d3868dc2adcc72926dcee77131c8c72820d2a79cb658eefca0e15d218c83cd555efc7f90599e7ffe21511d9666a74bda9ead0d0a3f
6
+ metadata.gz: c2ab554edee66aa884bac24b9b26ab9a34f40d486f3c38662dc8aaa2e26a309190807120043a11edc32472d98d60b08edf852b739c3ad98fc4f0e447118bceca
7
+ data.tar.gz: 7f244c5699e88b858e94d9cb416180ebca0c29d0b4622bca6b658387a529e43efb22ceb71430a525ba8a2399fc70f71f1be6a57478a10f774e725702b6fb2229
data/CHANGELOG.md CHANGED
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
5
5
  ### Fixed
6
6
  ### Added
7
7
 
8
+ ## [2.6.0] - 2015-12-28
9
+
10
+ ### Added
11
+ - Include 'log' field in transactions reported with 'report' method
12
+
8
13
  ## [2.5.0] - 2015-12-14
9
14
  No changes. Stable release.
10
15
 
data/README.md CHANGED
@@ -119,18 +119,6 @@ class ApplicationController < ActionController
119
119
  end
120
120
  ```
121
121
 
122
- ### Using Varnish to speed up things
123
-
124
- 3scale provides a [varnish module](https://github.com/3scale/libvmod-3scale) to cache the responses of its backend to help you achieve a close to zero latency. Go and install the module and [configure it the easy way](https://github.com/3scale/libvmod-3scale/blob/master/vcl/default_3scale_simple.vcl)
125
-
126
- When that's done all you have to do is to initialize your 3scale client pointing to the location of your varnish, by passing the host parameter to it, like this:
127
-
128
- ```ruby
129
- client = ThreeScale::Client.new(:provider_key => "your provider key", :host => "your.varnish.net:8080")
130
- ```
131
-
132
- that's it, your API should now be authorized and reported for you, and all that at full speed.
133
-
134
122
  ### Authorize
135
123
 
136
124
  To authorize an application, call the +authorize+ method passing it the application's id and
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.5.0
1
+ 2.6.0
data/lib/3scale/client.rb CHANGED
@@ -275,6 +275,10 @@ module ThreeScale
275
275
  transaction[:usage].each do |name, value|
276
276
  append_encoded_value(result, index, [:usage, name], value)
277
277
  end
278
+
279
+ transaction.fetch(:log, {}).each do |name, value|
280
+ append_encoded_value(result, index, [:log, name], value)
281
+ end
278
282
  end
279
283
 
280
284
  result
@@ -1,5 +1,5 @@
1
1
  module ThreeScale
2
2
  class Client
3
- VERSION = '2.5.0'
3
+ VERSION = '2.6.0'
4
4
  end
5
5
  end
data/test/client_test.rb CHANGED
@@ -5,7 +5,7 @@ require 'mocha/setup'
5
5
 
6
6
  require '3scale/client'
7
7
 
8
- class ThreeScale::ClientTest < MiniTest::Unit::TestCase
8
+ class ThreeScale::ClientTest < MiniTest::Test
9
9
 
10
10
  def client(options = {})
11
11
  ThreeScale::Client.new({:provider_key => '1234abcd'}.merge(options))
@@ -342,6 +342,9 @@ class ThreeScale::ClientTest < MiniTest::Unit::TestCase
342
342
  'transactions[0][app_id]' => 'foo',
343
343
  'transactions[0][timestamp]' => CGI.escape('2010-04-27 15:42:17 0200'),
344
344
  'transactions[0][usage][hits]' => '1',
345
+ 'transactions[0][log][request]' => 'foo',
346
+ 'transactions[0][log][response]' => 'bar',
347
+ 'transactions[0][log][code]' => '200',
345
348
  'transactions[1][app_id]' => 'bar',
346
349
  'transactions[1][timestamp]' => CGI.escape('2010-04-27 15:55:12 0200'),
347
350
  'transactions[1][usage][hits]' => '1',
@@ -354,7 +357,13 @@ class ThreeScale::ClientTest < MiniTest::Unit::TestCase
354
357
 
355
358
  @client.report({:app_id => 'foo',
356
359
  :usage => {'hits' => 1},
357
- :timestamp => '2010-04-27 15:42:17 0200'},
360
+ :timestamp => '2010-04-27 15:42:17 0200',
361
+ :log => {
362
+ 'request' => 'foo',
363
+ 'response' => 'bar',
364
+ 'code' => 200,
365
+ }
366
+ },
358
367
 
359
368
  {:app_id => 'bar',
360
369
  :usage => {'hits' => 1},
@@ -2,7 +2,7 @@ require 'minitest/autorun'
2
2
  require '3scale/middleware'
3
3
  require 'mocha/setup'
4
4
 
5
- class ThreeScale::MiddlewareTest < MiniTest::Unit::TestCase
5
+ class ThreeScale::MiddlewareTest < MiniTest::Test
6
6
 
7
7
  def setup
8
8
  @app = ->(_env) { [ 200, {}, ['']] }
@@ -4,7 +4,7 @@ require '3scale/client'
4
4
  require 'mocha/setup'
5
5
 
6
6
  if ENV['TEST_3SCALE_PROVIDER_KEY'] && ENV['TEST_3SCALE_APP_IDS'] && ENV['TEST_3SCALE_APP_KEYS']
7
- class ThreeScale::NetHttpPersistenceTest < MiniTest::Unit::TestCase
7
+ class ThreeScale::NetHttpPersistenceTest < MiniTest::Test
8
8
  def setup
9
9
  ThreeScale::Client::HTTPClient.persistent_backend = ThreeScale::Client::HTTPClient::NetHttpPersistent
10
10
 
data/test/remote_test.rb CHANGED
@@ -4,7 +4,7 @@ require '3scale/client'
4
4
  if ENV['TEST_3SCALE_PROVIDER_KEY'] &&
5
5
  ENV['TEST_3SCALE_APP_IDS'] &&
6
6
  ENV['TEST_3SCALE_APP_KEYS']
7
- class ThreeScale::RemoteTest < MiniTest::Unit::TestCase
7
+ class ThreeScale::RemoteTest < MiniTest::Test
8
8
  def setup
9
9
  @provider_key = ENV['TEST_3SCALE_PROVIDER_KEY']
10
10
 
@@ -82,7 +82,9 @@ if ENV['TEST_3SCALE_PROVIDER_KEY'] &&
82
82
 
83
83
  def test_successful_report
84
84
  transactions = @app_ids.map do |app_id|
85
- {:app_id => app_id, :usage => {'hits' => 1}}
85
+ {:app_id => app_id,
86
+ :usage => {'hits' => 1},
87
+ :log => {:request => "a/a", :response => "b/b", :code => 200 }}
86
88
  end
87
89
 
88
90
  response = @client.report(*transactions)
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.5.0
4
+ version: 2.6.0
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-14 00:00:00.000000000 Z
15
+ date: 2015-12-28 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: bundler