akamai_api 0.3.0 → 0.3.1
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/cli/ccu/arl.rb +23 -0
- data/lib/akamai_api/version.rb +1 -1
- data/spec/lib/akamai_api/cli/ccu/arl_spec.rb +40 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd1e48a3fd2c4b5e7a64c03bbe1f7e65395aec0f
|
4
|
+
data.tar.gz: 212bf8e510fa426b453463094a34da2a47c91def
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35ab110e7a21a81af43e66ca521af50388b784f774fd150a3249ef74d6fbadc7227771c0301efe316fdd2a1955f58500ba1c560b48ea455db4b2925a0191d6c0
|
7
|
+
data.tar.gz: 2d06963b02cfc69145d3c57a32b7d152f8ed99fed1728f4ce7615b3774f72f6d3e386606e01a9d29e558e60aab8cad38599a0c3522d932f3ad18bc7eb06e4332
|
@@ -22,6 +22,11 @@ module AkamaiApi::CLI::CCU
|
|
22
22
|
:desc => 'Optional argument used to specify the environment. Usually you will not need this option'
|
23
23
|
method_option :banner => "foo@foo.com bar@bar.com",
|
24
24
|
:desc => 'Email(s) used to send notification when the purge has been completed'
|
25
|
+
method_option :poll,
|
26
|
+
:desc => 'whether or not to poll for status',
|
27
|
+
:type => :boolean,
|
28
|
+
:default => false
|
29
|
+
|
25
30
|
def invalidate(*arls)
|
26
31
|
purge_action :invalidate, arls
|
27
32
|
end
|
@@ -32,11 +37,29 @@ module AkamaiApi::CLI::CCU
|
|
32
37
|
load_config
|
33
38
|
res = AkamaiApi::CCU.purge type, :arl, arls, :domain => options[:domain]
|
34
39
|
puts PurgeRenderer.new(res).render
|
40
|
+
|
41
|
+
if options[:poll] == true && res.code == 201
|
42
|
+
poll_status res
|
43
|
+
end
|
35
44
|
rescue AkamaiApi::CCU::Error
|
36
45
|
puts StatusRenderer.new($!).render_error
|
37
46
|
rescue AkamaiApi::Unauthorized
|
38
47
|
puts 'Your login credentials are invalid.'
|
39
48
|
end
|
40
49
|
end
|
50
|
+
|
51
|
+
no_commands do
|
52
|
+
def poll_status purge_response
|
53
|
+
if purge_response.time_to_wait
|
54
|
+
status = AkamaiApi::CCU.status purge_response.uri
|
55
|
+
while status.completed_at.nil?
|
56
|
+
puts StatusRenderer.new(status).render
|
57
|
+
sleep 60
|
58
|
+
status = AkamaiApi::CCU.status purge_response.uri
|
59
|
+
end
|
60
|
+
end
|
61
|
+
puts StatusRenderer.new(status).render
|
62
|
+
end
|
63
|
+
end
|
41
64
|
end
|
42
65
|
end
|
data/lib/akamai_api/version.rb
CHANGED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module AkamaiApi
|
4
|
+
describe CLI::CCU::Arl do
|
5
|
+
describe 'invalidate' do
|
6
|
+
it 'polls for status' do
|
7
|
+
arl = CLI::CCU::Arl.new
|
8
|
+
|
9
|
+
allow(arl).to receive(:load_config)
|
10
|
+
allow(arl).to receive(:options).and_return({:poll => true})
|
11
|
+
|
12
|
+
res = double()
|
13
|
+
expect(CCU).to receive(:purge).and_return(res)
|
14
|
+
|
15
|
+
expect(res).to receive(:code).and_return(201)
|
16
|
+
expect(res).to receive(:time_to_wait).and_return(true)
|
17
|
+
|
18
|
+
renderer = double()
|
19
|
+
allow(renderer).to receive(:render)
|
20
|
+
allow(CLI::CCU::PurgeRenderer).to receive(:new).and_return(renderer)
|
21
|
+
|
22
|
+
status_res1 = double()
|
23
|
+
allow(status_res1).to receive(:code).and_return(201)
|
24
|
+
|
25
|
+
status_res2 = double()
|
26
|
+
allow(status_res2).to receive(:completed_at).and_return(nil, nil, true)
|
27
|
+
|
28
|
+
allow(CLI::CCU::StatusRenderer).to receive(:new).and_return(renderer)
|
29
|
+
|
30
|
+
allow(res).to receive(:uri).and_return("status_uri")
|
31
|
+
|
32
|
+
expect(CCU).to receive(:status).exactly(3).times.with("status_uri").and_return(status_res2)
|
33
|
+
|
34
|
+
expect(arl).to receive(:sleep).exactly(2).times.with(60)
|
35
|
+
|
36
|
+
arl.invalidate("test_uri")
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
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.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicola Racco
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -238,6 +238,7 @@ files:
|
|
238
238
|
- spec/lib/akamai_api/ccu/status/request_spec.rb
|
239
239
|
- spec/lib/akamai_api/ccu/status/response_spec.rb
|
240
240
|
- spec/lib/akamai_api/ccu_spec.rb
|
241
|
+
- spec/lib/akamai_api/cli/ccu/arl_spec.rb
|
241
242
|
- spec/lib/akamai_api/cli/ccu/status_renderer_spec.rb
|
242
243
|
- spec/lib/akamai_api/eccu/destroy_request_spec.rb
|
243
244
|
- spec/lib/akamai_api/eccu/find_request_spec.rb
|
@@ -269,7 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
269
270
|
version: '0'
|
270
271
|
requirements: []
|
271
272
|
rubyforge_project:
|
272
|
-
rubygems_version: 2.
|
273
|
+
rubygems_version: 2.4.6
|
273
274
|
signing_key:
|
274
275
|
specification_version: 4
|
275
276
|
summary: Ruby toolkit to work with Akamai Content Control Utility API
|
@@ -314,6 +315,7 @@ test_files:
|
|
314
315
|
- spec/lib/akamai_api/ccu/status/request_spec.rb
|
315
316
|
- spec/lib/akamai_api/ccu/status/response_spec.rb
|
316
317
|
- spec/lib/akamai_api/ccu_spec.rb
|
318
|
+
- spec/lib/akamai_api/cli/ccu/arl_spec.rb
|
317
319
|
- spec/lib/akamai_api/cli/ccu/status_renderer_spec.rb
|
318
320
|
- spec/lib/akamai_api/eccu/destroy_request_spec.rb
|
319
321
|
- spec/lib/akamai_api/eccu/find_request_spec.rb
|