akamai_api 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/akamai_api/ccu.rb +8 -4
- data/lib/akamai_api/version.rb +1 -1
- data/spec/lib/akamai_api/ccu_spec.rb +36 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a91d1f5aebb3714f21a4983711443dc53d42c808
|
4
|
+
data.tar.gz: 55d3facb0f58d82c7f45e95476094a0162b9d1c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aaf0f4bd70819e4f9155a64557cb87c1c55c84a3ccc1d5161ffeadebbb3ea0da85c4aad9c336fce154c40793e5395c961265297bc3a82f40947616262d753f43
|
7
|
+
data.tar.gz: 93645a4059240cc6b97942f0d56ff5ca65ad90e69bb2e031f98d5d2aeeae2d411a4598acb3349e243fa96130793ac6b1ef8be76068890ee92ec459060599116c
|
data/lib/akamai_api/ccu.rb
CHANGED
@@ -8,13 +8,17 @@ module AkamaiApi
|
|
8
8
|
|
9
9
|
class << self
|
10
10
|
[:invalidate, :remove].each do |action|
|
11
|
-
send :define_method, action do |
|
12
|
-
|
11
|
+
send :define_method, action do |*params|
|
12
|
+
raise ArgumentError, "wrong number of arguments (#{params.length} for 2..3)" if params.length < 2
|
13
|
+
type, items, opts = params
|
14
|
+
purge action, type, items, (opts || {})
|
13
15
|
end
|
14
16
|
[:arl, :cpcode].each do |type|
|
15
17
|
method_name = "#{action}_#{type}".to_sym
|
16
|
-
send :define_method, method_name do |
|
17
|
-
|
18
|
+
send :define_method, method_name do |*params|
|
19
|
+
raise ArgumentError, "wrong number of arguments (#{params.length} for 1..2)" if params.length < 1
|
20
|
+
items, opts = params
|
21
|
+
purge action, type, items, (opts || {})
|
18
22
|
end
|
19
23
|
end
|
20
24
|
end
|
data/lib/akamai_api/version.rb
CHANGED
@@ -9,28 +9,50 @@ module AkamaiApi
|
|
9
9
|
stub_savon_model Ccu
|
10
10
|
end
|
11
11
|
|
12
|
-
|
13
|
-
it '
|
14
|
-
Ccu.
|
12
|
+
shared_examples 'purge helper' do
|
13
|
+
it 'responds with a CcuResponse object' do
|
14
|
+
Ccu.send(method, '12345').should be_a CcuResponse
|
15
15
|
end
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
context 'when data are correct' do
|
18
|
+
it 'returns the expected response code' do
|
19
|
+
Ccu.send(method, '12345').code.should == 100
|
20
|
+
end
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
it 'returns a successful message' do
|
23
|
+
Ccu.send(method, '12345').message.should == 'Success.'
|
24
|
+
end
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
|
26
|
+
it 'returns a unique session id' do
|
27
|
+
Ccu.send(method, '12345').session_id.should == '97870328-018c-11e2-aabc-489beabc489b'
|
28
|
+
end
|
28
29
|
|
29
|
-
|
30
|
-
|
30
|
+
it 'returns the estimated time in seconds' do
|
31
|
+
Ccu.send(method, '12345').estimated_time.should == 420
|
32
|
+
end
|
31
33
|
end
|
32
34
|
end
|
33
35
|
|
36
|
+
context '#invalidate_arl' do
|
37
|
+
let(:method) { 'invalidate_arl' }
|
38
|
+
it_should_behave_like 'purge helper'
|
39
|
+
end
|
40
|
+
|
41
|
+
context '#invalidate_cpcode' do
|
42
|
+
let(:method) { 'invalidate_cpcode' }
|
43
|
+
it_should_behave_like 'purge helper'
|
44
|
+
end
|
45
|
+
|
46
|
+
context '#remove_arl' do
|
47
|
+
let(:method) { 'remove_arl' }
|
48
|
+
it_should_behave_like 'purge helper'
|
49
|
+
end
|
50
|
+
|
51
|
+
context '#remove_cpcode' do
|
52
|
+
let(:method) { 'remove_cpcode' }
|
53
|
+
it_should_behave_like 'purge helper'
|
54
|
+
end
|
55
|
+
|
34
56
|
describe '#purge raises an error when' do
|
35
57
|
it 'action is not allowed' do
|
36
58
|
%w(invalidate remove).each do |action|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: akamai_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicola Racco
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|