reggie 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -11,7 +11,7 @@ gem "rest-client"
11
11
  group :development do
12
12
  gem "rspec", "~> 2.8.0"
13
13
  gem "rdoc", "~> 3.12"
14
- gem "bundler", "~> 1.0.0"
14
+ gem "bundler", "~> 1.1.3"
15
15
  gem "jeweler", "~> 1.8.3"
16
16
  end
17
17
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
@@ -0,0 +1,17 @@
1
+ module CacheAccessor
2
+ def cache_accessor(*names)
3
+ names.each do |name|
4
+ define_method(name) do |image_url|
5
+ begin
6
+ response = RestClient.put "#{@base_uri}/#{@customer_id}/edge/#{name}",
7
+ {:MediaPath => image_url, :MediaType => 8}.to_json,
8
+ :authorization => token,
9
+ :content_type => :json,
10
+ :accept => :json
11
+ rescue => e
12
+ e
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,15 +1,18 @@
1
+ require 'cache_accessor'
1
2
  require 'json'
2
3
  require 'rest_client'
3
4
 
4
5
  class Reggie
6
+ extend CacheAccessor
7
+
5
8
  attr_accessor :customer_id, :token
9
+ cache_accessor :purge, :load
6
10
 
7
11
  def initialize(args)
8
12
  @customer_id = args[:customer_id]
9
13
  @token = args[:token]
10
14
 
11
15
  @base_uri = "https://api.edgecast.com/v2/mcc/customers"
12
- @valid = false
13
16
 
14
17
  begin
15
18
  response = RestClient.get "#{@base_uri}/#{@customer_id}/compression",
@@ -23,16 +26,4 @@ class Reggie
23
26
  def valid?
24
27
  @valid
25
28
  end
26
-
27
- def put(method, image_url)
28
- begin
29
- response = RestClient.put "#{@base_uri}/#{@customer_id}/edge/#{method}",
30
- {:MediaPath => image_url, :MediaType => 8}.to_json,
31
- :authorization => @token,
32
- :content_type => :json,
33
- :accept => :json
34
- rescue => e
35
- e
36
- end
37
- end
38
29
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{reggie}
8
- s.version = "0.1.3"
8
+ s.version = "0.1.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jimmy Huang"]
12
- s.date = %q{2012-03-29}
12
+ s.date = %q{2012-03-30}
13
13
  s.description = %q{A Ruby wrapper for a caching API}
14
14
  s.email = %q{jimmy.huang@duragility.com}
15
15
  s.extra_rdoc_files = [
@@ -25,12 +25,13 @@ Gem::Specification.new do |s|
25
25
  "Rakefile",
26
26
  "VERSION",
27
27
  "init.rb",
28
+ "lib/cache_accessor.rb",
28
29
  "lib/reggie.rb",
29
30
  "rails/init.rb",
30
31
  "reggie.gemspec",
31
32
  "spec/config/edgecast.yml",
32
- "spec/fixtures/reggie/cache_management.yml",
33
- "spec/fixtures/reggie/new.yml",
33
+ "spec/fixtures/vcr/cache_management.yml",
34
+ "spec/fixtures/vcr/new.yml",
34
35
  "spec/reggie_spec.rb",
35
36
  "spec/spec_helper.rb"
36
37
  ]
@@ -47,20 +48,20 @@ Gem::Specification.new do |s|
47
48
  s.add_runtime_dependency(%q<rest-client>, [">= 0"])
48
49
  s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
49
50
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
50
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
51
+ s.add_development_dependency(%q<bundler>, ["~> 1.1.3"])
51
52
  s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
52
53
  else
53
54
  s.add_dependency(%q<rest-client>, [">= 0"])
54
55
  s.add_dependency(%q<rspec>, ["~> 2.8.0"])
55
56
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
56
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
57
+ s.add_dependency(%q<bundler>, ["~> 1.1.3"])
57
58
  s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
58
59
  end
59
60
  else
60
61
  s.add_dependency(%q<rest-client>, [">= 0"])
61
62
  s.add_dependency(%q<rspec>, ["~> 2.8.0"])
62
63
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
63
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
64
+ s.add_dependency(%q<bundler>, ["~> 1.1.3"])
64
65
  s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
65
66
  end
66
67
  end
