akamai_rest_ccu 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +17 -0
- data/.travis.yml +5 -0
- data/Gemfile +9 -0
- data/LICENSE.txt +22 -0
- data/README.md +33 -0
- data/Rakefile +1 -0
- data/akamai_rest_ccu.gemspec +23 -0
- data/lib/akamai_rest_ccu.rb +44 -0
- data/lib/akamai_rest_ccu/version.rb +3 -0
- data/spec/akamai_rest_ccu_spec.rb +19 -0
- data/spec/spec_helper.rb +2 -0
- metadata +85 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
OGU2OTFmNzFkYjRhZDdkNWY5NjE1MDk0MDgzODE3YTUwNjIxZjA3OQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MGRlOTQ4NzdiYmI1YzNiNGM5MTk0ZDU4ZGYyOGJhMTAzZDM2ZmUyOA==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NjdkMTdlNDdjNWQxOTI1YjZjNzE0ZTQ1NTRjZmRiOTJkOTBiNDcxMzUxNWUz
|
10
|
+
ZGZmYTk4OTE2ZDU2YTIwZTM3ZmRkMTljNzJmZDBlMzk5ODE5YTFlNmMxMDY1
|
11
|
+
N2EzMGI2MWFhYzllYWYyNWE5MTc4MzhkNmYzMmM0Y2I1YzdiYWE=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZTM4NWNmNjgyZjkwZjE5ZjcyNGY4ODE0MGQyYjNmYWI1ZWFiYWU1ZTNiZGJj
|
14
|
+
ZjIzNDQ5OTNmZTI5N2VlZDRjMmU5OWQ3ZDcyNzY2NWZiOTcxNzQ2ZWU0MWY3
|
15
|
+
M2I5NGY4OWQ2MWEzNTNmYzBlNGM2ZmFiYTZmMDE2MzFiZTJhNTM=
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Li Zhenchao
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# AkamaiRestCcu
|
2
|
+
|
3
|
+
This is the Ruby wrapper for Akamai restful CCU API
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'akamai_rest_ccu'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install akamai_rest_ccu
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
ccu = AkamaiRestCcu::Ccu.new("username", password")
|
22
|
+
ccu.purge_urls(["http://www.strikingly.com/jobs"])
|
23
|
+
ccu.purge_cpcode(['123456'], {:domain => 'staging'})
|
24
|
+
ccu.purge_status('/ccu/v2/purges/123a-def-123-891-99aebc3')
|
25
|
+
ccu.queue_length
|
26
|
+
|
27
|
+
## Contributing
|
28
|
+
|
29
|
+
1. Fork it ( https://github.com/strikingly/akamai_rest_ccu/fork )
|
30
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
31
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
32
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
33
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'akamai_rest_ccu/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "akamai_rest_ccu"
|
8
|
+
spec.version = AkamaiRestCcu::VERSION
|
9
|
+
spec.authors = ["Li Zhenchao"]
|
10
|
+
spec.email = ["zhenchao@strikingly.com"]
|
11
|
+
spec.summary = %q{Ruby library for Akamai CCU restful APIs}
|
12
|
+
spec.description = %q{akamai_rest_ccur is a wrapper around Akamai CCU restful APIs}
|
13
|
+
spec.homepage = "http://github.com/strikingly/akamai_rest_ccu"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require "akamai_rest_ccu/version"
|
2
|
+
require 'rest_client'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module AkamaiRestCcu
|
6
|
+
class Ccu
|
7
|
+
def initialize(username, password)
|
8
|
+
@username = username
|
9
|
+
@password = password
|
10
|
+
@base_url = "https://#{@username}:#{@password}@api.ccu.akamai.com"
|
11
|
+
end
|
12
|
+
|
13
|
+
def purge_urls(urls, opt = {})
|
14
|
+
url = "#{@base_url}/ccu/v2/queues/default"
|
15
|
+
params = {
|
16
|
+
:objects => urls
|
17
|
+
}.merge(opt)
|
18
|
+
response = RestClient.post url, params.to_json, :content_type => :json
|
19
|
+
JSON.load(response)
|
20
|
+
end
|
21
|
+
|
22
|
+
def purge_cpcodes(cpcodes, opt = {})
|
23
|
+
url = "#{@base_url}/ccu/v2/queues/default"
|
24
|
+
params = {
|
25
|
+
:type => "cpcode",
|
26
|
+
:objects => cpcodes
|
27
|
+
}.merge(opt)
|
28
|
+
response = RestClient.post url, params.to_json, :content_type => :json
|
29
|
+
JSON.load(response)
|
30
|
+
end
|
31
|
+
|
32
|
+
def purge_status(progress_uri)
|
33
|
+
url = "#{@base_url}#{progress_uri}"
|
34
|
+
response = RestClient.get url
|
35
|
+
JSON.load(response)
|
36
|
+
end
|
37
|
+
|
38
|
+
def queue_length
|
39
|
+
url = "#{@base_url}/ccu/v2/queues/default"
|
40
|
+
response = RestClient.get url
|
41
|
+
JSON.load(response)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe AkamaiRestCcu::Ccu do
|
4
|
+
let! (:ccu) { AkamaiRestCcu::Ccu.new('username', 'password') }
|
5
|
+
|
6
|
+
describe "Ccu" do
|
7
|
+
it "responds to purge_urls" do
|
8
|
+
expect(ccu).to respond_to(:purge_urls)
|
9
|
+
end
|
10
|
+
|
11
|
+
it "responds to purge_cpcodes" do
|
12
|
+
expect(ccu).to respond_to(:purge_cpcodes)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "responds to purge_status" do
|
16
|
+
expect(ccu).to respond_to(:purge_status)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: akamai_rest_ccu
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Li Zhenchao
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-05-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: akamai_rest_ccur is a wrapper around Akamai CCU restful APIs
|
42
|
+
email:
|
43
|
+
- zhenchao@strikingly.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- .travis.yml
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- akamai_rest_ccu.gemspec
|
55
|
+
- lib/akamai_rest_ccu.rb
|
56
|
+
- lib/akamai_rest_ccu/version.rb
|
57
|
+
- spec/akamai_rest_ccu_spec.rb
|
58
|
+
- spec/spec_helper.rb
|
59
|
+
homepage: http://github.com/strikingly/akamai_rest_ccu
|
60
|
+
licenses:
|
61
|
+
- MIT
|
62
|
+
metadata: {}
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ! '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
requirements: []
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 2.2.2
|
80
|
+
signing_key:
|
81
|
+
specification_version: 4
|
82
|
+
summary: Ruby library for Akamai CCU restful APIs
|
83
|
+
test_files:
|
84
|
+
- spec/akamai_rest_ccu_spec.rb
|
85
|
+
- spec/spec_helper.rb
|