pisoni 1.28.0 → 1.29.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/3scale/core.rb +0 -1
- data/lib/3scale/core/version.rb +1 -1
- data/spec/utilization_spec.rb +0 -2
- metadata +2 -7
- data/lib/3scale/core/transaction.rb +0 -26
- data/spec/private_endpoints/transaction.rb +0 -16
- data/spec/transaction_spec.rb +0 -71
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f1ad974b6dcbbf155ca09a341c90299512b202c25be5d02313d8230b3643050
|
4
|
+
data.tar.gz: ceaaa69cfa602b690ab20f48dbc98bc46a2fdcfaa52f36330e1fd698b37a6bbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb81cdc2713b7be7ab6fd06983769df7f62b966816a0b71c7a97454ffb511ea059e896aca2bd6397b0bebeb7250b37616ade6f43d5fb6f680192891a85a8fd22
|
7
|
+
data.tar.gz: 268a297b87ac353451fe91a9b2963acd200e5c1a6470ac610989b21f13683d2ca32a939eb14b10ea6f893f9210dbdd89af85ac0bd7377a3c226410d8101d3f68
|
data/CHANGELOG.md
CHANGED
data/lib/3scale/core.rb
CHANGED
@@ -24,7 +24,6 @@ require '3scale/core/errors'
|
|
24
24
|
require '3scale/core/application_key'
|
25
25
|
require '3scale/core/application_referrer_filter'
|
26
26
|
require '3scale/core/service_error'
|
27
|
-
require '3scale/core/transaction'
|
28
27
|
require '3scale/core/utilization'
|
29
28
|
require '3scale/core/service_token'
|
30
29
|
|
data/lib/3scale/core/version.rb
CHANGED
data/spec/utilization_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pisoni
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.29.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alejandro Martinez Ruiz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -113,7 +113,6 @@ files:
|
|
113
113
|
- lib/3scale/core/service.rb
|
114
114
|
- lib/3scale/core/service_error.rb
|
115
115
|
- lib/3scale/core/service_token.rb
|
116
|
-
- lib/3scale/core/transaction.rb
|
117
116
|
- lib/3scale/core/usage_limit.rb
|
118
117
|
- lib/3scale/core/utilization.rb
|
119
118
|
- lib/3scale/core/version.rb
|
@@ -128,12 +127,10 @@ files:
|
|
128
127
|
- spec/metric_spec.rb
|
129
128
|
- spec/private_endpoints/event.rb
|
130
129
|
- spec/private_endpoints/service_error.rb
|
131
|
-
- spec/private_endpoints/transaction.rb
|
132
130
|
- spec/service_error_spec.rb
|
133
131
|
- spec/service_spec.rb
|
134
132
|
- spec/service_token_spec.rb
|
135
133
|
- spec/spec_helper.rb
|
136
|
-
- spec/transaction_spec.rb
|
137
134
|
- spec/usagelimit_spec.rb
|
138
135
|
- spec/utilization_spec.rb
|
139
136
|
homepage: https://github.com/3scale/pisoni
|
@@ -169,11 +166,9 @@ test_files:
|
|
169
166
|
- spec/metric_spec.rb
|
170
167
|
- spec/private_endpoints/event.rb
|
171
168
|
- spec/private_endpoints/service_error.rb
|
172
|
-
- spec/private_endpoints/transaction.rb
|
173
169
|
- spec/service_error_spec.rb
|
174
170
|
- spec/service_spec.rb
|
175
171
|
- spec/service_token_spec.rb
|
176
172
|
- spec/spec_helper.rb
|
177
|
-
- spec/transaction_spec.rb
|
178
173
|
- spec/usagelimit_spec.rb
|
179
174
|
- spec/utilization_spec.rb
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module ThreeScale
|
2
|
-
module Core
|
3
|
-
class Transaction < APIClient::Resource
|
4
|
-
attributes :application_id, :usage, :timestamp
|
5
|
-
|
6
|
-
default_uri '/internal/services/'
|
7
|
-
|
8
|
-
def self.transactions_uri(service_id)
|
9
|
-
"#{default_uri}#{service_id}/transactions/"
|
10
|
-
end
|
11
|
-
private_class_method :transactions_uri
|
12
|
-
|
13
|
-
def self.load_all(service_id)
|
14
|
-
result = api_do_get({}, { uri: transactions_uri(service_id),
|
15
|
-
rprefix: :transactions }) do |res|
|
16
|
-
return nil if res[:response].status == 404
|
17
|
-
true
|
18
|
-
end
|
19
|
-
|
20
|
-
return nil if result.nil?
|
21
|
-
|
22
|
-
APIClient::Collection.new(result[:attributes].map { |attrs| new attrs })
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module PrivateEndpoints
|
2
|
-
module Transaction
|
3
|
-
def save(service_id, transactions)
|
4
|
-
api_create(transactions,
|
5
|
-
{ uri: transactions_uri(service_id),
|
6
|
-
prefix: :transactions })
|
7
|
-
end
|
8
|
-
|
9
|
-
def delete_all(service_id)
|
10
|
-
api_delete({}, uri: transactions_uri(service_id))
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
ThreeScale::Core::Transaction.extend PrivateEndpoints::Transaction
|
16
|
-
|
data/spec/transaction_spec.rb
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
require_relative './spec_helper'
|
2
|
-
require_relative './private_endpoints/transaction'
|
3
|
-
|
4
|
-
module ThreeScale
|
5
|
-
module Core
|
6
|
-
describe Transaction do
|
7
|
-
before do
|
8
|
-
Service.delete_by_id!(service_id)
|
9
|
-
Service.save!(provider_key: 'foo_transaction_spec', id: service_id)
|
10
|
-
end
|
11
|
-
|
12
|
-
describe '.load_all' do
|
13
|
-
let(:service_id) { '7575_transaction_spec' }
|
14
|
-
let(:non_existing_service_id) { service_id.to_i.succ.to_s }
|
15
|
-
|
16
|
-
before do
|
17
|
-
Transaction.delete_all(service_id)
|
18
|
-
end
|
19
|
-
|
20
|
-
describe 'when there are transactions' do
|
21
|
-
let(:first_transaction_time) { Time.new(2015, 1, 1) }
|
22
|
-
let(:second_transaction_time) { Time.new(2015, 1, 2) }
|
23
|
-
let(:test_transactions) do
|
24
|
-
transactions = []
|
25
|
-
transactions << { application_id: 'first_test_application',
|
26
|
-
usage: 'first_usage',
|
27
|
-
timestamp: first_transaction_time.to_s }
|
28
|
-
transactions << { application_id: 'second_test_application',
|
29
|
-
usage: 'second_usage',
|
30
|
-
timestamp: second_transaction_time.to_s }
|
31
|
-
end
|
32
|
-
|
33
|
-
before do
|
34
|
-
Transaction.save(service_id, test_transactions)
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'returns a collection with the transactions' do
|
38
|
-
transactions = Transaction.load_all(service_id)
|
39
|
-
|
40
|
-
transactions.total.must_equal test_transactions.size
|
41
|
-
transactions.size.must_equal test_transactions.size
|
42
|
-
|
43
|
-
latest_transaction = transactions[0]
|
44
|
-
latest_transaction.application_id.must_equal test_transactions[1][:application_id]
|
45
|
-
latest_transaction.usage.must_equal test_transactions[1][:usage]
|
46
|
-
latest_transaction.timestamp.must_equal second_transaction_time
|
47
|
-
|
48
|
-
previous_transaction = transactions[1]
|
49
|
-
previous_transaction.application_id.must_equal test_transactions[0][:application_id]
|
50
|
-
previous_transaction.usage.must_equal test_transactions[0][:usage]
|
51
|
-
previous_transaction.timestamp.must_equal first_transaction_time
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
describe 'when there are no transactions' do
|
56
|
-
it 'returns an empty collection' do
|
57
|
-
transactions = Transaction.load_all(service_id)
|
58
|
-
transactions.must_be_empty
|
59
|
-
transactions.total.must_equal 0
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
describe 'with an invalid service ID' do
|
64
|
-
it 'returns nil' do
|
65
|
-
Transaction.load_all(non_existing_service_id).must_be_nil
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|