@@ -1,2 +1,2 @@
1
- customer_id: REPLACE_ME
2
- token: REPLACE_ME
1
+ customer_id: CUSTOMER_ID
2
+ token: TOKEN
@@ -0,0 +1,343 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: put
5
+ uri: https://api.edgecast.com/v2/mcc/customers/CUSTOMER_ID/edge/load
6
+ body:
7
+ encoding: ASCII-8BIT
8
+ string: ! '{"MediaPath":"http://img.bleacherreport.net/img/slides/photos/002/037/135/137267039_crop_exact.jpg?w=650&h=440&q=85","MediaType":8}'
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Authorization:
15
+ - TOKEN
16
+ Content-Type:
17
+ - application/json
18
+ Content-Length:
19
+ - '131'
20
+ User-Agent:
21
+ - Ruby
22
+ response:
23
+ status:
24
+ code: 200
25
+ message: OK
26
+ headers:
27
+ Cache-Control:
28
+ - private
29
+ Server:
30
+ - Microsoft-IIS/7.5
31
+ X-Aspnet-Version:
32
+ - 4.0.30319
33
+ X-Powered-By:
34
+ - ASP.NET
35
+ Date:
36
+ - Fri, 30 Mar 2012 07:15:03 GMT
37
+ Content-Length:
38
+ - '0'
39
+ body:
40
+ encoding: US-ASCII
41
+ string: ''
42
+ http_version: !!null
43
+ recorded_at: Fri, 30 Mar 2012 07:16:18 GMT
44
+ - request:
45
+ method: put
46
+ uri: https://api.edgecast.com/v2/mcc/customers/CUSTOMER_ID/edge/load
47
+ body:
48
+ encoding: ASCII-8BIT
49
+ string: ! '{"MediaPath":"http://img.bleacherreport.net/img/slides/photos/002/037/135/XXX_crop_exact.jpg?w=650&h=440&q=85","MediaType":8}'
50
+ headers:
51
+ Accept:
52
+ - application/json
53
+ Accept-Encoding:
54
+ - gzip, deflate
55
+ Authorization:
56
+ - TOKEN
57
+ Content-Type:
58
+ - application/json
59
+ Content-Length:
60
+ - '125'
61
+ User-Agent:
62
+ - Ruby
63
+ response:
64
+ status:
65
+ code: 200
66
+ message: OK
67
+ headers:
68
+ Cache-Control:
69
+ - private
70
+ Server:
71
+ - Microsoft-IIS/7.5
72
+ X-Aspnet-Version:
73
+ - 4.0.30319
74
+ X-Powered-By:
75
+ - ASP.NET
76
+ Date:
77
+ - Fri, 30 Mar 2012 07:15:04 GMT
78
+ Content-Length:
79
+ - '0'
80
+ body:
81
+ encoding: US-ASCII
82
+ string: ''
83
+ http_version: !!null
84
+ recorded_at: Fri, 30 Mar 2012 07:16:19 GMT
85
+ - request:
86
+ method: put
87
+ uri: https://api.edgecast.com/v2/mcc/customers/CUSTOMER_ID/edge/load
88
+ body:
89
+ encoding: ASCII-8BIT
90
+ string: ! '{"MediaPath":"","MediaType":8}'
91
+ headers:
92
+ Accept:
93
+ - application/json
94
+ Accept-Encoding:
95
+ - gzip, deflate
96
+ Authorization:
97
+ - TOKEN
98
+ Content-Type:
99
+ - application/json
100
+ Content-Length:
101
+ - '30'
102
+ User-Agent:
103
+ - Ruby
104
+ response:
105
+ status:
106
+ code: 400
107
+ message: Bad Request
108
+ headers:
109
+ Cache-Control:
110
+ - private
111
+ Content-Length:
112
+ - '63'
113
+ Content-Type:
114
+ - application/json; charset=utf-8
115
+ Server:
116
+ - Microsoft-IIS/7.5
117
+ X-Aspnet-Version:
118
+ - 4.0.30319
119
+ X-Powered-By:
120
+ - ASP.NET
121
+ Date:
122
+ - Fri, 30 Mar 2012 07:15:04 GMT
123
+ body:
124
+ encoding: US-ASCII
125
+ string: ! '{"Message":"MediaPath: Path is required for this media type. "}'
126
+ http_version: !!null
127
+ recorded_at: Fri, 30 Mar 2012 07:16:19 GMT
128
+ - request:
129
+ method: put
130
+ uri: https://api.edgecast.com/v2/mcc/customers/CUSTOMER_ID/edge/load
131
+ body:
132
+ encoding: ASCII-8BIT
133
+ string: ! '{"MediaPath":"http://www.amazon.com","MediaType":8}'
134
+ headers:
135
+ Accept:
136
+ - application/json
137
+ Accept-Encoding:
138
+ - gzip, deflate
139
+ Authorization:
140
+ - TOKEN
141
+ Content-Type:
142
+ - application/json
143
+ Content-Length:
144
+ - '51'
145
+ User-Agent:
146
+ - Ruby
147
+ response:
148
+ status:
149
+ code: 400
150
+ message: Bad Request
151
+ headers:
152
+ Cache-Control:
153
+ - private
154
+ Content-Length:
155
+ - '183'
156
+ Content-Type:
157
+ - application/json; charset=utf-8
158
+ Server:
159
+ - Microsoft-IIS/7.5
160
+ X-Aspnet-Version:
161
+ - 4.0.30319
162
+ X-Powered-By:
163
+ - ASP.NET
164
+ Date:
165
+ - Fri, 30 Mar 2012 07:15:05 GMT
166
+ body:
167
+ encoding: US-ASCII
168
+ string: ! '{"Message":"Invalid strPath parameter. Please double check the path
169
+ to make sure it is valid. Also check that the media type id represents the
170
+ correct platform for the path given."}'
171
+ http_version: !!null
172
+ recorded_at: Fri, 30 Mar 2012 07:16:19 GMT
173
+ - request:
174
+ method: put
175
+ uri: https://api.edgecast.com/v2/mcc/customers/CUSTOMER_ID/edge/purge
176
+ body:
177
+ encoding: ASCII-8BIT
178
+ string: ! '{"MediaPath":"http://img.bleacherreport.net/img/slides/photos/002/037/135/137267039_crop_exact.jpg?w=650&h=440&q=85","MediaType":8}'
179
+ headers:
180
+ Accept:
181
+ - application/json
182
+ Accept-Encoding:
183
+ - gzip, deflate
184
+ Authorization:
185
+ - TOKEN
186
+ Content-Type:
187
+ - application/json
188
+ Content-Length:
189
+ - '131'
190
+ User-Agent:
191
+ - Ruby
192
+ response:
193
+ status:
194
+ code: 200
195
+ message: OK
196
+ headers:
197
+ Cache-Control:
198
+ - private
199
+ Server:
200
+ - Microsoft-IIS/7.5
201
+ X-Aspnet-Version:
202
+ - 4.0.30319
203
+ X-Powered-By:
204
+ - ASP.NET
205
+ Date:
206
+ - Fri, 30 Mar 2012 07:15:05 GMT
207
+ Content-Length:
208
+ - '0'
209
+ body:
210
+ encoding: US-ASCII
211
+ string: ''
212
+ http_version: !!null
213
+ recorded_at: Fri, 30 Mar 2012 07:16:20 GMT
214
+ - request:
215
+ method: put
216
+ uri: https://api.edgecast.com/v2/mcc/customers/CUSTOMER_ID/edge/purge
217
+ body:
218
+ encoding: ASCII-8BIT
219
+ string: ! '{"MediaPath":"http://img.bleacherreport.net/img/slides/photos/002/037/135/XXX_crop_exact.jpg?w=650&h=440&q=85","MediaType":8}'
220
+ headers:
221
+ Accept:
222
+ - application/json
223
+ Accept-Encoding:
224
+ - gzip, deflate
225
+ Authorization:
226
+ - TOKEN
227
+ Content-Type:
228
+ - application/json
229
+ Content-Length:
230
+ - '125'
231
+ User-Agent:
232
+ - Ruby
233
+ response:
234
+ status:
235
+ code: 200
236
+ message: OK
237
+ headers:
238
+ Cache-Control:
239
+ - private
240
+ Server:
241
+ - Microsoft-IIS/7.5
242
+ X-Aspnet-Version:
243
+ - 4.0.30319
244
+ X-Powered-By:
245
+ - ASP.NET
246
+ Date:
247
+ - Fri, 30 Mar 2012 07:15:06 GMT
248
+ Content-Length:
249
+ - '0'
250
+ body:
251
+ encoding: US-ASCII
252
+ string: ''
253
+ http_version: !!null
254
+ recorded_at: Fri, 30 Mar 2012 07:16:21 GMT
255
+ - request:
256
+ method: put
257
+ uri: https://api.edgecast.com/v2/mcc/customers/CUSTOMER_ID/edge/purge
258
+ body:
259
+ encoding: ASCII-8BIT
260
+ string: ! '{"MediaPath":"","MediaType":8}'
261
+ headers:
262
+ Accept:
263
+ - application/json
264
+ Accept-Encoding:
265
+ - gzip, deflate
266
+ Authorization:
267
+ - TOKEN
268
+ Content-Type:
269
+ - application/json
270
+ Content-Length:
271
+ - '30'
272
+ User-Agent:
273
+ - Ruby
274
+ response:
275
+ status:
276
+ code: 400
277
+ message: Bad Request
278
+ headers:
279
+ Cache-Control:
280
+ - private
281
+ Content-Length:
282
+ - '63'
283
+ Content-Type:
284
+ - application/json; charset=utf-8
285
+ Server:
286
+ - Microsoft-IIS/7.5
287
+ X-Aspnet-Version:
288
+ - 4.0.30319
289
+ X-Powered-By:
290
+ - ASP.NET
291
+ Date:
292
+ - Fri, 30 Mar 2012 07:15:06 GMT
293
+ body:
294
+ encoding: US-ASCII
295
+ string: ! '{"Message":"MediaPath: Path is required for this media type. "}'
296
+ http_version: !!null
297
+ recorded_at: Fri, 30 Mar 2012 07:16:21 GMT
298
+ - request:
299
+ method: put
300
+ uri: https://api.edgecast.com/v2/mcc/customers/CUSTOMER_ID/edge/purge
301
+ body:
302
+ encoding: ASCII-8BIT
303
+ string: ! '{"MediaPath":"http://www.amazon.com","MediaType":8}'
304
+ headers:
305
+ Accept:
306
+ - application/json
307
+ Accept-Encoding:
308
+ - gzip, deflate
309
+ Authorization:
310
+ - TOKEN
311
+ Content-Type:
312
+ - application/json
313
+ Content-Length:
314
+ - '51'
315
+ User-Agent:
316
+ - Ruby
317
+ response:
318
+ status:
319
+ code: 400
320
+ message: Bad Request
321
+ headers:
322
+ Cache-Control:
323
+ - private
324
+ Content-Length:
325
+ - '183'
326
+ Content-Type:
327
+ - application/json; charset=utf-8
328
+ Server:
329
+ - Microsoft-IIS/7.5
330
+ X-Aspnet-Version:
331
+ - 4.0.30319
332
+ X-Powered-By:
333
+ - ASP.NET
334
+ Date:
335
+ - Fri, 30 Mar 2012 07:15:07 GMT
336
+ body:
337
+ encoding: US-ASCII
338
+ string: ! '{"Message":"Invalid strPath parameter. Please double check the path
339
+ to make sure it is valid. Also check that the media type id represents the
340
+ correct platform for the path given."}'
341
+ http_version: !!null
342
+ recorded_at: Fri, 30 Mar 2012 07:16:21 GMT
343
+ recorded_with: VCR 2.0.0
@@ -0,0 +1,159 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.edgecast.com/v2/mcc/customers/CUSTOMER_ID/compression
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Authorization:
15
+ - TOKEN
16
+ User-Agent:
17
+ - Ruby
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Cache-Control:
24
+ - private
25
+ Content-Length:
26
+ - '133'
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Server:
30
+ - Microsoft-IIS/7.5
31
+ X-Aspnet-Version:
32
+ - 4.0.30319
33
+ X-Powered-By:
34
+ - ASP.NET
35
+ Date:
36
+ - Fri, 30 Mar 2012 07:14:58 GMT
37
+ body:
38
+ encoding: US-ASCII
39
+ string: ! '[{"MediaTypeId":8,"Status":1,"ContentTypes":["text\/plain","text\/html","text\/css","application\/x-javascript","text\/javascript"]}]'
40
+ http_version: !!null
41
+ recorded_at: Fri, 30 Mar 2012 07:16:13 GMT
42
+ - request:
43
+ method: get
44
+ uri: https://api.edgecast.com/v2/mcc/customers/CUSTOMER_ID/compression
45
+ body:
46
+ encoding: US-ASCII
47
+ string: ''
48
+ headers:
49
+ Accept:
50
+ - application/json
51
+ Accept-Encoding:
52
+ - gzip, deflate
53
+ Authorization:
54
+ - XXXX
55
+ User-Agent:
56
+ - Ruby
57
+ response:
58
+ status:
59
+ code: 403
60
+ message: Forbidden
61
+ headers:
62
+ Cache-Control:
63
+ - private
64
+ Content-Length:
65
+ - '26'
66
+ Content-Type:
67
+ - application/json; charset=utf-8
68
+ Server:
69
+ - Microsoft-IIS/7.5
70
+ X-Aspnet-Version:
71
+ - 4.0.30319
72
+ X-Powered-By:
73
+ - ASP.NET
74
+ Date:
75
+ - Fri, 30 Mar 2012 07:14:59 GMT
76
+ body:
77
+ encoding: US-ASCII
78
+ string: ! '{"Message":"Invalid User"}'
79
+ http_version: !!null
80
+ recorded_at: Fri, 30 Mar 2012 07:16:15 GMT
81
+ - request:
82
+ method: get
83
+ uri: https://api.edgecast.com/v2/mcc/customers/XXXX/compression
84
+ body:
85
+ encoding: US-ASCII
86
+ string: ''
87
+ headers:
88
+ Accept:
89
+ - application/json
90
+ Accept-Encoding:
91
+ - gzip, deflate
92
+ Authorization:
93
+ - TOKEN
94
+ User-Agent:
95
+ - Ruby
96
+ response:
97
+ status:
98
+ code: 400
99
+ message: Bad Request
100
+ headers:
101
+ Cache-Control:
102
+ - private
103
+ Content-Length:
104
+ - '42'
105
+ Content-Type:
106
+ - application/json; charset=utf-8
107
+ Server:
108
+ - Microsoft-IIS/7.5
109
+ X-Aspnet-Version:
110
+ - 4.0.30319
111
+ X-Powered-By:
112
+ - ASP.NET
113
+ Date:
114
+ - Fri, 30 Mar 2012 07:15:02 GMT
115
+ body:
116
+ encoding: US-ASCII
117
+ string: ! '{"Message":"Invalid account number value"}'
118
+ http_version: !!null
119
+ recorded_at: Fri, 30 Mar 2012 07:16:17 GMT
120
+ - request:
121
+ method: get
122
+ uri: https://api.edgecast.com/v2/mcc/customers/XXXX/compression
123
+ body:
124
+ encoding: US-ASCII
125
+ string: ''
126
+ headers:
127
+ Accept:
128
+ - application/json
129
+ Accept-Encoding:
130
+ - gzip, deflate
131
+ Authorization:
132
+ - XXXX
133
+ User-Agent:
134
+ - Ruby
135
+ response:
136
+ status:
137
+ code: 403
138
+ message: Forbidden
139
+ headers:
140
+ Cache-Control:
141
+ - private
142
+ Content-Length:
143
+ - '26'
144
+ Content-Type:
145
+ - application/json; charset=utf-8
146
+ Server:
147
+ - Microsoft-IIS/7.5
148
+ X-Aspnet-Version:
149
+ - 4.0.30319
150
+ X-Powered-By:
151
+ - ASP.NET
152
+ Date:
153
+ - Fri, 30 Mar 2012 07:15:03 GMT
154
+ body:
155
+ encoding: US-ASCII
156
+ string: ! '{"Message":"Invalid User"}'
157
+ http_version: !!null
158
+ recorded_at: Fri, 30 Mar 2012 07:16:17 GMT
159
+ recorded_with: VCR 2.0.0
@@ -18,19 +18,19 @@ describe Reggie do
18
18
 
