maxcdn 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/BENCHMARKS.md CHANGED
@@ -10,11 +10,11 @@ Running benchmarks as follows in order:
10
10
  maxcdn.purge('ZONEID', [ 'FILE1','FILE2' ])
11
11
 
12
12
  user system total real
13
- get : 0.050000 0.070000 0.120000 ( 1.026412)
14
- get : 0.010000 0.000000 0.010000 ( 0.636914)
15
- post : 0.020000 0.010000 0.030000 ( 11.083888)
16
- put : 0.010000 0.000000 0.010000 ( 1.240014)
17
- delete: 0.020000 0.000000 0.020000 ( 6.846295)
18
- purge : 0.010000 0.010000 0.020000 ( 11.578944)
19
- purge : 0.020000 0.000000 0.020000 ( 0.956149)
20
- purge : 0.030000 0.000000 0.030000 ( 1.870104)
13
+ get : 0.060000 0.060000 0.120000 ( 1.014527)
14
+ get : 0.010000 0.000000 0.010000 ( 0.613805)
15
+ post : 0.020000 0.000000 0.020000 ( 19.011447)
16
+ put : 0.020000 0.000000 0.020000 ( 0.670025)
17
+ delete: 0.010000 0.000000 0.010000 ( 1.076173)
18
+ purge : 0.020000 0.000000 0.020000 ( 11.109962)
19
+ purge : 0.010000 0.010000 0.020000 ( 0.813984)
20
+ purge : 0.030000 0.000000 0.030000 ( 6.704786)
data/README.md CHANGED
@@ -98,6 +98,10 @@ bundle exec ruby ./test/integration.rb # requires host's IP be whitelisted
98
98
 
99
99
  # Change Log
100
100
 
101
+ ##### 0.1.5
102
+
103
+ * Issue #4: Fixing purge files by array to return a hash of status results.
104
+
101
105
  ##### 0.1.4
102
106
 
103
107
  * Fixing bug where purging files purges entire zone.
data/lib/maxcdn.rb CHANGED
@@ -123,13 +123,16 @@ module MaxCDN
123
123
  end
124
124
 
125
125
  if file_or_files.is_a?(Array)
126
- return file_or_files.map do |file|
127
- self.delete("/zones/pull.json/#{zone_id}/cache", { "files" => file }, options)
126
+ result = {}
127
+ file_or_files.each do |file|
128
+ result[file] = self.delete("/zones/pull.json/#{zone_id}/cache", { "files" => file }, options)
128
129
  end
130
+ return result
129
131
  end
130
132
 
131
- if file_or_files.is_a?(Hash) and (file_or_files.has_key(:files) or file_or_files.has_key("files"))
132
- return self.delete("/zones/pull.json/#{zone_id}/cache", { "files" => file_or_files }, options)
133
+ if file_or_files.is_a?(Hash)
134
+ return self.purge(zone_id, file_or_files[:files]) if file_or_files.has_key?("files")
135
+ return self.purge(zone_id, file_or_files[:files]) if file_or_files.has_key?(:files)
133
136
  end
134
137
 
135
138
  raise MaxCDN::APIException.new("Invalid file_or_files argument for delete method.")
@@ -1,3 +1,3 @@
1
1
  module MaxCDN
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
File without changes
data/test/integration.rb CHANGED
@@ -57,7 +57,7 @@ class Client < Minitest::Test
57
57
  assert_equal 200, @max.purge(zone, popularfiles[0]["uri"])["code"], "purge file"
58
58
 
59
59
  files = [popularfiles[0]["uri"], popularfiles[1]["uri"]]
60
- assert_equal [{"code"=>200},{"code"=>200}], @max.purge(zone, files), "purge files"
60
+ expected = {files[0]=>{"code"=>200},files[1]=>{"code"=>200}}
61
+ assert_equal expected, @max.purge(zone, files), "purge files"
61
62
  end
62
63
  end
63
-
data/test/maxcdn_test.rb CHANGED
@@ -138,7 +138,11 @@ class Client < Minitest::Test
138
138
  end
139
139
 
140
140
  def test_purge_files
141
- assert_equal([{ "foo" => "bar" },{ "foo" => "bar" }], @max.purge(12345, [ "foo.txt", "bar.txt" ]))
141
+ assert_equal({"foo.txt"=>{"foo"=>"bar"}, "bar.txt"=>{"foo"=>"bar"}}, @max.purge(12345, [ "foo.txt", "bar.txt" ]))
142
+ end
143
+
144
+ def test_purge_files
145
+ assert_equal({"foo.txt"=>{"foo"=>"bar"}, "bar.txt"=>{"foo"=>"bar"}}, @max.purge(12345, { :files => [ "foo.txt", "bar.txt" ]}))
142
146
  end
143
147
  end
144
148
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maxcdn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-28 00:00:00.000000000 Z
12
+ date: 2014-03-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: signet
@@ -83,7 +83,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
83
83
  version: '0'
84
84
  segments:
85
85
  - 0
86
- hash: 545417652511611192
86
+ hash: 1791789411021085395
87
87
  required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  none: false
89
89
  requirements:
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  version: '0'
93
93
  segments:
94
94
  - 0
95
- hash: 545417652511611192
95
+ hash: 1791789411021085395
96
96
  requirements: []
97
97
  rubyforge_project:
98
98
  rubygems_version: 1.8.23