cachewarp 0.0.1 → 0.0.2

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/README.md CHANGED
@@ -4,24 +4,30 @@ Gem targeted towards providing a solution to verify cache headers for content de
4
4
 
5
5
  ## Usage
6
6
 
7
+ ```
7
8
  require 'cachewarp' #Require CacheWarp in your file
8
9
  request = CacheWarp.new('http://www.akamai.com/') #Initialize Request Object
9
10
  request.fetch #Fetch Request
10
11
  request.response_headers #Get Response Headers
11
12
  request.is_cached? #Verify 'TCP HIT' i.e if Akamai is caching the request
13
+ ```
12
14
 
13
15
  ## Installation
14
16
 
15
17
  Using Bundler
16
18
 
19
+ ```
17
20
  gem 'cachewarp' #Add to Gemfile
18
21
  $ bundle #Install Gem
22
+ ```
19
23
 
20
24
  Using gem command
21
25
 
26
+ ```
22
27
  $ gem install cachewarp
28
+ ```
23
29
 
24
- #Change Log:
30
+ ##Change Log:
25
31
 
26
32
  0.0.1
27
33
  Provision to verify TCP HIT in Akamai cache
@@ -33,3 +39,9 @@ Using gem command
33
39
  3. Commit your changes (`git commit -am 'Add some feature'`)
34
40
  4. Push to the branch (`git push origin my-new-feature`)
35
41
  5. Create new Pull Request
42
+
43
+ ## Contributors
44
+
45
+ @juteroot
46
+ @bitweft
47
+ @codeweft
data/cachewarp.gemspec CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = GEM_VERSION
9
9
  spec.authors = ["codeweft", "bitweft", "juteroot"]
10
10
  spec.email = ["juteroot@gmail.com"]
11
- spec.description = %q{Gem to verify cache and content delivery headers}
12
- spec.summary = %q{Gem to verify cache and content delivery headers}
11
+ spec.description = %q{Verify cache and content delivery headers}
12
+ spec.summary = %q{Ruby Gem targeted towards providing a solution to verify cache headers for content delivery services like Akamai}
13
13
  spec.homepage = "http://www.juteroot.com"
14
14
  spec.license = "To be decided"
15
15
 
data/lib/cachewarp.rb CHANGED
@@ -32,8 +32,9 @@ class CacheWarp < WebService
32
32
  end
33
33
 
34
34
  def is_cached?
35
- @response_headers.each do |attr, value|
36
- @failures[attr] = "Expected= #{@expected_response_headers[attr]}, Actual= #{value}" unless @expected_response_headers[attr].nil? || value.match(@expected_response_headers[attr])
35
+ fetch if response_headers.empty?
36
+ @expected_response_headers.each do |attr, value|
37
+ @failures[attr] = {expected: value, actual: @response_headers[attr]} unless @response_headers[attr] && @response_headers[attr].match(value.to_s)
37
38
  end
38
39
  return ((@failures.empty?) ? true : false)
39
40
  end
@@ -1 +1 @@
1
- GEM_VERSION = '0.0.1'
1
+ GEM_VERSION = '0.0.2'
@@ -12,7 +12,7 @@ class WebService
12
12
  end
13
13
  http.start { |htttp| htttp.request(request) }
14
14
  rescue Exception => ex
15
- raise "Unable to fetch #{@uri.request_uri}. Check if site is up and running"
15
+ raise "Unable to fetch request. Check if site is up and running"
16
16
  end
17
17
  end
18
18
 
@@ -1,10 +1,36 @@
1
1
  require_relative '../../test_helper'
2
2
 
3
3
  describe CacheWarp do
4
- it "is akamai caching" do
5
- request = CacheWarp.new('http://www.akamai.com/')
4
+ it "akamai caching for site with akamai cache headers" do
5
+ uri = 'http://www.akamai.com/'
6
+ request = CacheWarp.new(uri)
6
7
  request.fetch
7
- pp request.response_headers
8
+ request.response_headers
8
9
  request.is_cached?.must_equal true
9
10
  end
11
+
12
+ it "akamai caching for site without akamai cache headers" do
13
+ uri = 'http://www.google.com/'
14
+ request = CacheWarp.new(uri)
15
+ request.response_headers
16
+ request.is_cached?.must_equal false
17
+ end
18
+
19
+ it "akamai caching for site with akamai cache headers without using fetch" do
20
+ uri = 'http://www.google.com/'
21
+ request = CacheWarp.new(uri)
22
+ request.is_cached?.must_equal false
23
+ request.response_headers
24
+ end
25
+
26
+ it "akamai caching for invalid site" do
27
+ uri = 'http://www.invalid.site/'
28
+ request = CacheWarp.new(uri)
29
+ begin
30
+ request.is_cached?.must_equal false
31
+ rescue Exception => ex
32
+ assert_equal(ex.message, "Unable to fetch request. Check if site is up and running")
33
+ end
34
+ assert(request.response_headers.empty?)
35
+ end
10
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cachewarp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-06-17 00:00:00.000000000 Z
14
+ date: 2013-06-18 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -45,7 +45,7 @@ dependencies:
45
45
  - - ! '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
- description: Gem to verify cache and content delivery headers
48
+ description: Verify cache and content delivery headers
49
49
  email:
50
50
  - juteroot@gmail.com
51
51
  executables: []
@@ -80,7 +80,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
80
80
  version: '0'
81
81
  segments:
82
82
  - 0
83
- hash: 138774292347802239
83
+ hash: 119121395234936179
84
84
  required_rubygems_version: !ruby/object:Gem::Requirement
85
85
  none: false
86
86
  requirements:
@@ -89,13 +89,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
89
  version: '0'
90
90
  segments:
91
91
  - 0
92
- hash: 138774292347802239
92
+ hash: 119121395234936179
93
93
  requirements: []
94
94
  rubyforge_project:
95
95
  rubygems_version: 1.8.25
96
96
  signing_key:
97
97
  specification_version: 3
98
- summary: Gem to verify cache and content delivery headers
98
+ summary: Ruby Gem targeted towards providing a solution to verify cache headers for
99
+ content delivery services like Akamai
99
100
  test_files:
100
101
  - test/lib/cachewarp/akamai_test.rb
101
102
  - test/lib/cachewarp/version_test.rb