19
19
  describe "with valid customer ID and invalid authorization token" do
20
20
  it "should return invalid Reggie object" do
21
- Reggie.new(:customer_id => "XXXX", :token => "invalid").valid?.should be_false
21
+ Reggie.new(:customer_id => EDGECAST_ACCOUNT['customer_id'], :token => "XXXX").valid?.should be_false
22
22
  end
23
23
  end
24
24
 
25
25
  describe "with invalid customer ID and valid authorization token" do
26
26
  it "should return invalid Reggie object" do
27
- Reggie.new(:customer_id => "XXXX", :token => "valid").valid?.should be_false
27
+ Reggie.new(:customer_id => "XXXX", :token => EDGECAST_ACCOUNT['token']).valid?.should be_false
28
28
  end
29
29
  end
30
30
 
31
31
  describe "with invalid customer ID and invalid authorization token" do
32
32
  it "should return invalid Reggie object" do
33
- Reggie.new(:customer_id => "XXXX", :token => "invalid").valid?.should be_false
33
+ Reggie.new(:customer_id => "XXXX", :token => "XXXX").valid?.should be_false
34
34
  end
35
35
  end
36
36
  end
@@ -55,25 +55,25 @@ describe Reggie do
55
55
  [:load, :purge].each do |method|
56
56
  describe "#{method} valid cached image" do
