maxcdn 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,19 @@
1
+ # rcov generated
2
+ coverage
3
+
4
+ # rdoc generated
5
+ rdoc
6
+
7
+ # yard generated
8
+ doc
9
+ .yardoc
10
+
11
+ # bundler
12
+ .bundle
13
+ vendor
14
+
15
+ # jeweler generated
16
+ pkg
17
+ *.gem
18
+ *.lock
19
+ .DS_Store
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ script: bundle exec ruby ./test/test.rb
3
+ rvm:
4
+ - 1.9.2
5
+ - 1.9.3
6
+ - 2.0.0
7
+ - 2.1.0
8
+
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "signet"
4
+ gem "curb-fu"
5
+ gemspec
6
+
7
+ group :development, :test do
8
+ gem "minitest"
9
+ gem "minitest-reporters"
10
+ end
11
+
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 David Litvak Bruno
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.
@@ -0,0 +1,81 @@
1
+ # MaxCDN is Hiring!
2
+
3
+ Do you like building cool stuff? Do APIs keep you up at night? We're looking for our next superstar hacker and you could be it. Interested? Check out our job posting on [stackoverflow](http://careers.stackoverflow.com/jobs/37078/senior-web-engineer-for-fun-growing-la-startup-maxcdn&a=JdFbT4OY).
4
+
5
+ # MaxCDN REST Web Services Ruby Client
6
+
7
+ ## Installation
8
+
9
+ ``` bash
10
+ gem install maxcdn
11
+ ```
12
+
13
+ #### With Bundler
14
+
15
+ ```
16
+ bundle init
17
+ echo "gem 'maxcdn'" >> Gemfile
18
+ bundle install --path vendor/bundle
19
+ ```
20
+
21
+ ## Usage
22
+ ```ruby
23
+ require 'maxcdn'
24
+
25
+ api = MaxCDN::Client.new("myalias", "consumer_key", "consumer_secret")
26
+
27
+ api.get("/account.json")
28
+ ```
29
+
30
+ ## Methods
31
+ It has support for `GET`, `POST`, `PUT` and `DELETE` OAuth 1.0a signed requests.
32
+
33
+ ```ruby
34
+ # To create a new Pull Zone
35
+ api.post("/zones/pull.json", {'name' => 'test_zone', 'url' => 'http://my-test-site.com'})
36
+
37
+ # To update an existing zone
38
+ api.put("/zones/pull.json/1234", {'name' => 'i_didnt_like_test'})
39
+
40
+ # To delete a zone
41
+ api.delete("/zones/pull.json/1234")
42
+
43
+ # To purge a file (robots.txt) from cache
44
+ api.delete("/zones/pull.json/1234/cache", {"file" => "/robots.txt"})
45
+ ```
46
+
47
+ ### We now have a shortcut for Purge Calls!
48
+ ```ruby
49
+ zone_id = 12345
50
+
51
+ # Purge Zone
52
+ api.purge(zone_id)
53
+
54
+ # Purge File
55
+ api.purge(zone_id, '/some_file')
56
+
57
+ # Purge Files
58
+ api.purge(zone_id, ['/some_file', '/another_file'])
59
+ ```
60
+
61
+
62
+ ## Development Quick Start
63
+
64
+ ``` bash
65
+ # get it
66
+ git clone git@github.com:<fork repo>/ruby-maxcdn.git
67
+
68
+ # setup
69
+ cd ruby-maxcdn
70
+ bundle install --path vendor/bundle
71
+
72
+ # unit tests
73
+ bundle exec ruby ./test/test.rb
74
+
75
+ # integration tests
76
+ export ALIAS=<your alias>
77
+ export KEY=<your key>
78
+ export SECRET=<your secret>
79
+ bundle exec ruby ./test/integration.rb # requires host's IP be whitelisted
80
+ ```
81
+
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env ruby
2
+ require "pp"
3
+ require File.join("./", File.dirname(__FILE__), "..","lib","maxcdn")
4
+
5
+ zoneid = ARGV.shift
6
+ files = ARGV.clone
7
+
8
+ if ENV["ALIAS"].nil? or ENV["KEY"].nil? or ENV["SECRET"].nil?
9
+ puts <<-EOU
10
+ Usage: cache.rb zoneid [files...]
11
+
12
+ Add credentials to your environment like so:
13
+
14
+ $ export ALIAS=<alias>
15
+ $ export KEY=<key>
16
+ $ export SECRET=<secret>
17
+ $ bundle exec ruby cache.rb 12345 ./master.css ./another.css
18
+
19
+ Or by adding to the script call:
20
+
21
+ $ ALIAS=<alias> KEY=<key> SECRET=<secret> bundle exec ruby cache.rb \
22
+ 12345 ./master.css ./another.css
23
+ EOU
24
+ end
25
+
26
+ maxcdn = MaxCDN::Client.new(ENV["ALIAS"], ENV["KEY"], ENV["SECRET"])
27
+
28
+ if zoneid.nil?
29
+
30
+ maxcdn.get("/zones/pull.json")["data"]["pullzones"].map { |z| z["id"] }.each do |zid|
31
+ puts "Purging zone #{zid}"
32
+ pp maxcdn.purge(zid)
33
+ end
34
+
35
+ else
36
+
37
+ puts "Purging zone #{zoneid}"
38
+ if files.empty?
39
+ pp maxcdn.purge(zoneid)
40
+ else
41
+ pp maxcdn.purge(zoneid, files)
42
+ end
43
+
44
+ end
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env ruby
2
+ require "pp"
3
+ require File.join("./", File.dirname(__FILE__), "..","lib","maxcdn")
4
+
5
+ arg = ARGV.shift
6
+
7
+ if ENV["ALIAS"].nil? or ENV["KEY"].nil? or ENV["SECRET"].nil? or (!arg.nil? and !arg.match(/hourly|daily|monthly/))
8
+ puts <<-EOU
9
+ Usage: report.rb [hourly|daily|monthly]
10
+
11
+ Report types only cover summary.
12
+
13
+ Add credentials to your environment like so:
14
+
15
+ $ export ALIAS=<alias>
16
+ $ export KEY=<key>
17
+ $ export SECRET=<secret>
18
+ $ ./report.rb
19
+
20
+ Or by adding to the script call:
21
+
22
+ $ ALIAS=<alias> KEY=<key> SECRET=<secret> ./report.rb
23
+ EOU
24
+ end
25
+
26
+ maxcdn = MaxCDN::Client.new(ENV["ALIAS"], ENV["KEY"], ENV["SECRET"])
27
+
28
+ report = arg.nil? ? "" : "/#{arg}"
29
+
30
+ maxcdn.get("/zones/pull.json")["data"]["pullzones"].each do |zone|
31
+ # title
32
+ puts "Zone report for: #{zone["name"]} (#{zone["url"]})"
33
+
34
+ # summary
35
+ maxcdn.get("/reports/#{zone["id"]}/stats.json#{report}")["data"]["summary"].each do |k, v|
36
+ puts " - #{k}: #{v}"
37
+ end
38
+
39
+ # popularfiles
40
+ puts " "
41
+ puts "Popular Files:"
42
+ maxcdn.get("/reports/#{zone["id"]}/popularfiles.json?page_size=10")["data"]["popularfiles"].each do |file|
43
+ puts " - url: #{file["uri"]}"
44
+ puts " - hits: #{file["hit"]}"
45
+ puts " - size: #{file["size"]}"
46
+ end
47
+
48
+ puts " "
49
+ end
50
+
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pp'
3
+ require File.join('./', File.dirname(__FILE__), '..','lib','maxcdn')
4
+
5
+ maxcdn = MaxCDN::Client.new(ENV['ALIAS'], ENV['KEY'], ENV['SECRET'])
6
+
7
+ puts 'GET /account.json'
8
+ pp maxcdn.get('/account.json')
9
+
10
+ puts 'GET /account.json/address'
11
+ pp maxcdn.get('/account.json/address')
12
+
13
+ puts 'GET /reports/stats.json/hourly'
14
+ pp maxcdn.get('/reports/stats.json/hourly')
15
+
@@ -0,0 +1,122 @@
1
+ require "signet/oauth_1/client"
2
+ require "curb-fu"
3
+ require "json"
4
+
5
+ module MaxCDN
6
+ module Utils
7
+ RESERVED_CHARACTERS = /[^a-zA-Z0-9\-\.\_\~]/
8
+
9
+ def escape(value)
10
+ URI::escape(value.to_s, MaxCDN::Utils::RESERVED_CHARACTERS)
11
+ rescue ArgumentError
12
+ URI::escape(value.to_s.force_encoding(Encoding::UTF_8), MaxCDN::Utils::RESERVED_CHARACTERS)
13
+ end
14
+
15
+ def encode_params params={}
16
+ Hash[params.map { |k, v| [escape(k), escape(v)] }]
17
+ end
18
+ end
19
+
20
+ class APIException < Exception
21
+ end
22
+
23
+ class Client
24
+ include MaxCDN::Utils
25
+
26
+ attr_accessor :client
27
+ def initialize(company_alias, key, secret, server="rws.maxcdn.com", secure_connection=true)
28
+ @company_alias = company_alias
29
+ @server = server
30
+ @secure_connection = secure_connection
31
+ @request_signer = Signet::OAuth1::Client.new(
32
+ :client_credential_key => key,
33
+ :client_credential_secret => secret,
34
+ :two_legged => true
35
+ )
36
+ end
37
+
38
+ def _connection_type
39
+ return "http" unless @secure_connection
40
+ "https"
41
+ end
42
+
43
+ def _encode_params params={}
44
+ encode_params(params).map { |k, v|
45
+ "#{k}=#{v}"
46
+ }.join "&"
47
+ end
48
+
49
+ def _get_url uri, params={}
50
+
51
+ url = "#{_connection_type}://#{@server}/#{@company_alias}/#{uri.gsub(/^\//, "")}"
52
+ if not params.empty?
53
+ url += "?#{_encode_params(params)}"
54
+ end
55
+
56
+ url
57
+ end
58
+
59
+ def _response_as_json method, uri, options={}, *attributes
60
+ if options.delete(:debug)
61
+ puts "Making #{method.upcase} request to #{_get_url uri}"
62
+ end
63
+
64
+ request_options = {
65
+ :uri => _get_url(uri, options[:body] ? attributes[0] : {}),
66
+ :method => method
67
+ }
68
+
69
+ request_options[:body] = _encode_params(attributes[0]) if options[:body]
70
+ request = @request_signer.generate_authenticated_request(request_options)
71
+ request.headers["User-Agent"] = "Ruby MaxCDN API Client"
72
+
73
+ begin
74
+ curb_options = {}
75
+ curb_options[:url] = request_options[:uri]
76
+ curb_options[:headers] = request.headers
77
+
78
+ if not options[:body]
79
+ response = CurbFu.send method, curb_options
80
+ else
81
+ response = CurbFu.send method, curb_options, request.body
82
+ end
83
+
84
+ return response if options[:debug_request]
85
+
86
+ response_json = JSON.load(response.body)
87
+
88
+ return response_json if options[:debug_json]
89
+
90
+ if not (response.success? or response.redirect?)
91
+ error_message = response_json["error"]["message"]
92
+ raise MaxCDN::APIException.new("#{response.status}: #{error_message}")
93
+ end
94
+ rescue TypeError
95
+ raise MaxCDN::APIException.new(
96
+ "#{response.status}: No information supplied by the server"
97
+ )
98
+ end
99
+
100
+ response_json
101
+ end
102
+
103
+ [ :get, :post, :put, :delete ].each do |meth|
104
+ define_method(meth) do |uri, data={}, options={}|
105
+ options[:body] = (meth == :post || meth == :put)
106
+ self._response_as_json meth.to_s, uri, options, data
107
+ end
108
+ end
109
+
110
+ def purge zone_id, file_or_files=nil, options={}
111
+ unless file_or_files.nil?
112
+ return self.delete(
113
+ "/zones/pull.json/#{zone_id}/cache",
114
+ {"file" => file_or_files},
115
+ options
116
+ )
117
+ end
118
+
119
+ self.delete("/zones/pull.json/#{zone_id}/cache", {}, options)
120
+ end
121
+ end
122
+ end
@@ -0,0 +1,3 @@
1
+ module MaxCDN
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,18 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/maxcdn/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.name = "maxcdn"
6
+ gem.homepage = "http://www.maxcdn.com"
7
+ gem.version = MaxCDN::VERSION
8
+ gem.license = "MIT"
9
+ gem.files = `git ls-files`.split($\)
10
+ gem.require_paths = ['lib']
11
+ gem.summary = %Q{A Rest Client For MaxCDN Rest Web Services}
12
+ gem.description = %Q{A Rest Client For MaxCDN Rest Web Services}
13
+ gem.email = "joshua@mervine.net"
14
+ gem.authors = ["Joshua P. Mervine"]
15
+ gem.add_dependency 'json' if RUBY_VERSION.start_with? "1.8"
16
+ gem.add_dependency 'signet'
17
+ gem.add_dependency 'curb-fu'
18
+ end
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env ruby
2
+ if (ENV["ALIAS"].nil? or ENV["KEY"].nil? or ENV["SECRET"].nil?)
3
+ abort "Please export ALIAS, KEY and SECRET with your credentials and ensure that you're test host's IP is whitelisted."
4
+ end
5
+
6
+ require 'benchmark'
7
+ require "./lib/maxcdn"
8
+
9
+ @time = Time.now.to_i.to_s
10
+
11
+ puts "Running benchmarks as follows in order:"
12
+ puts " "
13
+ puts " maxcdn.get('zones/pull.json')"
14
+ puts " maxcdn.get('reports/popularfiles.json')"
15
+ puts " maxcdn.post('zones/pull.json', { :name => 'NAM', :url => 'URL' })"
16
+ puts " maxcdn.put('account.json', { :name => 'NAME' })"
17
+ puts " maxcdn.delete('zones/pull.json/ZONEID')"
18
+ puts " maxcdn.purge('ZONEID')"
19
+ puts " maxcdn.purge('ZONEID', 'FILE')"
20
+ puts " maxcdn.purge('ZONEID', [ 'FILE1','FILE2' ])"
21
+ puts " "
22
+
23
+ Benchmark.bm do |mark|
24
+
25
+ maxcdn = MaxCDN::Client.new(ENV["ALIAS"], ENV["KEY"], ENV["SECRET"])
26
+ time = Time.now.to_i.to_s
27
+
28
+ mark.report("get :") do
29
+ @pullzone = maxcdn.get("zones/pull.json")["data"]["pullzones"][0]["id"]
30
+ end
31
+
32
+ mark.report("get :") do
33
+ @popularfiles = maxcdn.get("reports/popularfiles.json")["data"]["popularfiles"]
34
+ end
35
+
36
+ @zone = {
37
+ :name => @time,
38
+ :url => "http://www.example.com"
39
+ }
40
+
41
+ mark.report("post :") do
42
+ @zoneid = maxcdn.post("zones/pull.json", @zone)["data"]["pullzone"]["id"]
43
+ end
44
+
45
+ mark.report("put :") do
46
+ maxcdn.put("account.json", { :name => @time })
47
+ end
48
+
49
+ mark.report("delete:") do
50
+ maxcdn.delete("zones/pull.json/#{@zoneid}")
51
+ end
52
+
53
+ mark.report("purge :") do
54
+ maxcdn.purge(@pullzone)
55
+ end
56
+
57
+ mark.report("purge :") do
58
+ maxcdn.purge(@pullzone, @popularfiles[0]["uri"])
59
+ end
60
+
61
+ mark.report("purge :") do
62
+ maxcdn.purge(@pullzone, [ @popularfiles[0]["uri"], @popularfiles[1]["uri"] ])
63
+ end
64
+ end
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env ruby
2
+ require "json"
3
+ require "minitest/autorun"
4
+ require "minitest/reporters"
5
+ require "./lib/maxcdn"
6
+
7
+ Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
8
+
9
+ if (ENV["ALIAS"].nil? or ENV["KEY"].nil? or ENV["SECRET"].nil?)
10
+ abort "Please export ALIAS, KEY and SECRET with your credentials and ensure that you're test host's IP is whitelisted."
11
+ end
12
+
13
+ class Client < Minitest::Test
14
+
15
+ def setup
16
+ @max = MaxCDN::Client.new(ENV["ALIAS"], ENV["KEY"], ENV["SECRET"])
17
+ @time = Time.now.to_i.to_s
18
+ end
19
+
20
+ def test_get
21
+ [ "account.json",
22
+ "account.json/address",
23
+ "users.json",
24
+ "zones.json"
25
+ ].each do |end_point|
26
+ key = end_point.include?("/") ? end_point.split("/")[1] : end_point.gsub(/\.json/, "")
27
+
28
+ assert @max.get(end_point)["data"][key], "get #{key} with data"
29
+ end
30
+ end
31
+
32
+ def test_post_and_delete
33
+
34
+ zone = {
35
+ :name => @time,
36
+ :url => "http://www.example.com"
37
+ }
38
+
39
+ zid = @max.post("zones/pull.json", zone)["data"]["pullzone"]["id"]
40
+ assert zid, "post"
41
+
42
+ assert_equal 200, @max.delete("zones/pull.json/#{zid}")["code"], "delete (warning: manually delete zone #{zid} at https://cp.maxcdn.com/zones/pull)."
43
+ end
44
+
45
+ def test_put
46
+ name = @time + "_put"
47
+ assert_equal name, @max.put("account.json", { :name => name })["data"]["account"]["name"], "put"
48
+ end
49
+
50
+ def test_purge
51
+ zone = @max.get("zones/pull.json")["data"]["pullzones"][0]["id"]
52
+ assert_equal 200, @max.purge(zone)["code"], "purge"
53
+
54
+ popularfiles = @max.get("reports/popularfiles.json")["data"]["popularfiles"]
55
+ assert_equal 200, @max.purge(zone, popularfiles[0]["uri"])["code"], "purge file"
56
+
57
+ assert_equal 200, @max.purge(zone, [ popularfiles[0]["uri"], popularfiles[1]["uri"]])["code"], "purge files"
58
+ end
59
+ end
60
+
@@ -0,0 +1,130 @@
1
+ require "curb-fu"
2
+
3
+ require "minitest/autorun"
4
+ require "minitest/mock"
5
+ require "minitest/reporters"
6
+
7
+ #require "signet/oauth_1/client"
8
+ require "./lib/maxcdn"
9
+
10
+ Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
11
+
12
+ class Client < Minitest::Test
13
+
14
+ def new_response
15
+ response = Minitest::Mock.new
16
+ response.expect(:body, '{ "foo": "bar" }')
17
+ response.expect(:success?, true)
18
+ response
19
+ end
20
+
21
+ def setup
22
+ @max = MaxCDN::Client.new("alias", "key", "secret")
23
+ end
24
+
25
+ def test_initialize
26
+ assert_equal "alias", @max.instance_variable_get(:@company_alias)
27
+ end
28
+
29
+ def test__connection_type
30
+ assert_equal "https", @max._connection_type
31
+
32
+ m = MaxCDN::Client.new("alias", "key", "secret", "foo", false)
33
+ assert_equal "http", m._connection_type
34
+ end
35
+
36
+ def test__encode_params
37
+ assert_equal "foo=foo%20bar&bah=boo",
38
+ @max._encode_params({ :foo => "foo bar", :bah => "boo" })
39
+ end
40
+
41
+ def test__get_url
42
+ assert_equal "https://rws.maxcdn.com/alias/foo",
43
+ @max._get_url("/foo")
44
+ assert_equal "https://rws.maxcdn.com/alias/foo?foo=foo%20bar",
45
+ @max._get_url("/foo", { :foo => "foo bar" })
46
+ end
47
+
48
+ def test__response_as_json_standard
49
+ response = new_response
50
+ CurbFu::Request.stub :get, response do
51
+ res = @max._response_as_json("get", "http://example.com")
52
+ assert res
53
+ assert response.verify
54
+ end
55
+ end
56
+
57
+ def test__response_as_json_standard
58
+ response = new_response
59
+ CurbFu::Request.stub :get, response do
60
+ res = @max._response_as_json("get", "http://example.com",
61
+ { :debug_request => true })
62
+ assert res.body
63
+ end
64
+ end
65
+
66
+ def test_get
67
+ response = new_response
68
+ CurbFu::Request.stub :get, response do
69
+ assert_equal({ "foo" => "bar" }, @max.get("/account.json"))
70
+ end
71
+ assert response.verify
72
+ end
73
+
74
+ def test_post
75
+ response = new_response
76
+ CurbFu::Request.stub :post, response do
77
+ assert_equal({ "foo" => "bar" }, @max.post("/zones/pull.json", {'name' => 'test_zone', 'url' => 'http://my-test-site.com'}))
78
+ end
79
+ assert response.verify
80
+ end
81
+
82
+ def test_put
83
+ response = new_response
84
+ CurbFu::Request.stub :put, response do
85
+ assert_equal({ "foo" => "bar" }, @max.put("/zones/pull.json/1234", {'name' => 'i_didnt_like_test'}))
86
+ end
87
+ assert response.verify
88
+ end
89
+
90
+ def test_delete
91
+ response = new_response
92
+ CurbFu::Request.stub :delete, response do
93
+ assert_equal({ "foo" => "bar" }, @max.delete("/zones/pull.json/1234"))
94
+ end
95
+ assert response.verify
96
+ end
97
+
98
+ def test_delete_file
99
+ response = new_response
100
+ CurbFu::Request.stub :delete, response do
101
+ assert_equal({ "foo" => "bar" }, @max.delete("/zones/pull.json/1234/cache", {"file" => "/robots.txt"}))
102
+ end
103
+ assert response.verify
104
+ end
105
+
106
+ def test_purge
107
+ response = new_response
108
+ CurbFu::Request.stub :delete, response do
109
+ assert_equal({ "foo" => "bar" }, @max.purge(12345))
110
+ end
111
+ assert response.verify
112
+ end
113
+
114
+ def test_purge_file
115
+ response = new_response
116
+ CurbFu::Request.stub :delete, response do
117
+ assert_equal({ "foo" => "bar" }, @max.purge(12345, "/foo.txt"))
118
+ end
119
+ assert response.verify
120
+ end
121
+
122
+ def test_purge_files
123
+ response = new_response
124
+ CurbFu::Request.stub :delete, response do
125
+ assert_equal({ "foo" => "bar" }, @max.purge(12345, [ "/foo.txt", "/bar.txt" ]))
126
+ end
127
+ assert response.verify
128
+ end
129
+ end
130
+
metadata ADDED
@@ -0,0 +1,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: maxcdn
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Joshua P. Mervine
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-02-10 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: signet
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: curb-fu
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: A Rest Client For MaxCDN Rest Web Services
47
+ email: joshua@mervine.net
48
+ executables: []
49
+ extensions: []
50
+ extra_rdoc_files: []
51
+ files:
52
+ - .gitignore
53
+ - .travis.yml
54
+ - Gemfile
55
+ - LICENSE
56
+ - README.md
57
+ - Rakefile
58
+ - VERSION
59
+ - examples/cache.rb
60
+ - examples/report.rb
61
+ - examples/simple.rb
62
+ - lib/maxcdn.rb
63
+ - lib/maxcdn/version.rb
64
+ - maxcdn.gemspec
65
+ - test/benchmark.rb
66
+ - test/integration.rb
67
+ - test/test.rb
68
+ homepage: http://www.maxcdn.com
69
+ licenses:
70
+ - MIT
71
+ post_install_message:
72
+ rdoc_options: []
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ! '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ requirements: []
88
+ rubyforge_project:
89
+ rubygems_version: 1.8.23
90
+ signing_key:
91
+ specification_version: 3
92
+ summary: A Rest Client For MaxCDN Rest Web Services
93
+ test_files: []
94
+ has_rdoc: