googl 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/Gemfile.lock +1 -1
- data/README.rdoc +57 -0
- data/VERSION +1 -1
- data/googl.gemspec +14 -5
- data/lib/googl.rb +81 -3
- data/lib/googl/base.rb +1 -1
- data/lib/googl/client_login.rb +7 -1
- data/lib/googl/expand.rb +12 -5
- data/lib/googl/request.rb +1 -1
- data/lib/googl/ruby_extensions.rb +38 -0
- data/lib/googl/shorten.rb +14 -2
- data/spec/client_spec.rb +2 -4
- data/spec/expand_spec.rb +145 -6
- data/spec/fixtures/expand_404.json +24 -0
- data/spec/fixtures/expand_projection_clicks.json +40 -0
- data/spec/fixtures/expand_projection_full.json +282 -0
- data/spec/fixtures/expand_projection_strings.json +268 -0
- data/spec/fixtures/expand_removed.json +17 -0
- data/spec/fixtures/shorten_invalid_content_type.json +12 -0
- data/spec/shared_examples.rb +39 -0
- data/spec/shorten_spec.rb +28 -11
- data/spec/spec_helper.rb +29 -0
- metadata +14 -5
@@ -0,0 +1,24 @@
|
|
1
|
+
HTTP/1.1 404 Not Found
|
2
|
+
Content-Type: application/json; charset=UTF-8
|
3
|
+
Date: Mon, 17 Jan 2011 19:54:56 GMT
|
4
|
+
Expires: Mon, 17 Jan 2011 19:54:56 GMT
|
5
|
+
Cache-Control: private, max-age=0
|
6
|
+
X-Content-Type-Options: nosniff
|
7
|
+
X-Frame-Options: SAMEORIGIN
|
8
|
+
X-XSS-Protection: 1; mode=block
|
9
|
+
Server: GSE
|
10
|
+
Transfer-Encoding: chunked
|
11
|
+
|
12
|
+
{
|
13
|
+
"error": {
|
14
|
+
"errors": [
|
15
|
+
{
|
16
|
+
"domain": "global",
|
17
|
+
"reason": "notFound",
|
18
|
+
"message": "Not Found"
|
19
|
+
}
|
20
|
+
],
|
21
|
+
"code": 404,
|
22
|
+
"message": "Not Found"
|
23
|
+
}
|
24
|
+
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
ETag: "EEZ1AD443JkEgW3KJFaymzTd26A/svhJppHIsa0kPz8H8zctbQSfo8o"
|
3
|
+
Expires: Thu, 13 Jan 2011 22:34:57 GMT
|
4
|
+
Date: Thu, 13 Jan 2011 22:34:57 GMT
|
5
|
+
Cache-Control: public, max-age=0, must-revalidate, no-transform
|
6
|
+
Content-Type: application/json; charset=UTF-8
|
7
|
+
X-Content-Type-Options: nosniff
|
8
|
+
X-Frame-Options: SAMEORIGIN
|
9
|
+
X-XSS-Protection: 1; mode=block
|
10
|
+
Server: GSE
|
11
|
+
Transfer-Encoding: chunked
|
12
|
+
|
13
|
+
{
|
14
|
+
"kind": "urlshortener#url",
|
15
|
+
"id": "http://goo.gl/DWDfi",
|
16
|
+
"longUrl": "https://github.com/zigotto/googl",
|
17
|
+
"status": "OK",
|
18
|
+
"analytics": {
|
19
|
+
"allTime": {
|
20
|
+
"shortUrlClicks": "19",
|
21
|
+
"longUrlClicks": "19"
|
22
|
+
},
|
23
|
+
"month": {
|
24
|
+
"shortUrlClicks": "19",
|
25
|
+
"longUrlClicks": "20"
|
26
|
+
},
|
27
|
+
"week": {
|
28
|
+
"shortUrlClicks": "21",
|
29
|
+
"longUrlClicks": "22"
|
30
|
+
},
|
31
|
+
"day": {
|
32
|
+
"shortUrlClicks": "23",
|
33
|
+
"longUrlClicks": "24"
|
34
|
+
},
|
35
|
+
"twoHours": {
|
36
|
+
"shortUrlClicks": "0",
|
37
|
+
"longUrlClicks": "0"
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
@@ -0,0 +1,282 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
ETag: "EEZ1AD443JkEgW3KJFaymzTd26A/vSKbsfjVRosPTJhSfOJsO-03Fek"
|
3
|
+
Expires: Thu, 13 Jan 2011 22:33:54 GMT
|
4
|
+
Date: Thu, 13 Jan 2011 22:33:54 GMT
|
5
|
+
Content-Type: application/json; charset=UTF-8
|
6
|
+
X-Content-Type-Options: nosniff
|
7
|
+
X-Frame-Options: SAMEORIGIN
|
8
|
+
X-XSS-Protection: 1; mode=block
|
9
|
+
Server: GSE
|
10
|
+
Cache-Control: public, max-age=0, must-revalidate, no-transform
|
11
|
+
Age: 0
|
12
|
+
Transfer-Encoding: chunked
|
13
|
+
|
14
|
+
{
|
15
|
+
"kind": "urlshortener#url",
|
16
|
+
"id": "http://goo.gl/DWDfi",
|
17
|
+
"longUrl": "https://github.com/zigotto/googl",
|
18
|
+
"status": "OK",
|
19
|
+
"created": "2011-01-13T03:48:10.309+00:00",
|
20
|
+
"analytics": {
|
21
|
+
"allTime": {
|
22
|
+
"shortUrlClicks": "19",
|
23
|
+
"longUrlClicks": "19",
|
24
|
+
"referrers": [
|
25
|
+
{
|
26
|
+
"count": "16",
|
27
|
+
"id": "Unknown/empty"
|
28
|
+
},
|
29
|
+
{
|
30
|
+
"count": "3",
|
31
|
+
"id": "twitter.com"
|
32
|
+
}
|
33
|
+
],
|
34
|
+
"countries": [
|
35
|
+
{
|
36
|
+
"count": "18",
|
37
|
+
"id": "BR"
|
38
|
+
},
|
39
|
+
{
|
40
|
+
"count": "1",
|
41
|
+
"id": "NO"
|
42
|
+
}
|
43
|
+
],
|
44
|
+
"browsers": [
|
45
|
+
{
|
46
|
+
"count": "11",
|
47
|
+
"id": "Chrome"
|
48
|
+
},
|
49
|
+
{
|
50
|
+
"count": "5",
|
51
|
+
"id": "Firefox"
|
52
|
+
},
|
53
|
+
{
|
54
|
+
"count": "2",
|
55
|
+
"id": "Safari"
|
56
|
+
},
|
57
|
+
{
|
58
|
+
"count": "1",
|
59
|
+
"id": "Mobile"
|
60
|
+
}
|
61
|
+
],
|
62
|
+
"platforms": [
|
63
|
+
{
|
64
|
+
"count": "7",
|
65
|
+
"id": "Macintosh"
|
66
|
+
},
|
67
|
+
{
|
68
|
+
"count": "7",
|
69
|
+
"id": "Windows"
|
70
|
+
},
|
71
|
+
{
|
72
|
+
"count": "2",
|
73
|
+
"id": "Linux"
|
74
|
+
},
|
75
|
+
{
|
76
|
+
"count": "2",
|
77
|
+
"id": "Other Unix"
|
78
|
+
},
|
79
|
+
{
|
80
|
+
"count": "1",
|
81
|
+
"id": "iPhone"
|
82
|
+
}
|
83
|
+
]
|
84
|
+
},
|
85
|
+
"month": {
|
86
|
+
"shortUrlClicks": "19",
|
87
|
+
"longUrlClicks": "19",
|
88
|
+
"referrers": [
|
89
|
+
{
|
90
|
+
"count": "16",
|
91
|
+
"id": "Unknown/empty"
|
92
|
+
},
|
93
|
+
{
|
94
|
+
"count": "3",
|
95
|
+
"id": "twitter.com"
|
96
|
+
}
|
97
|
+
],
|
98
|
+
"countries": [
|
99
|
+
{
|
100
|
+
"count": "18",
|
101
|
+
"id": "BR"
|
102
|
+
},
|
103
|
+
{
|
104
|
+
"count": "1",
|
105
|
+
"id": "NO"
|
106
|
+
}
|
107
|
+
],
|
108
|
+
"browsers": [
|
109
|
+
{
|
110
|
+
"count": "11",
|
111
|
+
"id": "Chrome"
|
112
|
+
},
|
113
|
+
{
|
114
|
+
"count": "5",
|
115
|
+
"id": "Firefox"
|
116
|
+
},
|
117
|
+
{
|
118
|
+
"count": "2",
|
119
|
+
"id": "Safari"
|
120
|
+
},
|
121
|
+
{
|
122
|
+
"count": "1",
|
123
|
+
"id": "Mobile"
|
124
|
+
}
|
125
|
+
],
|
126
|
+
"platforms": [
|
127
|
+
{
|
128
|
+
"count": "7",
|
129
|
+
"id": "Macintosh"
|
130
|
+
},
|
131
|
+
{
|
132
|
+
"count": "7",
|
133
|
+
"id": "Windows"
|
134
|
+
},
|
135
|
+
{
|
136
|
+
"count": "2",
|
137
|
+
"id": "Linux"
|
138
|
+
},
|
139
|
+
{
|
140
|
+
"count": "2",
|
141
|
+
"id": "Other Unix"
|
142
|
+
},
|
143
|
+
{
|
144
|
+
"count": "1",
|
145
|
+
"id": "iPhone"
|
146
|
+
}
|
147
|
+
]
|
148
|
+
},
|
149
|
+
"week": {
|
150
|
+
"shortUrlClicks": "19",
|
151
|
+
"longUrlClicks": "19",
|
152
|
+
"referrers": [
|
153
|
+
{
|
154
|
+
"count": "16",
|
155
|
+
"id": "Unknown/empty"
|
156
|
+
},
|
157
|
+
{
|
158
|
+
"count": "3",
|
159
|
+
"id": "twitter.com"
|
160
|
+
}
|
161
|
+
],
|
162
|
+
"countries": [
|
163
|
+
{
|
164
|
+
"count": "18",
|
165
|
+
"id": "BR"
|
166
|
+
},
|
167
|
+
{
|
168
|
+
"count": "1",
|
169
|
+
"id": "NO"
|
170
|
+
}
|
171
|
+
],
|
172
|
+
"browsers": [
|
173
|
+
{
|
174
|
+
"count": "11",
|
175
|
+
"id": "Chrome"
|
176
|
+
},
|
177
|
+
{
|
178
|
+
"count": "5",
|
179
|
+
"id": "Firefox"
|
180
|
+
},
|
181
|
+
{
|
182
|
+
"count": "2",
|
183
|
+
"id": "Safari"
|
184
|
+
},
|
185
|
+
{
|
186
|
+
"count": "1",
|
187
|
+
"id": "Mobile"
|
188
|
+
}
|
189
|
+
],
|
190
|
+
"platforms": [
|
191
|
+
{
|
192
|
+
"count": "7",
|
193
|
+
"id": "Macintosh"
|
194
|
+
},
|
195
|
+
{
|
196
|
+
"count": "7",
|
197
|
+
"id": "Windows"
|
198
|
+
},
|
199
|
+
{
|
200
|
+
"count": "2",
|
201
|
+
"id": "Linux"
|
202
|
+
},
|
203
|
+
{
|
204
|
+
"count": "2",
|
205
|
+
"id": "Other Unix"
|
206
|
+
},
|
207
|
+
{
|
208
|
+
"count": "1",
|
209
|
+
"id": "iPhone"
|
210
|
+
}
|
211
|
+
]
|
212
|
+
},
|
213
|
+
"day": {
|
214
|
+
"shortUrlClicks": "19",
|
215
|
+
"longUrlClicks": "19",
|
216
|
+
"referrers": [
|
217
|
+
{
|
218
|
+
"count": "16",
|
219
|
+
"id": "Unknown/empty"
|
220
|
+
},
|
221
|
+
{
|
222
|
+
"count": "3",
|
223
|
+
"id": "twitter.com"
|
224
|
+
}
|
225
|
+
],
|
226
|
+
"countries": [
|
227
|
+
{
|
228
|
+
"count": "18",
|
229
|
+
"id": "BR"
|
230
|
+
},
|
231
|
+
{
|
232
|
+
"count": "1",
|
233
|
+
"id": "NO"
|
234
|
+
}
|
235
|
+
],
|
236
|
+
"browsers": [
|
237
|
+
{
|
238
|
+
"count": "11",
|
239
|
+
"id": "Chrome"
|
240
|
+
},
|
241
|
+
{
|
242
|
+
"count": "5",
|
243
|
+
"id": "Firefox"
|
244
|
+
},
|
245
|
+
{
|
246
|
+
"count": "2",
|
247
|
+
"id": "Safari"
|
248
|
+
},
|
249
|
+
{
|
250
|
+
"count": "1",
|
251
|
+
"id": "Mobile"
|
252
|
+
}
|
253
|
+
],
|
254
|
+
"platforms": [
|
255
|
+
{
|
256
|
+
"count": "7",
|
257
|
+
"id": "Macintosh"
|
258
|
+
},
|
259
|
+
{
|
260
|
+
"count": "7",
|
261
|
+
"id": "Windows"
|
262
|
+
},
|
263
|
+
{
|
264
|
+
"count": "2",
|
265
|
+
"id": "Linux"
|
266
|
+
},
|
267
|
+
{
|
268
|
+
"count": "2",
|
269
|
+
"id": "Other Unix"
|
270
|
+
},
|
271
|
+
{
|
272
|
+
"count": "1",
|
273
|
+
"id": "iPhone"
|
274
|
+
}
|
275
|
+
]
|
276
|
+
},
|
277
|
+
"twoHours": {
|
278
|
+
"shortUrlClicks": "0",
|
279
|
+
"longUrlClicks": "0"
|
280
|
+
}
|
281
|
+
}
|
282
|
+
}
|
@@ -0,0 +1,268 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
ETag: "EEZ1AD443JkEgW3KJFaymzTd26A/PcG5hEUcxQRgLBwN0edzypLtI10"
|
3
|
+
Expires: Thu, 13 Jan 2011 22:35:53 GMT
|
4
|
+
Date: Thu, 13 Jan 2011 22:35:53 GMT
|
5
|
+
Cache-Control: public, max-age=0, must-revalidate, no-transform
|
6
|
+
Content-Type: application/json; charset=UTF-8
|
7
|
+
X-Content-Type-Options: nosniff
|
8
|
+
X-Frame-Options: SAMEORIGIN
|
9
|
+
X-XSS-Protection: 1; mode=block
|
10
|
+
Server: GSE
|
11
|
+
Transfer-Encoding: chunked
|
12
|
+
|
13
|
+
{
|
14
|
+
"kind": "urlshortener#url",
|
15
|
+
"id": "http://goo.gl/DWDfi",
|
16
|
+
"longUrl": "https://github.com/zigotto/googl",
|
17
|
+
"status": "OK",
|
18
|
+
"analytics": {
|
19
|
+
"allTime": {
|
20
|
+
"referrers": [
|
21
|
+
{
|
22
|
+
"count": "16",
|
23
|
+
"id": "Unknown/empty"
|
24
|
+
},
|
25
|
+
{
|
26
|
+
"count": "3",
|
27
|
+
"id": "twitter.com"
|
28
|
+
}
|
29
|
+
],
|
30
|
+
"countries": [
|
31
|
+
{
|
32
|
+
"count": "18",
|
33
|
+
"id": "BR"
|
34
|
+
},
|
35
|
+
{
|
36
|
+
"count": "1",
|
37
|
+
"id": "NO"
|
38
|
+
}
|
39
|
+
],
|
40
|
+
"browsers": [
|
41
|
+
{
|
42
|
+
"count": "11",
|
43
|
+
"id": "Chrome"
|
44
|
+
},
|
45
|
+
{
|
46
|
+
"count": "5",
|
47
|
+
"id": "Firefox"
|
48
|
+
},
|
49
|
+
{
|
50
|
+
"count": "2",
|
51
|
+
"id": "Safari"
|
52
|
+
},
|
53
|
+
{
|
54
|
+
"count": "1",
|
55
|
+
"id": "Mobile"
|
56
|
+
}
|
57
|
+
],
|
58
|
+
"platforms": [
|
59
|
+
{
|
60
|
+
"count": "7",
|
61
|
+
"id": "Macintosh"
|
62
|
+
},
|
63
|
+
{
|
64
|
+
"count": "7",
|
65
|
+
"id": "Windows"
|
66
|
+
},
|
67
|
+
{
|
68
|
+
"count": "2",
|
69
|
+
"id": "Linux"
|
70
|
+
},
|
71
|
+
{
|
72
|
+
"count": "2",
|
73
|
+
"id": "Other Unix"
|
74
|
+
},
|
75
|
+
{
|
76
|
+
"count": "1",
|
77
|
+
"id": "iPhone"
|
78
|
+
}
|
79
|
+
]
|
80
|
+
},
|
81
|
+
"month": {
|
82
|
+
"referrers": [
|
83
|
+
{
|
84
|
+
"count": "16",
|
85
|
+
"id": "Unknown/empty"
|
86
|
+
},
|
87
|
+
{
|
88
|
+
"count": "3",
|
89
|
+
"id": "twitter.com"
|
90
|
+
}
|
91
|
+
],
|
92
|
+
"countries": [
|
93
|
+
{
|
94
|
+
"count": "18",
|
95
|
+
"id": "BR"
|
96
|
+
},
|
97
|
+
{
|
98
|
+
"count": "1",
|
99
|
+
"id": "NO"
|
100
|
+
}
|
101
|
+
],
|
102
|
+
"browsers": [
|
103
|
+
{
|
104
|
+
"count": "11",
|
105
|
+
"id": "Chrome"
|
106
|
+
},
|
107
|
+
{
|
108
|
+
"count": "5",
|
109
|
+
"id": "Firefox"
|
110
|
+
},
|
111
|
+
{
|
112
|
+
"count": "2",
|
113
|
+
"id": "Safari"
|
114
|
+
},
|
115
|
+
{
|
116
|
+
"count": "1",
|
117
|
+
"id": "Mobile"
|
118
|
+
}
|
119
|
+
],
|
120
|
+
"platforms": [
|
121
|
+
{
|
122
|
+
"count": "7",
|
123
|
+
"id": "Macintosh"
|
124
|
+
},
|
125
|
+
{
|
126
|
+
"count": "7",
|
127
|
+
"id": "Windows"
|
128
|
+
},
|
129
|
+
{
|
130
|
+
"count": "2",
|
131
|
+
"id": "Linux"
|
132
|
+
},
|
133
|
+
{
|
134
|
+
"count": "2",
|
135
|
+
"id": "Other Unix"
|
136
|
+
},
|
137
|
+
{
|
138
|
+
"count": "1",
|
139
|
+
"id": "iPhone"
|
140
|
+
}
|
141
|
+
]
|
142
|
+
},
|
143
|
+
"week": {
|
144
|
+
"referrers": [
|
145
|
+
{
|
146
|
+
"count": "16",
|
147
|
+
"id": "Unknown/empty"
|
148
|
+
},
|
149
|
+
{
|
150
|
+
"count": "3",
|
151
|
+
"id": "twitter.com"
|
152
|
+
}
|
153
|
+
],
|
154
|
+
"countries": [
|
155
|
+
{
|
156
|
+
"count": "18",
|
157
|
+
"id": "BR"
|
158
|
+
},
|
159
|
+
{
|
160
|
+
"count": "1",
|
161
|
+
"id": "NO"
|
162
|
+
}
|
163
|
+
],
|
164
|
+
"browsers": [
|
165
|
+
{
|
166
|
+
"count": "11",
|
167
|
+
"id": "Chrome"
|
168
|
+
},
|
169
|
+
{
|
170
|
+
"count": "5",
|
171
|
+
"id": "Firefox"
|
172
|
+
},
|
173
|
+
{
|
174
|
+
"count": "2",
|
175
|
+
"id": "Safari"
|
176
|
+
},
|
177
|
+
{
|
178
|
+
"count": "1",
|
179
|
+
"id": "Mobile"
|
180
|
+
}
|
181
|
+
],
|
182
|
+
"platforms": [
|
183
|
+
{
|
184
|
+
"count": "7",
|
185
|
+
"id": "Macintosh"
|
186
|
+
},
|
187
|
+
{
|
188
|
+
"count": "7",
|
189
|
+
"id": "Windows"
|
190
|
+
},
|
191
|
+
{
|
192
|
+
"count": "2",
|
193
|
+
"id": "Linux"
|
194
|
+
},
|
195
|
+
{
|
196
|
+
"count": "2",
|
197
|
+
"id": "Other Unix"
|
198
|
+
},
|
199
|
+
{
|
200
|
+
"count": "1",
|
201
|
+
"id": "iPhone"
|
202
|
+
}
|
203
|
+
]
|
204
|
+
},
|
205
|
+
"day": {
|
206
|
+
"referrers": [
|
207
|
+
{
|
208
|
+
"count": "16",
|
209
|
+
"id": "Unknown/empty"
|
210
|
+
},
|
211
|
+
{
|
212
|
+
"count": "3",
|
213
|
+
"id": "twitter.com"
|
214
|
+
}
|
215
|
+
],
|
216
|
+
"countries": [
|
217
|
+
{
|
218
|
+
"count": "18",
|
219
|
+
"id": "BR"
|
220
|
+
},
|
221
|
+
{
|
222
|
+
"count": "1",
|
223
|
+
"id": "NO"
|
224
|
+
}
|
225
|
+
],
|
226
|
+
"browsers": [
|
227
|
+
{
|
228
|
+
"count": "11",
|
229
|
+
"id": "Chrome"
|
230
|
+
},
|
231
|
+
{
|
232
|
+
"count": "5",
|
233
|
+
"id": "Firefox"
|
234
|
+
},
|
235
|
+
{
|
236
|
+
"count": "2",
|
237
|
+
"id": "Safari"
|
238
|
+
},
|
239
|
+
{
|
240
|
+
"count": "1",
|
241
|
+
"id": "Mobile"
|
242
|
+
}
|
243
|
+
],
|
244
|
+
"platforms": [
|
245
|
+
{
|
246
|
+
"count": "7",
|
247
|
+
"id": "Macintosh"
|
248
|
+
},
|
249
|
+
{
|
250
|
+
"count": "7",
|
251
|
+
"id": "Windows"
|
252
|
+
},
|
253
|
+
{
|
254
|
+
"count": "2",
|
255
|
+
"id": "Linux"
|
256
|
+
},
|
257
|
+
{
|
258
|
+
"count": "2",
|
259
|
+
"id": "Other Unix"
|
260
|
+
},
|
261
|
+
{
|
262
|
+
"count": "1",
|
263
|
+
"id": "iPhone"
|
264
|
+
}
|
265
|
+
]
|
266
|
+
}
|
267
|
+
}
|
268
|
+
}
|