57
57
  it "should return a 200 response" do
58
- @reg.put(method, @urls[:valid]).code.should == 200
58
+ @reg.send(method, @urls[:valid]).code.should == 200
59
59
  end
60
60
  end
61
61
 
62
62
  describe "#{method} non-existent cached image" do
63
63
  it "should return a 200 response" do
64
- @reg.put(method, @urls[:non_existent]).code.should == 200
64
+ @reg.send(method, @urls[:non_existent]).code.should == 200
65
65
  end
66
66
  end
67
67
 
68
68
  describe "#{method} empty URL" do
69
69
  it "should return a RestClient::BadRequest" do
70
- @reg.put(method, @urls[:empty]).should be_a RestClient::BadRequest
70
+ @reg.send(method, @urls[:empty]).should be_a RestClient::BadRequest
71
71
  end
72
72
  end
73
73
 
74
74
  describe "#{method} image from wrong domain" do
75
75
  it "should return a RestClient::BadRequest" do
76
- @reg.put(method, @urls[:wrong_domain]).should be_a RestClient::BadRequest
76
+ @reg.send(method, @urls[:wrong_domain]).should be_a RestClient::BadRequest
77
77
  end
78
78
  end
79
79
  end
@@ -15,7 +15,7 @@ end
15
15
  EDGECAST_ACCOUNT = YAML.load open File.join File.dirname(__FILE__), "config", "edgecast.yml"
