varnisher 1.0.beta.5 → 1.0.beta.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c0b5fd6898bd69ebb046e5b5ca5459ca0fd66ebb
4
- data.tar.gz: cef950689b3c66b79ec4095b5508080ec2cc7ccf
3
+ metadata.gz: 6d5aa5c1be2b85a10cf504fb130b5da56a33c421
4
+ data.tar.gz: 13a2bf334f86a05098a4b0d4d2d370bccd305eb5
5
5
  SHA512:
6
- metadata.gz: b8068e477b2d6dc4bebaa2d908595c4728ad104447ea979ed829fd560ef8b700e4e605ebabadfcfae9bb3eba5044786a7aedff14ba8bc0788f140fa5dabdac8d
7
- data.tar.gz: ce25a130d9709f8a6304e73e6e26bdbf69433992ed768c824be10b815f07ed74817d5b049b6f60b9939d13b9cdb67fe91504077c2d3dea593868dcbe09105437
6
+ metadata.gz: 982f22d9f45952e2a95833771021e9c49bf9ef12af28b1f2e3df606eca4dd18788bbb571417ecdde3b048149e531544925ba9d14f92664f65e427172c5a4ea94
7
+ data.tar.gz: d747e97e01ade3036ac271394658f4858be492f8ac310e26ae5484b17fffed7950c78e4a0f99c6d5580c5c6d963998a598cdd4db1b2ad021bfb28a51a34eb209
@@ -1,21 +1,25 @@
1
- # Adds the custom verb "PURGE" to the Net::HTTP library, allowing calls
2
- # to:
3
- #
4
- # Net::HTTP.new(host, port).request(Purge.new(uri))
5
- class Purge < Net::HTTPRequest
6
- METHOD = "PURGE"
7
- REQUEST_HAS_BODY = false
8
- RESPONSE_HAS_BODY = false
9
- end
1
+ module Varnisher
2
+ module HTTP
3
+ # Adds the custom verb "PURGE" to the Net::HTTP library, allowing calls
4
+ # to:
5
+ #
6
+ # Net::HTTP.new(host, port).request(Varnisher::HTTP::Purge.new(uri))
7
+ class Purge < Net::HTTPRequest
8
+ METHOD = "PURGE"
9
+ REQUEST_HAS_BODY = false
10
+ RESPONSE_HAS_BODY = false
11
+ end
10
12
 
11
- # Adds the custom verb "DOMAINPURGE" to the Net::HTTP library, allowing
12
- # calls to:
13
- #
14
- # Net::HTTP.new(host, port).request(DomainPurge.new(uri))
15
- class DomainPurge < Net::HTTPRequest
16
- METHOD = "DOMAINPURGE"
17
- REQUEST_HAS_BODY = false
18
- RESPONSE_HAS_BODY = false
13
+ # Adds the custom verb "DOMAINPURGE" to the Net::HTTP library, allowing
14
+ # calls to:
15
+ #
16
+ # Net::HTTP.new(host, port).request(Varnisher::HTTP::DomainPurge.new(uri))
17
+ class DomainPurge < Net::HTTPRequest
18
+ METHOD = "DOMAINPURGE"
19
+ REQUEST_HAS_BODY = false
20
+ RESPONSE_HAS_BODY = false
21
+ end
22
+ end
19
23
  end
20
24
 
21
25
  module Varnisher
@@ -54,7 +58,7 @@ module Varnisher
54
58
  # use "/"
55
59
  # @param host [String] The hostname of the URL being purged
56
60
  def initialize(method, path, host)
57
- @request_method = method == "PURGE" ? Purge : DomainPurge
61
+ @request_method = method == "PURGE" ? Varnisher::HTTP::Purge : Varnisher::HTTP::DomainPurge
58
62
  @path = path
59
63
  @host = host
60
64
  end
@@ -73,6 +77,8 @@ module Varnisher
73
77
  hostname = Varnisher.options['hostname'] || @host
74
78
  port = Varnisher.options['port']
75
79
 
80
+ @path = '/' if @path.nil? || @path == ''
81
+
76
82
  begin
77
83
  http = Net::HTTP.new(hostname, port)
78
84
  response = http.request(@request_method.new(@path))
@@ -1,3 +1,3 @@
1
1
  module Varnisher
2
- VERSION = '1.0.beta.5'
2
+ VERSION = '1.0.beta.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: varnisher
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.beta.5
4
+ version: 1.0.beta.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Miller