edgecast_api 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +21 -0
- data/LICENCE.txt +20 -0
- data/README.md +50 -0
- data/Rakefile +2 -0
- data/edgecast_api.gemspec +23 -0
- data/lib/edgecast_api.rb +2 -0
- data/lib/edgecast_api/edgecast_api.rb +25 -0
- data/lib/edgecast_api/version.rb +3 -0
- metadata +86 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
edgecast_api (0.0.1)
|
5
|
+
httparty
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
httparty (0.8.3)
|
11
|
+
multi_json (~> 1.0)
|
12
|
+
multi_xml
|
13
|
+
multi_json (1.3.5)
|
14
|
+
multi_xml (0.5.1)
|
15
|
+
|
16
|
+
PLATFORMS
|
17
|
+
ruby
|
18
|
+
|
19
|
+
DEPENDENCIES
|
20
|
+
edgecast_api!
|
21
|
+
httparty
|
data/LICENCE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 Brian Ray
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
|
2
|
+
edgecast_api
|
3
|
+
===============
|
4
|
+
|
5
|
+
Client to the Edgecast API (currently only load and purge endpoints).
|
6
|
+
|
7
|
+
Installation
|
8
|
+
---------
|
9
|
+
|
10
|
+
To install:
|
11
|
+
|
12
|
+
gem install edgecast_api
|
13
|
+
|
14
|
+
Or if you use Bundler, add this to your `Gemfile`
|
15
|
+
|
16
|
+
gem 'edgecast_api'
|
17
|
+
|
18
|
+
Usage
|
19
|
+
-----
|
20
|
+
|
21
|
+
edgecast_api = EdgecastApi.new(account_id, api_token, media_base_uri)
|
22
|
+
|
23
|
+
edgecast_api.load(media_type, path)
|
24
|
+
edgecast_api.purge(media_type, path)
|
25
|
+
|
26
|
+
Example:
|
27
|
+
|
28
|
+
edgecast_api = EdgecastApi.new('ab12', 'asdf1234', 'http://wac.cd34.edgecastcdn.net/123EF/my-site')
|
29
|
+
|
30
|
+
edgecast_api.load(:http_small_object, '/path/to/object.png')
|
31
|
+
edgecast_api.purge(:http_small_object, '/path/to/object.png')
|
32
|
+
|
33
|
+
Note that it takes Edgecast five minutes or so to completely purge an object, and you can check the status in their admin interface.
|
34
|
+
|
35
|
+
|
36
|
+
Contributing to edgecast_api
|
37
|
+
----------------------------------
|
38
|
+
|
39
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
40
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
41
|
+
* Fork the project.
|
42
|
+
* Start a feature/bugfix branch.
|
43
|
+
* Commit and push until you are happy with your contribution.
|
44
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
45
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
46
|
+
|
47
|
+
Copyright
|
48
|
+
--------
|
49
|
+
|
50
|
+
Copyright (c) 2012 Brian Ray. See LICENSE.txt for further details.
|
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "edgecast_api/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "edgecast_api"
|
7
|
+
s.version = EdgecastApi::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["bray"]
|
10
|
+
s.email = ["brian.ray1@gmail.com"]
|
11
|
+
s.homepage = "http://github.com/bray/edgecast_api"
|
12
|
+
s.summary = %q{Client to the Edgecast API.}
|
13
|
+
s.description = %q{Client to the Edgecast API.}
|
14
|
+
|
15
|
+
s.rubyforge_project = "edgecast_api"
|
16
|
+
|
17
|
+
s.add_runtime_dependency 'httparty'
|
18
|
+
|
19
|
+
s.files = `git ls-files`.split("\n")
|
20
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
21
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
22
|
+
s.require_paths = ["lib"]
|
23
|
+
end
|
data/lib/edgecast_api.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
class EdgecastApi
|
2
|
+
include HTTParty
|
3
|
+
|
4
|
+
headers 'Host' => 'api.edgecast.com', 'Accept' => 'Application/JSON', 'Content-Type' => 'Application/JSON'
|
5
|
+
format :json
|
6
|
+
|
7
|
+
MEDIA_TYPES = {:flash_media_streaming => 2, :http_large_object => 3, :http_small_object => 8, :application_delivery_network => 14}
|
8
|
+
|
9
|
+
|
10
|
+
def initialize(account_id, api_token, media_base_uri)
|
11
|
+
self.class.base_uri "https://api.edgecast.com/v2/mcc/customers/#{account_id}"
|
12
|
+
self.class.default_options[:headers]['Authorization'] = "TOK:#{api_token}"
|
13
|
+
@media_base_uri = media_base_uri
|
14
|
+
end
|
15
|
+
|
16
|
+
def purge(media_type, path)
|
17
|
+
object_url = File.join(@media_base_uri, path)
|
18
|
+
self.class.put('/edge/purge', {:body => {'MediaType' => MEDIA_TYPES[media_type.to_sym], 'MediaPath' => object_url}.to_json})
|
19
|
+
end
|
20
|
+
|
21
|
+
def load(media_type, path)
|
22
|
+
object_url = File.join(@media_base_uri, path)
|
23
|
+
self.class.put('/edge/load', {:body => {'MediaType' => MEDIA_TYPES[media_type.to_sym], 'MediaPath' => object_url}.to_json})
|
24
|
+
end
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: edgecast_api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- bray
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2012-05-24 00:00:00 -04:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: httparty
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
31
|
+
type: :runtime
|
32
|
+
version_requirements: *id001
|
33
|
+
description: Client to the Edgecast API.
|
34
|
+
email:
|
35
|
+
- brian.ray1@gmail.com
|
36
|
+
executables: []
|
37
|
+
|
38
|
+
extensions: []
|
39
|
+
|
40
|
+
extra_rdoc_files: []
|
41
|
+
|
42
|
+
files:
|
43
|
+
- .gitignore
|
44
|
+
- Gemfile
|
45
|
+
- Gemfile.lock
|
46
|
+
- LICENCE.txt
|
47
|
+
- README.md
|
48
|
+
- Rakefile
|
49
|
+
- edgecast_api.gemspec
|
50
|
+
- lib/edgecast_api.rb
|
51
|
+
- lib/edgecast_api/edgecast_api.rb
|
52
|
+
- lib/edgecast_api/version.rb
|
53
|
+
has_rdoc: true
|
54
|
+
homepage: http://github.com/bray/edgecast_api
|
55
|
+
licenses: []
|
56
|
+
|
57
|
+
post_install_message:
|
58
|
+
rdoc_options: []
|
59
|
+
|
60
|
+
require_paths:
|
61
|
+
- lib
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
segments:
|
68
|
+
- 0
|
69
|
+
version: "0"
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
segments:
|
76
|
+
- 0
|
77
|
+
version: "0"
|
78
|
+
requirements: []
|
79
|
+
|
80
|
+
rubyforge_project: edgecast_api
|
81
|
+
rubygems_version: 1.3.7
|
82
|
+
signing_key:
|
83
|
+
specification_version: 3
|
84
|
+
summary: Client to the Edgecast API.
|
85
|
+
test_files: []
|
86
|
+
|