16
16
 
17
17
  VCR.configure do |config|
18
- config.cassette_library_dir = 'spec/fixtures/reggie'
18
+ config.cassette_library_dir = 'spec/fixtures/vcr'
19
19
  config.filter_sensitive_data('CUSTOMER_ID') { EDGECAST_ACCOUNT['customer_id'] }
20
20
  config.filter_sensitive_data('TOKEN') { EDGECAST_ACCOUNT['token'] }
21
21
  config.hook_into :webmock
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reggie
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jimmy Huang
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-03-29 00:00:00 -07:00
18
+ date: 2012-03-30 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -72,12 +72,12 @@ dependencies:
72
72
  requirements:
73
73
  - - ~>
74
74
  - !ruby/object:Gem::Version
75
- hash: 23
75
+ hash: 21
76
76
  segments:
77
77
  - 1
78
- - 0
79
- - 0
80
- version: 1.0.0
78
+ - 1
79
+ - 3
80
+ version: 1.1.3
81
81
  requirement: *id004
82
82
  - !ruby/object:Gem::Dependency
83
83
  prerelease: false
@@ -113,12 +113,13 @@ files:
113
113
  - Rakefile
114
114
  - VERSION
115
115
  - init.rb
116
+ - lib/cache_accessor.rb
116
117
  - lib/reggie.rb
