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 +4 -4
- data/.travis.yml +1 -0
- data/CHANGELOG.md +2 -2
- data/VERSION +1 -1
- data/lib/3scale/client.rb +4 -3
- data/lib/3scale/client/version.rb +1 -1
- data/test/client_test.rb +20 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f639b2cd5fc3a94a43a71e46d25764a6069bcf3
|
4
|
+
data.tar.gz: e78be7244735a016e216f68de2df731fd0da658f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a425a24452f22fbb738d07bccacaf3169db5ea0235839a3fb3bba7cb0c35c43a792dfece492ef989b4a8e681feff6975e7163e220c4ad04cc5ebb1a565a6486
|
7
|
+
data.tar.gz: ae3cd7543511cbd604ff4dbf930181c3e1dfbc34463b89a189bd933da4eac56a9d7c46fb677eecc7b14eb25de79a0c58761ef4ca6e3b9f30066ce9db37f68f6c
|
data/.travis.yml
CHANGED
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
|
-
## [
|
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.
|
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
|
-
|
272
|
-
|
273
|
-
|
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)
|
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.
|
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-
|
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.
|
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
|