akamai_api 0.0.2 → 0.0.3
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.
- data/.gitignore +1 -0
- data/README.md +8 -4
- data/bin/akamai_api +1 -16
- data/lib/akamai_api/cli.rb +1 -1
- data/lib/akamai_api/cli/app.rb +18 -0
- data/lib/akamai_api/cp_code.rb +3 -1
- data/lib/akamai_api/eccu_request.rb +1 -1
- data/lib/akamai_api/version.rb +1 -1
- data/spec/fixtures/get_cp_codes/sample_one_item.xml +16 -0
- data/spec/lib/akamai_api/cp_code_spec.rb +18 -0
- data/spec/lib/akamai_api/eccu_request_spec.rb +5 -0
- metadata +7 -4
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -177,13 +177,17 @@ Use the ::publish method to publish an ECCU Request:
|
|
177
177
|
|
178
178
|
You can specify the following optional arguments in args: file_name, notes, version, emails, property_type, property_exact_match
|
179
179
|
|
180
|
-
#
|
180
|
+
# Contributing
|
181
181
|
|
182
|
-
|
182
|
+
- Clone this repository
|
183
|
+
- Run 'bundle install --binstubs=bin/stubs'
|
184
|
+
- To run the specs, create the file spec/auth.rb with the following content:
|
183
185
|
|
184
|
-
```ruby
|
186
|
+
```ruby
|
185
187
|
# Fill the following with your akamai login before running your spec
|
186
188
|
AkamaiApi.config.merge!({
|
187
189
|
:auth => ['user', 'pass']
|
188
190
|
})
|
189
|
-
```
|
191
|
+
```
|
192
|
+
|
193
|
+
- Run specs with `thor spec`
|
data/bin/akamai_api
CHANGED
@@ -4,19 +4,4 @@ require 'active_support/core_ext'
|
|
4
4
|
require 'akamai_api'
|
5
5
|
require 'akamai_api/cli'
|
6
6
|
|
7
|
-
|
8
|
-
desc 'ccu', 'CCU Interface'
|
9
|
-
subcommand 'ccu', AkamaiApi::Cli::Ccu
|
10
|
-
|
11
|
-
desc 'eccu', 'ECCU Interface'
|
12
|
-
subcommand 'eccu', AkamaiApi::Cli::Eccu
|
13
|
-
|
14
|
-
def help *args
|
15
|
-
puts
|
16
|
-
puts "AkamaiApi is a command line utility to interact with Akamai CCU (Content Control Utility) and ECCU (Enhanced Content Control Utility) services."
|
17
|
-
puts
|
18
|
-
super
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
AkamaiApiCommand.start
|
7
|
+
AkamaiApi::Cli::App.start
|
data/lib/akamai_api/cli.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
module AkamaiApi
|
2
|
+
module Cli
|
3
|
+
class App < Thor
|
4
|
+
desc 'ccu', 'CCU Interface'
|
5
|
+
subcommand 'ccu', AkamaiApi::Cli::Ccu
|
6
|
+
|
7
|
+
desc 'eccu', 'ECCU Interface'
|
8
|
+
subcommand 'eccu', AkamaiApi::Cli::Eccu
|
9
|
+
|
10
|
+
def help *args
|
11
|
+
puts
|
12
|
+
puts "AkamaiApi is a command line utility to interact with Akamai CCU (Content Control Utility) and ECCU (Enhanced Content Control Utility) services."
|
13
|
+
puts
|
14
|
+
super
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/akamai_api/cp_code.rb
CHANGED
@@ -14,7 +14,9 @@ module AkamaiApi
|
|
14
14
|
|
15
15
|
def self.all
|
16
16
|
basic_auth *AkamaiApi.config[:auth]
|
17
|
-
client.request('getCPCodes').body[:multi_ref]
|
17
|
+
response = client.request('getCPCodes').body[:multi_ref]
|
18
|
+
|
19
|
+
Array.wrap(response).map do |hash|
|
18
20
|
new({
|
19
21
|
:code => hash[:cpcode],
|
20
22
|
:description => hash[:description],
|
data/lib/akamai_api/version.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
3
|
+
<soapenv:Body>
|
4
|
+
<getCPCodesResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
5
|
+
<getCPCodesReturn soapenc:arrayType="ns1:CPCodeInfo[34]" xsi:type="soapenc:Array" xmlns:ns1="https://control.akamai.com/Data.xsd" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
|
6
|
+
<getCPCodesReturn href="#id0"/>
|
7
|
+
<getCPCodesReturn href="#id1"/>
|
8
|
+
</getCPCodesReturn>
|
9
|
+
</getCPCodesResponse>
|
10
|
+
<multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:CPCodeInfo" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="https://control.akamai.com/Data.xsd">
|
11
|
+
<cpcode xsi:type="xsd:int">12345</cpcode>
|
12
|
+
<description xsi:type="xsd:string">Foo Site</description>
|
13
|
+
<service xsi:type="xsd:string">Site_Accel::Site_Accel</service>
|
14
|
+
</multiRef>
|
15
|
+
</soapenv:Body>
|
16
|
+
</soapenv:Envelope>
|
@@ -15,11 +15,29 @@ module AkamaiApi
|
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'should correctly fill each object' do
|
18
|
+
CpCode.all.count.should == 2
|
19
|
+
|
18
20
|
model = CpCode.all.first
|
19
21
|
model.code.should == '12345'
|
20
22
|
model.description.should == 'Foo Site'
|
21
23
|
model.service.should == 'Site_Accel::Site_Accel'
|
22
24
|
end
|
25
|
+
|
26
|
+
describe '::only one item' do
|
27
|
+
before do
|
28
|
+
savon.expects('getCPCodes').returns(:sample_one_item)
|
29
|
+
stub_savon_model CpCode
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should correctly fill when we have only one cp on return' do
|
33
|
+
CpCode.all.count.should == 1
|
34
|
+
|
35
|
+
model = CpCode.all.first
|
36
|
+
model.code.should == '12345'
|
37
|
+
model.description.should == 'Foo Site'
|
38
|
+
model.service.should == 'Site_Accel::Site_Accel'
|
39
|
+
end
|
40
|
+
end
|
23
41
|
end
|
24
42
|
end
|
25
43
|
end
|
@@ -63,6 +63,11 @@ module AkamaiApi
|
|
63
63
|
EccuRequest.should_receive(:find).with('b', anything()).and_return(:b)
|
64
64
|
EccuRequest.all.should =~ [:a, :b]
|
65
65
|
end
|
66
|
+
it 'returns the detail for each enlisted id even if only one id is returned' do
|
67
|
+
EccuRequest.stub! :all_ids => "a"
|
68
|
+
EccuRequest.should_receive(:find).with('a', anything()).and_return(:a)
|
69
|
+
EccuRequest.all.should =~ [:a]
|
70
|
+
end
|
66
71
|
end
|
67
72
|
|
68
73
|
describe 'publishing' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-03-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -139,6 +139,7 @@ files:
|
|
139
139
|
- lib/akamai_api/ccu.rb
|
140
140
|
- lib/akamai_api/ccu_response.rb
|
141
141
|
- lib/akamai_api/cli.rb
|
142
|
+
- lib/akamai_api/cli/app.rb
|
142
143
|
- lib/akamai_api/cli/ccu.rb
|
143
144
|
- lib/akamai_api/cli/ccu_arl.rb
|
144
145
|
- lib/akamai_api/cli/ccu_cp_code.rb
|
@@ -152,6 +153,7 @@ files:
|
|
152
153
|
- spec/fixtures/delete/success.xml
|
153
154
|
- spec/fixtures/eccu_request.xml
|
154
155
|
- spec/fixtures/get_cp_codes/sample.xml
|
156
|
+
- spec/fixtures/get_cp_codes/sample_one_item.xml
|
155
157
|
- spec/fixtures/get_ids/success.xml
|
156
158
|
- spec/fixtures/get_info/success.xml
|
157
159
|
- spec/fixtures/set_notes/success.xml
|
@@ -180,7 +182,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
180
182
|
version: '0'
|
181
183
|
segments:
|
182
184
|
- 0
|
183
|
-
hash: -
|
185
|
+
hash: -381323867441421978
|
184
186
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
185
187
|
none: false
|
186
188
|
requirements:
|
@@ -189,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
191
|
version: '0'
|
190
192
|
segments:
|
191
193
|
- 0
|
192
|
-
hash: -
|
194
|
+
hash: -381323867441421978
|
193
195
|
requirements: []
|
194
196
|
rubyforge_project:
|
195
197
|
rubygems_version: 1.8.24
|
@@ -200,6 +202,7 @@ test_files:
|
|
200
202
|
- spec/fixtures/delete/success.xml
|
201
203
|
- spec/fixtures/eccu_request.xml
|
202
204
|
- spec/fixtures/get_cp_codes/sample.xml
|
205
|
+
- spec/fixtures/get_cp_codes/sample_one_item.xml
|
203
206
|
- spec/fixtures/get_ids/success.xml
|
204
207
|
- spec/fixtures/get_info/success.xml
|
205
208
|
- spec/fixtures/set_notes/success.xml
|