117
118
  - rails/init.rb
118
119
  - reggie.gemspec
119
120
  - spec/config/edgecast.yml
120
- - spec/fixtures/reggie/cache_management.yml
121
- - spec/fixtures/reggie/new.yml
121
+ - spec/fixtures/vcr/cache_management.yml
122
+ - spec/fixtures/vcr/new.yml
122
123
  - spec/reggie_spec.rb
123
124
  - spec/spec_helper.rb
124
125
  has_rdoc: true
@@ -1,307 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: put
5
- uri: https://api.edgecast.com/v2/mcc/customers/CUSTOMER_ID/edge/load
6
- body:
7
- string: "{\"MediaPath\":\"http://img.bleacherreport.net/img/slides/photos/002/037/135/137267039_crop_exact.jpg?w=650&h=440&q=85\",\"MediaType\":8}"
8
- headers:
9
- Content-Length:
10
- - "131"
11
- Accept-Encoding:
12
- - gzip, deflate
13
- Authorization:
14
- - TOKEN
15
- Accept:
16
- - application/json
17
- Content-Type:
18
- - application/json
19
- response:
20
- status:
21
- code: 200
22
- message: OK
23
- headers:
24
- Content-Length:
25
- - "0"
26
- Cache-Control:
27
- - private
28
- Server:
29
- - Microsoft-IIS/7.5
30
- X-Aspnet-Version:
31
- - 4.0.30319
32
- X-Powered-By:
33
- - ASP.NET
34
- Date:
35
- - Thu, 29 Mar 2012 16:11:18 GMT
36
- body:
37
- string: ""
38
- http_version:
39
- recorded_at: Thu, 29 Mar 2012 16:12:35 GMT
40
- - request:
41
- method: put
42
- uri: https://api.edgecast.com/v2/mcc/customers/CUSTOMER_ID/edge/load
43
- body:
44
- string: "{\"MediaPath\":\"http://img.bleacherreport.net/img/slides/photos/002/037/135/XXX_crop_exact.jpg?w=650&h=440&q=85\",\"MediaType\":8}"
45
- headers:
46
- Content-Length:
47
- - "125"
48
- Accept-Encoding:
49
- - gzip, deflate
50
- Authorization:
51
- - TOKEN
52
- Accept:
53
- - application/json
54
- Content-Type:
55
- - application/json
56
- response:
57
- status:
58
- code: 200
59
- message: OK
60
- headers:
61
- Content-Length:
62
- - "0"
63
- Cache-Control:
64
- - private
65
- Server:
66
- - Microsoft-IIS/7.5
67
- X-Aspnet-Version:
68
- - 4.0.30319
69
- X-Powered-By:
70
- - ASP.NET
71
- Date:
72
- - Thu, 29 Mar 2012 16:11:18 GMT
73
- body:
74
- string: ""
75
- http_version:
76
- recorded_at: Thu, 29 Mar 2012 16:12:36 GMT
77
- - request:
78
- method: put
79
- uri: https://api.edgecast.com/v2/mcc/customers/CUSTOMER_ID/edge/load
80
- body:
81
- string: "{\"MediaPath\":\"\",\"MediaType\":8}"
82
- headers:
83
- Content-Length:
84
- - "30"
85
- Accept-Encoding:
86
- - gzip, deflate
87
- Authorization:
88
- - TOKEN
89
- Accept:
90
- - application/json
91
- Content-Type:
92
- - application/json
93
- response:
94
- status:
95
- code: 400
96
- message: Bad Request
97
- headers:
98
- Content-Length:
99
- - "63"
100
- Cache-Control:
101
- - private
102
- Server:
103
- - Microsoft-IIS/7.5
104
- X-Aspnet-Version:
105
- - 4.0.30319
106
- X-Powered-By:
107
- - ASP.NET
108
- Content-Type:
109
- - application/json; charset=utf-8
110
- Date:
111
- - Thu, 29 Mar 2012 16:11:19 GMT
112
- body:
113
- string: "{\"Message\":\"MediaPath: Path is required for this media type. \"}"
114
- http_version:
115
- recorded_at: Thu, 29 Mar 2012 16:12:36 GMT
116
- - request:
117
- method: put
118
- uri: https://api.edgecast.com/v2/mcc/customers/CUSTOMER_ID/edge/load
119
- body:
120
- string: "{\"MediaPath\":\"http://www.amazon.com\",\"MediaType\":8}"
121
- headers:
122
- Content-Length:
123
- - "51"
124
- Accept-Encoding:
125
- - gzip, deflate
126
- Authorization:
127
- - TOKEN
128
- Accept:
129
- - application/json
130
- Content-Type:
131
- - application/json
132
- response:
133
- status:
134
- code: 400
135
- message: Bad Request
136
- headers:
137
- Content-Length:
138
- - "183"
139
- Cache-Control:
140
- - private
141
- Server:
142
- - Microsoft-IIS/7.5
143
- X-Aspnet-Version:
144
- - 4.0.30319
145
- X-Powered-By:
146
- - ASP.NET
147
- Content-Type:
148
- - application/json; charset=utf-8
149
- Date:
150
- - Thu, 29 Mar 2012 16:11:19 GMT
151
- body:
152
- string: "{\"Message\":\"Invalid strPath parameter. Please double check the path to make sure it is valid. Also check that the media type id represents the correct platform for the path given.\"}"
153
- http_version:
154
- recorded_at: Thu, 29 Mar 2012 16:12:37 GMT
155
- - request:
156
- method: put
157
- uri: https://api.edgecast.com/v2/mcc/customers/CUSTOMER_ID/edge/purge
158
- body:
159
- string: "{\"MediaPath\":\"http://img.bleacherreport.net/img/slides/photos/002/037/135/137267039_crop_exact.jpg?w=650&h=440&q=85\",\"MediaType\":8}"
160
- headers:
161
- Content-Length:
162
- - "131"
163
- Accept-Encoding:
164
- - gzip, deflate
165
- Authorization:
166
- - TOKEN
167
- Accept:
168
- - application/json
169
- Content-Type:
170
- - application/json
171
- response:
172
- status:
173
- code: 200
174
- message: OK
175
- headers:
176
- Content-Length:
177
- - "0"
178
- Cache-Control:
179
- - private
180
- Server:
181
- - Microsoft-IIS/7.5
182
- X-Aspnet-Version:
183
- - 4.0.30319
184
- X-Powered-By:
185
- - ASP.NET
186
- Date:
187
- - Thu, 29 Mar 2012 16:11:19 GMT
188
- body:
189
- string: ""
190
- http_version:
191
- recorded_at: Thu, 29 Mar 2012 16:12:37 GMT
192
- - request:
193
- method: put
194
- uri: https://api.edgecast.com/v2/mcc/customers/CUSTOMER_ID/edge/purge
195
- body:
196
- string: "{\"MediaPath\":\"http://img.bleacherreport.net/img/slides/photos/002/037/135/XXX_crop_exact.jpg?w=650&h=440&q=85\",\"MediaType\":8}"
197
- headers:
198
- Content-Length:
199
- - "125"
200
- Accept-Encoding:
201
- - gzip, deflate
202
- Authorization:
203
- - TOKEN
204
- Accept:
205
- - application/json
206
- Content-Type:
207
- - application/json
208
- response:
209
- status:
210
- code: 200
211
- message: OK
212
- headers:
213
- Content-Length:
214
- - "0"
215
- Cache-Control:
216
- - private
217
- Server:
218
- - Microsoft-IIS/7.5
219
- X-Aspnet-Version:
220
- - 4.0.30319
221
- X-Powered-By:
222
- - ASP.NET
223
- Date:
224
- - Thu, 29 Mar 2012 16:11:20 GMT
225
- body:
226
- string: ""
227
- http_version:
228
- recorded_at: Thu, 29 Mar 2012 16:12:37 GMT
229
- - request:
230
- method: put
231
- uri: https://api.edgecast.com/v2/mcc/customers/CUSTOMER_ID/edge/purge
232
- body:
233
- string: "{\"MediaPath\":\"\",\"MediaType\":8}"
234
- headers:
235
- Content-Length:
236
- - "30"
237
- Accept-Encoding:
238
- - gzip, deflate
239
- Authorization:
240
- - TOKEN
241
- Accept:
242
- - application/json
243
- Content-Type:
244
- - application/json
245
- response:
246
- status:
247
- code: 400
248
- message: Bad Request
249
- headers:
250
- Content-Length:
251
- - "63"
252
- Cache-Control:
253
- - private
254
- Server:
255
- - Microsoft-IIS/7.5
256
- X-Aspnet-Version:
257
- - 4.0.30319
258
- X-Powered-By:
259
- - ASP.NET
260
- Content-Type:
261
- - application/json; charset=utf-8
262
- Date:
263
- - Thu, 29 Mar 2012 16:11:20 GMT
264
- body:
265
- string: "{\"Message\":\"MediaPath: Path is required for this media type. \"}"
266
- http_version:
267
- recorded_at: Thu, 29 Mar 2012 16:12:38 GMT
268
- - request:
269
- method: put
270
- uri: https://api.edgecast.com/v2/mcc/customers/CUSTOMER_ID/edge/purge
271
- body:
272
- string: "{\"MediaPath\":\"http://www.amazon.com\",\"MediaType\":8}"
273
- headers:
274
- Content-Length:
275
- - "51"
276
- Accept-Encoding:
277
- - gzip, deflate
278
- Authorization:
279
- - TOKEN
280
- Accept:
281
- - application/json
282
- Content-Type:
283
- - application/json
284
- response:
285
- status:
286
- code: 400
287
- message: Bad Request
288
- headers:
289
- Content-Length:
290
- - "183"
291
- Cache-Control:
292
- - private
293
- Server:
294
- - Microsoft-IIS/7.5
295
- X-Aspnet-Version:
296
- - 4.0.30319
297
- X-Powered-By:
298
- - ASP.NET
299
- Content-Type:
300
- - application/json; charset=utf-8
301
- Date:
302
- - Thu, 29 Mar 2012 16:11:20 GMT
303
- body:
304
- string: "{\"Message\":\"Invalid strPath parameter. Please double check the path to make sure it is valid. Also check that the media type id represents the correct platform for the path given.\"}"
305
- http_version:
306
- recorded_at: Thu, 29 Mar 2012 16:12:38 GMT
307
- recorded_with: VCR 2.0.0
@@ -1,143 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://api.edgecast.com/v2/mcc/customers/CUSTOMER_ID/compression
6
- body:
7
- string: ""
8
- headers:
9
- Accept-Encoding:
10
- - gzip, deflate
11
- Authorization:
12
- - TOKEN
13
- Accept:
14
- - application/json
15
- response:
16
- status:
17
- code: 200
18
- message: OK
19
- headers:
20
- Content-Length:
21
- - "133"
22
- Cache-Control:
23
- - private
24
- Server:
25
- - Microsoft-IIS/7.5
26
- X-Aspnet-Version:
27
- - 4.0.30319
28
- X-Powered-By:
29
- - ASP.NET
30
- Content-Type:
31
- - application/json; charset=utf-8
32
- Date:
33
- - Thu, 29 Mar 2012 16:11:17 GMT
34
- body:
35
- string: "[{\"MediaTypeId\":8,\"Status\":1,\"ContentTypes\":[\"text\\/plain\",\"text\\/html\",\"text\\/css\",\"application\\/x-javascript\",\"text\\/javascript\"]}]"
36
- http_version:
37
- recorded_at: Thu, 29 Mar 2012 16:12:35 GMT
38
- - request:
39
- method: get
40
- uri: https://api.edgecast.com/v2/mcc/customers/XXXX/compression
41
- body:
42
- string: ""
43
- headers:
44
- Accept-Encoding:
45
- - gzip, deflate
46
- Authorization:
47
- - invalid
48
- Accept:
49
- - application/json
50
- response:
51
- status:
52
- code: 403
53
- message: Forbidden
54
- headers:
55
- Content-Length:
56
- - "26"
57
- Cache-Control:
58
- - private
59
- Server:
60
- - Microsoft-IIS/7.5
61
- X-Aspnet-Version:
62
- - 4.0.30319
63
- X-Powered-By:
64
- - ASP.NET
65
- Content-Type:
66
- - application/json; charset=utf-8
67
- Date:
68
- - Thu, 29 Mar 2012 16:11:17 GMT
69
- body:
70
- string: "{\"Message\":\"Invalid User\"}"
71
- http_version:
72
- recorded_at: Thu, 29 Mar 2012 16:12:35 GMT
73
- - request:
74
- method: get
75
- uri: https://api.edgecast.com/v2/mcc/customers/XXXX/compression
76
- body:
77
- string: ""
78
- headers:
79
- Accept-Encoding:
80
- - gzip, deflate
81
- Authorization:
82
- - valid
83
- Accept:
84
- - application/json
85
- response:
86
- status:
87
- code: 403
88
- message: Forbidden
89
- headers:
90
- Content-Length:
91
- - "26"
92
- Cache-Control:
93
- - private
94
- Server:
95
- - Microsoft-IIS/7.5
96
- X-Aspnet-Version:
97
- - 4.0.30319
98
- X-Powered-By:
99
- - ASP.NET
100
- Content-Type:
101
- - application/json; charset=utf-8
102
- Date:
103
- - Thu, 29 Mar 2012 16:11:17 GMT
104
- body:
105
- string: "{\"Message\":\"Invalid User\"}"
106
- http_version:
107
- recorded_at: Thu, 29 Mar 2012 16:12:35 GMT
108
- - request:
109
- method: get
110
- uri: https://api.edgecast.com/v2/mcc/customers/XXXX/compression
111
- body:
112
- string: ""
113
- headers:
114
- Accept-Encoding:
115
- - gzip, deflate
116
- Authorization:
117
- - invalid
118
- Accept:
119
- - application/json
120
- response:
121
- status:
122
- code: 403
123
- message: Forbidden
124
- headers:
125
- Content-Length:
126
- - "26"
127
- Cache-Control:
128
- - private
129
- Server:
130
- - Microsoft-IIS/7.5
131
- X-Aspnet-Version:
132
- - 4.0.30319
133
- X-Powered-By:
134
- - ASP.NET
135
- Content-Type:
136
- - application/json; charset=utf-8
137
- Date:
138
- - Thu, 29 Mar 2012 16:11:17 GMT
139
- body:
140
- string: "{\"Message\":\"Invalid User\"}"
141
- http_version:
142
- recorded_at: Thu, 29 Mar 2012 16:12:35 GMT
143
- recorded_with: VCR 2.0.0