reggie 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/reggie.rb +2 -13
- data/reggie.gemspec +3 -2
- data/spec/config/edgecast.yml +2 -0
- data/spec/fixtures/reggie/cache_management.yml +89 -89
- data/spec/fixtures/reggie/new.yml +44 -44
- data/spec/reggie_spec.rb +6 -6
- data/spec/spec_helper.rb +3 -6
- metadata +5 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/lib/reggie.rb
CHANGED
@@ -24,20 +24,9 @@ class Reggie
|
|
24
24
|
@valid
|
25
25
|
end
|
26
26
|
|
27
|
-
def
|
27
|
+
def put(method, image_url)
|
28
28
|
begin
|
29
|
-
response = RestClient.put "#{@base_uri}/#{@customer_id}/edge
|
30
|
-
{:MediaPath => image_url, :MediaType => 8}.to_json,
|
31
|
-
:authorization => @token,
|
32
|
-
:content_type => :json,
|
33
|
-
:accept => :json
|
34
|
-
rescue => e
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def purge(image_url)
|
39
|
-
begin
|
40
|
-
response = RestClient.put "#{@base_uri}/#{@customer_id}/edge/purge",
|
29
|
+
response = RestClient.put "#{@base_uri}/#{@customer_id}/edge/#{method}",
|
41
30
|
{:MediaPath => image_url, :MediaType => 8}.to_json,
|
42
31
|
:authorization => @token,
|
43
32
|
:content_type => :json,
|
data/reggie.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{reggie}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.2"
|
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-
|
12
|
+
s.date = %q{2012-03-28}
|
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 = [
|
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
"lib/reggie.rb",
|
29
29
|
"rails/init.rb",
|
30
30
|
"reggie.gemspec",
|
31
|
+
"spec/config/edgecast.yml",
|
31
32
|
"spec/fixtures/reggie/cache_management.yml",
|
32
33
|
"spec/fixtures/reggie/new.yml",
|
33
34
|
"spec/reggie_spec.rb",
|
@@ -1,21 +1,22 @@
|
|
1
1
|
---
|
2
|
+
recorded_with: VCR 2.0.0
|
2
3
|
http_interactions:
|
3
4
|
- request:
|
4
5
|
method: put
|
5
6
|
uri: https://api.edgecast.com/v2/mcc/customers/CUSTOMER_ID/edge/load
|
6
7
|
body:
|
7
|
-
string: "{\"
|
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}"
|
8
9
|
headers:
|
9
10
|
Accept:
|
10
11
|
- application/json
|
11
|
-
|
12
|
-
-
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
13
14
|
Content-Length:
|
14
15
|
- "131"
|
16
|
+
Authorization:
|
17
|
+
- TOKEN
|
15
18
|
Accept-Encoding:
|
16
19
|
- gzip, deflate
|
17
|
-
Content-Type:
|
18
|
-
- application/json
|
19
20
|
response:
|
20
21
|
status:
|
21
22
|
code: 200
|
@@ -23,36 +24,36 @@ http_interactions:
|
|
23
24
|
headers:
|
24
25
|
Server:
|
25
26
|
- Microsoft-IIS/7.5
|
27
|
+
Cache-Control:
|
28
|
+
- private
|
26
29
|
Date:
|
27
|
-
-
|
28
|
-
Content-Length:
|
29
|
-
- "0"
|
30
|
+
- Wed, 28 Mar 2012 18:44:21 GMT
|
30
31
|
X-Aspnet-Version:
|
31
32
|
- 4.0.30319
|
32
33
|
X-Powered-By:
|
33
34
|
- ASP.NET
|
34
|
-
|
35
|
-
-
|
35
|
+
Content-Length:
|
36
|
+
- "0"
|
36
37
|
body:
|
37
38
|
string: ""
|
38
39
|
http_version:
|
39
|
-
recorded_at:
|
40
|
+
recorded_at: Wed, 28 Mar 2012 18:45:33 GMT
|
40
41
|
- request:
|
41
42
|
method: put
|
42
43
|
uri: https://api.edgecast.com/v2/mcc/customers/CUSTOMER_ID/edge/load
|
43
44
|
body:
|
44
|
-
string: "{\"
|
45
|
+
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
46
|
headers:
|
46
47
|
Accept:
|
47
48
|
- application/json
|
48
|
-
|
49
|
-
-
|
49
|
+
Content-Type:
|
50
|
+
- application/json
|
50
51
|
Content-Length:
|
51
52
|
- "125"
|
53
|
+
Authorization:
|
54
|
+
- TOKEN
|
52
55
|
Accept-Encoding:
|
53
56
|
- gzip, deflate
|
54
|
-
Content-Type:
|
55
|
-
- application/json
|
56
57
|
response:
|
57
58
|
status:
|
58
59
|
code: 200
|
@@ -60,36 +61,36 @@ http_interactions:
|
|
60
61
|
headers:
|
61
62
|
Server:
|
62
63
|
- Microsoft-IIS/7.5
|
64
|
+
Cache-Control:
|
65
|
+
- private
|
63
66
|
Date:
|
64
|
-
-
|
65
|
-
Content-Length:
|
66
|
-
- "0"
|
67
|
+
- Wed, 28 Mar 2012 18:44:21 GMT
|
67
68
|
X-Aspnet-Version:
|
68
69
|
- 4.0.30319
|
69
70
|
X-Powered-By:
|
70
71
|
- ASP.NET
|
71
|
-
|
72
|
-
-
|
72
|
+
Content-Length:
|
73
|
+
- "0"
|
73
74
|
body:
|
74
75
|
string: ""
|
75
76
|
http_version:
|
76
|
-
recorded_at:
|
77
|
+
recorded_at: Wed, 28 Mar 2012 18:45:34 GMT
|
77
78
|
- request:
|
78
79
|
method: put
|
79
80
|
uri: https://api.edgecast.com/v2/mcc/customers/CUSTOMER_ID/edge/load
|
80
81
|
body:
|
81
|
-
string: "{\"
|
82
|
+
string: "{\"MediaPath\":\"\",\"MediaType\":8}"
|
82
83
|
headers:
|
83
84
|
Accept:
|
84
85
|
- application/json
|
85
|
-
|
86
|
-
-
|
86
|
+
Content-Type:
|
87
|
+
- application/json
|
87
88
|
Content-Length:
|
88
89
|
- "30"
|
90
|
+
Authorization:
|
91
|
+
- TOKEN
|
89
92
|
Accept-Encoding:
|
90
93
|
- gzip, deflate
|
91
|
-
Content-Type:
|
92
|
-
- application/json
|
93
94
|
response:
|
94
95
|
status:
|
95
96
|
code: 400
|
@@ -97,38 +98,38 @@ http_interactions:
|
|
97
98
|
headers:
|
98
99
|
Server:
|
99
100
|
- Microsoft-IIS/7.5
|
101
|
+
Cache-Control:
|
102
|
+
- private
|
100
103
|
Date:
|
101
|
-
-
|
102
|
-
Content-Length:
|
103
|
-
- "63"
|
104
|
+
- Wed, 28 Mar 2012 18:44:22 GMT
|
104
105
|
X-Aspnet-Version:
|
105
106
|
- 4.0.30319
|
106
107
|
X-Powered-By:
|
107
108
|
- ASP.NET
|
108
109
|
Content-Type:
|
109
110
|
- application/json; charset=utf-8
|
110
|
-
|
111
|
-
-
|
111
|
+
Content-Length:
|
112
|
+
- "63"
|
112
113
|
body:
|
113
114
|
string: "{\"Message\":\"MediaPath: Path is required for this media type. \"}"
|
114
115
|
http_version:
|
115
|
-
recorded_at:
|
116
|
+
recorded_at: Wed, 28 Mar 2012 18:45:34 GMT
|
116
117
|
- request:
|
117
118
|
method: put
|
118
119
|
uri: https://api.edgecast.com/v2/mcc/customers/CUSTOMER_ID/edge/load
|
119
120
|
body:
|
120
|
-
string: "{\"
|
121
|
+
string: "{\"MediaPath\":\"http://www.amazon.com\",\"MediaType\":8}"
|
121
122
|
headers:
|
122
123
|
Accept:
|
123
124
|
- application/json
|
124
|
-
|
125
|
-
-
|
125
|
+
Content-Type:
|
126
|
+
- application/json
|
126
127
|
Content-Length:
|
127
128
|
- "51"
|
129
|
+
Authorization:
|
130
|
+
- TOKEN
|
128
131
|
Accept-Encoding:
|
129
132
|
- gzip, deflate
|
130
|
-
Content-Type:
|
131
|
-
- application/json
|
132
133
|
response:
|
133
134
|
status:
|
134
135
|
code: 400
|
@@ -136,38 +137,38 @@ http_interactions:
|
|
136
137
|
headers:
|
137
138
|
Server:
|
138
139
|
- Microsoft-IIS/7.5
|
140
|
+
Cache-Control:
|
141
|
+
- private
|
139
142
|
Date:
|
140
|
-
-
|
141
|
-
Content-Length:
|
142
|
-
- "183"
|
143
|
+
- Wed, 28 Mar 2012 18:44:22 GMT
|
143
144
|
X-Aspnet-Version:
|
144
145
|
- 4.0.30319
|
145
146
|
X-Powered-By:
|
146
147
|
- ASP.NET
|
147
148
|
Content-Type:
|
148
149
|
- application/json; charset=utf-8
|
149
|
-
|
150
|
-
-
|
150
|
+
Content-Length:
|
151
|
+
- "183"
|
151
152
|
body:
|
152
153
|
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
154
|
http_version:
|
154
|
-
recorded_at:
|
155
|
+
recorded_at: Wed, 28 Mar 2012 18:45:35 GMT
|
155
156
|
- request:
|
156
157
|
method: put
|
157
158
|
uri: https://api.edgecast.com/v2/mcc/customers/CUSTOMER_ID/edge/purge
|
158
159
|
body:
|
159
|
-
string: "{\"
|
160
|
+
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
161
|
headers:
|
161
162
|
Accept:
|
162
163
|
- application/json
|
163
|
-
|
164
|
-
-
|
164
|
+
Content-Type:
|
165
|
+
- application/json
|
165
166
|
Content-Length:
|
166
167
|
- "131"
|
168
|
+
Authorization:
|
169
|
+
- TOKEN
|
167
170
|
Accept-Encoding:
|
168
171
|
- gzip, deflate
|
169
|
-
Content-Type:
|
170
|
-
- application/json
|
171
172
|
response:
|
172
173
|
status:
|
173
174
|
code: 200
|
@@ -175,36 +176,36 @@ http_interactions:
|
|
175
176
|
headers:
|
176
177
|
Server:
|
177
178
|
- Microsoft-IIS/7.5
|
179
|
+
Cache-Control:
|
180
|
+
- private
|
178
181
|
Date:
|
179
|
-
-
|
180
|
-
Content-Length:
|
181
|
-
- "0"
|
182
|
+
- Wed, 28 Mar 2012 18:44:23 GMT
|
182
183
|
X-Aspnet-Version:
|
183
184
|
- 4.0.30319
|
184
185
|
X-Powered-By:
|
185
186
|
- ASP.NET
|
186
|
-
|
187
|
-
-
|
187
|
+
Content-Length:
|
188
|
+
- "0"
|
188
189
|
body:
|
189
190
|
string: ""
|
190
191
|
http_version:
|
191
|
-
recorded_at:
|
192
|
+
recorded_at: Wed, 28 Mar 2012 18:45:36 GMT
|
192
193
|
- request:
|
193
194
|
method: put
|
194
195
|
uri: https://api.edgecast.com/v2/mcc/customers/CUSTOMER_ID/edge/purge
|
195
196
|
body:
|
196
|
-
string: "{\"
|
197
|
+
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
198
|
headers:
|
198
199
|
Accept:
|
199
200
|
- application/json
|
200
|
-
|
201
|
-
-
|
201
|
+
Content-Type:
|
202
|
+
- application/json
|
202
203
|
Content-Length:
|
203
204
|
- "125"
|
205
|
+
Authorization:
|
206
|
+
- TOKEN
|
204
207
|
Accept-Encoding:
|
205
208
|
- gzip, deflate
|
206
|
-
Content-Type:
|
207
|
-
- application/json
|
208
209
|
response:
|
209
210
|
status:
|
210
211
|
code: 200
|
@@ -212,36 +213,36 @@ http_interactions:
|
|
212
213
|
headers:
|
213
214
|
Server:
|
214
215
|
- Microsoft-IIS/7.5
|
216
|
+
Cache-Control:
|
217
|
+
- private
|
215
218
|
Date:
|
216
|
-
-
|
217
|
-
Content-Length:
|
218
|
-
- "0"
|
219
|
+
- Wed, 28 Mar 2012 18:44:23 GMT
|
219
220
|
X-Aspnet-Version:
|
220
221
|
- 4.0.30319
|
221
222
|
X-Powered-By:
|
222
223
|
- ASP.NET
|
223
|
-
|
224
|
-
-
|
224
|
+
Content-Length:
|
225
|
+
- "0"
|
225
226
|
body:
|
226
227
|
string: ""
|
227
228
|
http_version:
|
228
|
-
recorded_at:
|
229
|
+
recorded_at: Wed, 28 Mar 2012 18:45:36 GMT
|
229
230
|
- request:
|
230
231
|
method: put
|
231
232
|
uri: https://api.edgecast.com/v2/mcc/customers/CUSTOMER_ID/edge/purge
|
232
233
|
body:
|
233
|
-
string: "{\"
|
234
|
+
string: "{\"MediaPath\":\"\",\"MediaType\":8}"
|
234
235
|
headers:
|
235
236
|
Accept:
|
236
237
|
- application/json
|
237
|
-
|
238
|
-
-
|
238
|
+
Content-Type:
|
239
|
+
- application/json
|
239
240
|
Content-Length:
|
240
241
|
- "30"
|
242
|
+
Authorization:
|
243
|
+
- TOKEN
|
241
244
|
Accept-Encoding:
|
242
245
|
- gzip, deflate
|
243
|
-
Content-Type:
|
244
|
-
- application/json
|
245
246
|
response:
|
246
247
|
status:
|
247
248
|
code: 400
|
@@ -249,38 +250,38 @@ http_interactions:
|
|
249
250
|
headers:
|
250
251
|
Server:
|
251
252
|
- Microsoft-IIS/7.5
|
253
|
+
Cache-Control:
|
254
|
+
- private
|
252
255
|
Date:
|
253
|
-
-
|
254
|
-
Content-Length:
|
255
|
-
- "63"
|
256
|
+
- Wed, 28 Mar 2012 18:44:24 GMT
|
256
257
|
X-Aspnet-Version:
|
257
258
|
- 4.0.30319
|
258
259
|
X-Powered-By:
|
259
260
|
- ASP.NET
|
260
261
|
Content-Type:
|
261
262
|
- application/json; charset=utf-8
|
262
|
-
|
263
|
-
-
|
263
|
+
Content-Length:
|
264
|
+
- "63"
|
264
265
|
body:
|
265
266
|
string: "{\"Message\":\"MediaPath: Path is required for this media type. \"}"
|
266
267
|
http_version:
|
267
|
-
recorded_at:
|
268
|
+
recorded_at: Wed, 28 Mar 2012 18:45:36 GMT
|
268
269
|
- request:
|
269
270
|
method: put
|
270
271
|
uri: https://api.edgecast.com/v2/mcc/customers/CUSTOMER_ID/edge/purge
|
271
272
|
body:
|
272
|
-
string: "{\"
|
273
|
+
string: "{\"MediaPath\":\"http://www.amazon.com\",\"MediaType\":8}"
|
273
274
|
headers:
|
274
275
|
Accept:
|
275
276
|
- application/json
|
276
|
-
|
277
|
-
-
|
277
|
+
Content-Type:
|
278
|
+
- application/json
|
278
279
|
Content-Length:
|
279
280
|
- "51"
|
281
|
+
Authorization:
|
282
|
+
- TOKEN
|
280
283
|
Accept-Encoding:
|
281
284
|
- gzip, deflate
|
282
|
-
Content-Type:
|
283
|
-
- application/json
|
284
285
|
response:
|
285
286
|
status:
|
286
287
|
code: 400
|
@@ -288,20 +289,19 @@ http_interactions:
|
|
288
289
|
headers:
|
289
290
|
Server:
|
290
291
|
- Microsoft-IIS/7.5
|
292
|
+
Cache-Control:
|
293
|
+
- private
|
291
294
|
Date:
|
292
|
-
-
|
293
|
-
Content-Length:
|
294
|
-
- "183"
|
295
|
+
- Wed, 28 Mar 2012 18:44:24 GMT
|
295
296
|
X-Aspnet-Version:
|
296
297
|
- 4.0.30319
|
297
298
|
X-Powered-By:
|
298
299
|
- ASP.NET
|
299
300
|
Content-Type:
|
300
301
|
- application/json; charset=utf-8
|
301
|
-
|
302
|
-
-
|
302
|
+
Content-Length:
|
303
|
+
- "183"
|
303
304
|
body:
|
304
305
|
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
306
|
http_version:
|
306
|
-
recorded_at:
|
307
|
-
recorded_with: VCR 2.0.0
|
307
|
+
recorded_at: Wed, 28 Mar 2012 18:45:37 GMT
|
@@ -7,10 +7,10 @@ http_interactions:
|
|
7
7
|
body:
|
8
8
|
string: ""
|
9
9
|
headers:
|
10
|
-
Authorization:
|
11
|
-
- TOKEN
|
12
10
|
Accept:
|
13
11
|
- application/json
|
12
|
+
Authorization:
|
13
|
+
- TOKEN
|
14
14
|
Accept-Encoding:
|
15
15
|
- gzip, deflate
|
16
16
|
response:
|
@@ -18,34 +18,34 @@ http_interactions:
|
|
18
18
|
code: 200
|
19
19
|
message: OK
|
20
20
|
headers:
|
21
|
-
Content-Type:
|
22
|
-
- application/json; charset=utf-8
|
23
|
-
X-Aspnet-Version:
|
24
|
-
- 4.0.30319
|
25
|
-
X-Powered-By:
|
26
|
-
- ASP.NET
|
27
21
|
Server:
|
28
22
|
- Microsoft-IIS/7.5
|
29
|
-
Date:
|
30
|
-
- Tue, 27 Mar 2012 16:39:23 GMT
|
31
23
|
Cache-Control:
|
32
24
|
- private
|
25
|
+
Date:
|
26
|
+
- Wed, 28 Mar 2012 18:44:20 GMT
|
27
|
+
X-Aspnet-Version:
|
28
|
+
- 4.0.30319
|
29
|
+
X-Powered-By:
|
30
|
+
- ASP.NET
|
31
|
+
Content-Type:
|
32
|
+
- application/json; charset=utf-8
|
33
33
|
Content-Length:
|
34
34
|
- "133"
|
35
35
|
body:
|
36
36
|
string: "[{\"MediaTypeId\":8,\"Status\":1,\"ContentTypes\":[\"text\\/plain\",\"text\\/html\",\"text\\/css\",\"application\\/x-javascript\",\"text\\/javascript\"]}]"
|
37
37
|
http_version:
|
38
|
-
recorded_at:
|
38
|
+
recorded_at: Wed, 28 Mar 2012 18:45:32 GMT
|
39
39
|
- request:
|
40
40
|
method: get
|
41
41
|
uri: https://api.edgecast.com/v2/mcc/customers/XXXX/compression
|
42
42
|
body:
|
43
43
|
string: ""
|
44
44
|
headers:
|
45
|
-
Authorization:
|
46
|
-
- invalid
|
47
45
|
Accept:
|
48
46
|
- application/json
|
47
|
+
Authorization:
|
48
|
+
- invalid
|
49
49
|
Accept-Encoding:
|
50
50
|
- gzip, deflate
|
51
51
|
response:
|
@@ -53,34 +53,34 @@ http_interactions:
|
|
53
53
|
code: 403
|
54
54
|
message: Forbidden
|
55
55
|
headers:
|
56
|
-
Content-Type:
|
57
|
-
- application/json; charset=utf-8
|
58
|
-
X-Aspnet-Version:
|
59
|
-
- 4.0.30319
|
60
|
-
X-Powered-By:
|
61
|
-
- ASP.NET
|
62
56
|
Server:
|
63
57
|
- Microsoft-IIS/7.5
|
64
|
-
Date:
|
65
|
-
- Tue, 27 Mar 2012 16:39:24 GMT
|
66
58
|
Cache-Control:
|
67
59
|
- private
|
60
|
+
Date:
|
61
|
+
- Wed, 28 Mar 2012 18:44:20 GMT
|
62
|
+
X-Aspnet-Version:
|
63
|
+
- 4.0.30319
|
64
|
+
X-Powered-By:
|
65
|
+
- ASP.NET
|
66
|
+
Content-Type:
|
67
|
+
- application/json; charset=utf-8
|
68
68
|
Content-Length:
|
69
69
|
- "26"
|
70
70
|
body:
|
71
71
|
string: "{\"Message\":\"Invalid User\"}"
|
72
72
|
http_version:
|
73
|
-
recorded_at:
|
73
|
+
recorded_at: Wed, 28 Mar 2012 18:45:32 GMT
|
74
74
|
- request:
|
75
75
|
method: get
|
76
76
|
uri: https://api.edgecast.com/v2/mcc/customers/XXXX/compression
|
77
77
|
body:
|
78
78
|
string: ""
|
79
79
|
headers:
|
80
|
-
Authorization:
|
81
|
-
- valid
|
82
80
|
Accept:
|
83
81
|
- application/json
|
82
|
+
Authorization:
|
83
|
+
- valid
|
84
84
|
Accept-Encoding:
|
85
85
|
- gzip, deflate
|
86
86
|
response:
|
@@ -88,34 +88,34 @@ http_interactions:
|
|
88
88
|
code: 403
|
89
89
|
message: Forbidden
|
90
90
|
headers:
|
91
|
-
Content-Type:
|
92
|
-
- application/json; charset=utf-8
|
93
|
-
X-Aspnet-Version:
|
94
|
-
- 4.0.30319
|
95
|
-
X-Powered-By:
|
96
|
-
- ASP.NET
|
97
91
|
Server:
|
98
92
|
- Microsoft-IIS/7.5
|
99
|
-
Date:
|
100
|
-
- Tue, 27 Mar 2012 16:39:24 GMT
|
101
93
|
Cache-Control:
|
102
94
|
- private
|
95
|
+
Date:
|
96
|
+
- Wed, 28 Mar 2012 18:44:20 GMT
|
97
|
+
X-Aspnet-Version:
|
98
|
+
- 4.0.30319
|
99
|
+
X-Powered-By:
|
100
|
+
- ASP.NET
|
101
|
+
Content-Type:
|
102
|
+
- application/json; charset=utf-8
|
103
103
|
Content-Length:
|
104
104
|
- "26"
|
105
105
|
body:
|
106
106
|
string: "{\"Message\":\"Invalid User\"}"
|
107
107
|
http_version:
|
108
|
-
recorded_at:
|
108
|
+
recorded_at: Wed, 28 Mar 2012 18:45:33 GMT
|
109
109
|
- request:
|
110
110
|
method: get
|
111
111
|
uri: https://api.edgecast.com/v2/mcc/customers/XXXX/compression
|
112
112
|
body:
|
113
113
|
string: ""
|
114
114
|
headers:
|
115
|
-
Authorization:
|
116
|
-
- invalid
|
117
115
|
Accept:
|
118
116
|
- application/json
|
117
|
+
Authorization:
|
118
|
+
- invalid
|
119
119
|
Accept-Encoding:
|
120
120
|
- gzip, deflate
|
121
121
|
response:
|
@@ -123,21 +123,21 @@ http_interactions:
|
|
123
123
|
code: 403
|
124
124
|
message: Forbidden
|
125
125
|
headers:
|
126
|
-
Content-Type:
|
127
|
-
- application/json; charset=utf-8
|
128
|
-
X-Aspnet-Version:
|
129
|
-
- 4.0.30319
|
130
|
-
X-Powered-By:
|
131
|
-
- ASP.NET
|
132
126
|
Server:
|
133
127
|
- Microsoft-IIS/7.5
|
134
|
-
Date:
|
135
|
-
- Tue, 27 Mar 2012 16:39:24 GMT
|
136
128
|
Cache-Control:
|
137
129
|
- private
|
130
|
+
Date:
|
131
|
+
- Wed, 28 Mar 2012 18:44:20 GMT
|
132
|
+
X-Aspnet-Version:
|
133
|
+
- 4.0.30319
|
134
|
+
X-Powered-By:
|
135
|
+
- ASP.NET
|
136
|
+
Content-Type:
|
137
|
+
- application/json; charset=utf-8
|
138
138
|
Content-Length:
|
139
139
|
- "26"
|
140
140
|
body:
|
141
141
|
string: "{\"Message\":\"Invalid User\"}"
|
142
142
|
http_version:
|
143
|
-
recorded_at:
|
143
|
+
recorded_at: Wed, 28 Mar 2012 18:45:33 GMT
|
data/spec/reggie_spec.rb
CHANGED
@@ -12,7 +12,7 @@ describe Reggie do
|
|
12
12
|
|
13
13
|
describe "with valid customer ID and valid authorization token" do
|
14
14
|
it "should return valid Reggie object" do
|
15
|
-
Reggie.new(:customer_id => EDGECAST_ACCOUNT[
|
15
|
+
Reggie.new(:customer_id => EDGECAST_ACCOUNT['customer_id'], :token => EDGECAST_ACCOUNT['token']).valid?.should be_true
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -37,7 +37,7 @@ describe Reggie do
|
|
37
37
|
|
38
38
|
context "Cache Management" do
|
39
39
|
before :all do
|
40
|
-
@reg = Reggie.new(:customer_id => EDGECAST_ACCOUNT[
|
40
|
+
@reg = Reggie.new(:customer_id => EDGECAST_ACCOUNT['customer_id'], :token => EDGECAST_ACCOUNT['token'])
|
41
41
|
@urls = {
|
42
42
|
:empty => "",
|
43
43
|
:non_existent => "http://img.bleacherreport.net/img/slides/photos/002/037/135/XXX_crop_exact.jpg?w=650&h=440&q=85",
|
@@ -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.
|
58
|
+
@reg.put(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.
|
64
|
+
@reg.put(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.
|
70
|
+
@reg.put(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.
|
76
|
+
@reg.put(method, @urls[:wrong_domain]).should be_a RestClient::BadRequest
|
77
77
|
end
|
78
78
|
end
|
79
79
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -12,14 +12,11 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
|
12
12
|
RSpec.configure do |config|
|
13
13
|
end
|
14
14
|
|
15
|
-
EDGECAST_ACCOUNT =
|
16
|
-
:customer_id => 'REPLACE_ME',
|
17
|
-
:token => 'REPLACE_ME'
|
18
|
-
}
|
15
|
+
EDGECAST_ACCOUNT = YAML.load open File.join File.dirname(__FILE__), "config", "edgecast.yml"
|
19
16
|
|
20
17
|
VCR.configure do |config|
|
21
18
|
config.cassette_library_dir = 'spec/fixtures/reggie'
|
22
|
-
config.filter_sensitive_data('CUSTOMER_ID') { EDGECAST_ACCOUNT[
|
23
|
-
config.filter_sensitive_data('TOKEN') { EDGECAST_ACCOUNT[
|
19
|
+
config.filter_sensitive_data('CUSTOMER_ID') { EDGECAST_ACCOUNT['customer_id'] }
|
20
|
+
config.filter_sensitive_data('TOKEN') { EDGECAST_ACCOUNT['token'] }
|
24
21
|
config.hook_into :webmock
|
25
22
|
end
|
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:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
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-
|
18
|
+
date: 2012-03-28 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -116,6 +116,7 @@ files:
|
|
116
116
|
- lib/reggie.rb
|
117
117
|
- rails/init.rb
|
118
118
|
- reggie.gemspec
|
119
|
+
- spec/config/edgecast.yml
|
119
120
|
- spec/fixtures/reggie/cache_management.yml
|
120
121
|
- spec/fixtures/reggie/new.yml
|
121
122
|
- spec/reggie_spec.rb
|