3scale_client 2.6.1 → 2.7.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: 593092ff29ce5dffe0c5d1394c0f879d04b5c0b9
4
- data.tar.gz: 93907838adc4147c174bb648748fa9e2469db24a
3
+ metadata.gz: 8f639b2cd5fc3a94a43a71e46d25764a6069bcf3
4
+ data.tar.gz: e78be7244735a016e216f68de2df731fd0da658f
5
5
  SHA512:
6
- metadata.gz: ef225fb8331fcdac33b2b63ba27d93c760e3b621316b06169795e7dc8866fd401ae01f25cfe77175b4197badba6aac166d768e8d55ed5ddd5c9c5dc782ae36eb
7
- data.tar.gz: ae2145f23b2edc3bc9ff1e177a130190b8b10daa7cb762f2d3b623dac2f74d0888a917757ad541e9f27196b3524c950a9f154af72c53c9d54a7351a91fa33a3e
6
+ metadata.gz: 7a425a24452f22fbb738d07bccacaf3169db5ea0235839a3fb3bba7cb0c35c43a792dfece492ef989b4a8e681feff6975e7163e220c4ad04cc5ebb1a565a6486
7
+ data.tar.gz: ae3cd7543511cbd604ff4dbf930181c3e1dfbc34463b89a189bd933da4eac56a9d7c46fb677eecc7b14eb25de79a0c58761ef4ca6e3b9f30066ce9db37f68f6c
data/.travis.yml CHANGED
@@ -6,6 +6,7 @@ rvm:
6
6
  - 2.0.0
7
7
  - 2.1
8
8
  - 2.2
9
+ - 2.3.0
9
10
  - jruby
10
11
  matrix:
11
12
  include:
data/CHANGELOG.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
- ## [Unreleased][unreleased]
5
- ### Fixed
4
+ ## [2.7.0] - 2016-08-26
6
5
  ### Added
6
+ - Added support for 'user_key' authentication mode in 'report' method
7
7
 
8
8
  ## [2.6.1] - 2016-01-04
9
9
  ### Fixed
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.6.0
1
+ 2.7.0
data/lib/3scale/client.rb CHANGED
@@ -249,6 +249,7 @@ module ThreeScale
249
249
 
250
250
  OAUTH_PARAMS = [:app_id, :app_key, :service_id, :redirect_url]
251
251
  ALL_PARAMS = [:user_key, :app_id, :app_key, :service_id, :redirect_url]
252
+ REPORT_PARAMS = [:user_key, :app_id, :service_id, :timestamp]
252
253
 
253
254
  def options_to_params(options, allowed_keys)
254
255
  params = { :provider_key => provider_key }
@@ -268,9 +269,9 @@ module ThreeScale
268
269
  result = {}
269
270
 
270
271
  transactions.each_with_index do |transaction, index|
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])
272
+ REPORT_PARAMS.each do |param|
273
+ append_value(result, index, [param], transaction[param])
274
+ end
274
275
 
275
276
  transaction[:usage].each do |name, value|
276
277
  append_value(result, index, [:usage, name], value)
@@ -1,5 +1,5 @@
1
1
  module ThreeScale
2
2
  class Client
3
- VERSION = '2.6.1'
3
+ VERSION = '2.7.0'
4
4
  end
5
5
  end
data/test/client_test.rb CHANGED
@@ -370,6 +370,26 @@ class ThreeScale::ClientTest < MiniTest::Test
370
370
  assert_equal URI.encode_www_form(payload), request.body
371
371
  end
372
372
 
373
+ def test_report_supports_user_key
374
+ payload = {
375
+ 'transactions[0][user_key]' => 'foo',
376
+ 'transactions[0][timestamp]' => '2016-07-18 15:42:17 0200',
377
+ 'transactions[0][usage][hits]' => '1',
378
+ 'provider_key' => '1234abcd'
379
+ }
380
+
381
+ FakeWeb.register_uri(:post, "http://#{@host}/transactions.xml",
382
+ :status => ['200', 'OK'])
383
+
384
+ @client.report({:user_key => 'foo',
385
+ :usage => {'hits' => 1},
386
+ :timestamp => '2016-07-18 15:42:17 0200'})
387
+
388
+ request = FakeWeb.last_request
389
+
390
+ assert_equal URI.encode_www_form(payload), request.body
391
+ end
392
+
373
393
  def test_failed_report
374
394
  error_body = '<error code="provider_key_invalid">provider key "foo" is invalid</error>'
375
395
 
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.1
4
+ version: 2.7.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: 2016-01-04 00:00:00.000000000 Z
15
+ date: 2016-08-26 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.5.1
193
+ rubygems_version: 2.6.4
194
194
  signing_key:
195
195
  specification_version: 4
196
196
  summary: Client for 3scale Web Service Management System API