ruby-oembed 0.14.0 → 0.16.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +5 -2
  3. data/CHANGELOG.rdoc +25 -2
  4. data/README.md +5 -7
  5. data/lib/oembed/provider.rb +54 -5
  6. data/lib/oembed/providers/builtin_providers.rb +292 -0
  7. data/lib/oembed/providers/facebook_post.rb +27 -17
  8. data/lib/oembed/providers/facebook_video.rb +22 -10
  9. data/lib/oembed/providers/instagram.rb +37 -20
  10. data/lib/oembed/providers/tiktok.rb +13 -0
  11. data/lib/oembed/providers.rb +39 -300
  12. data/lib/oembed/version.rb +2 -2
  13. data/lib/oembed.rb +1 -0
  14. data/ruby-oembed.gemspec +1 -2
  15. metadata +9 -53
  16. data/integration_test/test.rb +0 -31
  17. data/integration_test/test_urls.csv +0 -502
  18. data/spec/cassettes/OEmbed_Provider.yml +0 -987
  19. data/spec/cassettes/OEmbed_ProviderDiscovery.yml +0 -27184
  20. data/spec/cassettes/OEmbed_Providers_Slideshare.yml +0 -1433
  21. data/spec/cassettes/OEmbed_Providers_Twitter.yml +0 -612
  22. data/spec/formatter/ducktype_backend_spec.rb +0 -94
  23. data/spec/formatter/json/.DS_Store +0 -0
  24. data/spec/formatter/json/jsongem_backend_spec.rb +0 -71
  25. data/spec/formatter/json/yaml_backend_spec.rb +0 -55
  26. data/spec/formatter/xml/nokogiri_backend_spec.rb +0 -59
  27. data/spec/formatter/xml/rexml_backend_spec.rb +0 -55
  28. data/spec/formatter/xml/xmlsimple_backend_spec.rb +0 -59
  29. data/spec/formatter_spec.rb +0 -37
  30. data/spec/provider_discovery_spec.rb +0 -141
  31. data/spec/provider_spec.rb +0 -366
  32. data/spec/providers/facebook_spec.rb +0 -50
  33. data/spec/providers/slideshare_spec.rb +0 -42
  34. data/spec/providers/twitter_spec.rb +0 -44
  35. data/spec/providers_spec.rb +0 -306
  36. data/spec/response_spec.rb +0 -230
  37. data/spec/spec_helper.rb +0 -111
  38. data/spec/spec_helper_examples.yml +0 -27
  39. data/spec/support/shared_examples_for_providers.rb +0 -39
@@ -1,612 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://api.twitter.com/1/statuses/oembed.json?url=https%3A%2F%2Ftwitter.com%2FRailsGirlsSoC%2Fstatus%2F702136612822634496
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- Accept-Encoding:
11
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
- User-Agent:
13
- - Mozilla/5.0 (compatible; ruby-oembed/0.10.0)
14
- response:
15
- status:
16
- code: 200
17
- message: OK
18
- headers:
19
- Cache-Control:
20
- - must-revalidate, max-age=3153600000
21
- Content-Disposition:
22
- - attachment; filename=json.json
23
- Content-Length:
24
- - '511'
25
- Content-Type:
26
- - application/json; charset=utf-8
27
- Date:
28
- - Sun, 22 May 2016 04:42:50 GMT
29
- Expires:
30
- - Tue, 28 Apr 2116 04:42:50 GMT
31
- Last-Modified:
32
- - Sun, 22 May 2016 04:42:50 GMT
33
- Server:
34
- - tsa_a
35
- Set-Cookie:
36
- - guest_id=v1%3A146389217092127692; Domain=.twitter.com; Path=/; Expires=Tue,
37
- 22-May-2018 04:42:50 UTC
38
- Strict-Transport-Security:
39
- - max-age=631138519
40
- X-Connection-Hash:
41
- - 94a2de9aaa8f85b2411f08f3a47cd023
42
- X-Content-Type-Options:
43
- - nosniff
44
- X-Frame-Options:
45
- - SAMEORIGIN
46
- X-Response-Time:
47
- - '16'
48
- X-Xss-Protection:
49
- - 1; mode=block
50
- body:
51
- encoding: ASCII-8BIT
52
- string: !binary |-
53
- eyJ1cmwiOiJodHRwczpcL1wvdHdpdHRlci5jb21cL1JhaWxzR2lybHNTb0NcL3N0YXR1c1wvNzAyMTM2NjEyODIyNjM0NDk2IiwiYXV0aG9yX25hbWUiOiJSYWlscyBHaXJscyBTb0MiLCJhdXRob3JfdXJsIjoiaHR0cHM6XC9cL3R3aXR0ZXIuY29tXC9SYWlsc0dpcmxzU29DIiwiaHRtbCI6Ilx1MDAzQ2Jsb2NrcXVvdGUgY2xhc3M9XCJ0d2l0dGVyLXR3ZWV0XCJcdTAwM0VcdTAwM0NwIGxhbmc9XCJlblwiIGRpcj1cImx0clwiXHUwMDNFT3VyIDIwMTYgZnVuZHJhaXNpbmcgY2FtcGFpZ24gaXMgbm93IG9wZW4hISBMZXTigJlzIG1ha2UgYW5vdGhlciBhbWF6aW5nIHN1bW1lciBoYXBwZW4h4pyoXHVEODNEXHVEQzlDXHVEODNEXHVEQ0FBXHVEODNEXHVEQzlB4pyoXHVEODNEXHVEQzQ5IFx1MDAzQ2EgaHJlZj1cImh0dHBzOlwvXC90LmNvXC9SOEpnMzZ4YVF4XCJcdTAwM0VodHRwczpcL1wvdC5jb1wvUjhKZzM2eGFReFx1MDAzQ1wvYVx1MDAzRSBcdTAwM0NhIGhyZWY9XCJodHRwczpcL1wvdC5jb1wvbUl3S1IwZnpHUlwiXHUwMDNFcGljLnR3aXR0ZXIuY29tXC9tSXdLUjBmekdSXHUwMDNDXC9hXHUwMDNFXHUwMDNDXC9wXHUwMDNFJm1kYXNoOyBSYWlscyBHaXJscyBTb0MgKEBSYWlsc0dpcmxzU29DKSBcdTAwM0NhIGhyZWY9XCJodHRwczpcL1wvdHdpdHRlci5jb21cL1JhaWxzR2lybHNTb0NcL3N0YXR1c1wvNzAyMTM2NjEyODIyNjM0NDk2XCJcdTAwM0VGZWJydWFyeSAyMywgMjAxNlx1MDAzQ1wvYVx1MDAzRVx1MDAzQ1wvYmxvY2txdW90ZVx1MDAzRVxuXHUwMDNDc2NyaXB0IGFzeW5jIHNyYz1cIlwvXC9wbGF0Zm9ybS50d2l0dGVyLmNvbVwvd2lkZ2V0cy5qc1wiIGNoYXJzZXQ9XCJ1dGYtOFwiXHUwMDNFXHUwMDNDXC9zY3JpcHRcdTAwM0UiLCJ3aWR0aCI6NTUwLCJ0eXBlIjoicmljaCIsImNhY2hlX2FnZSI6IjMxNTM2MDAwMDAiLCJwcm92aWRlcl9uYW1lIjoiVHdpdHRlciIsInByb3ZpZGVyX3VybCI6Imh0dHBzOlwvXC90d2l0dGVyLmNvbSIsImhlaWdodCI6bnVsbCwidmVyc2lvbiI6IjEuMCJ9
54
- http_version: '1.1'
55
- recorded_at: Sat, 28 Mar 2020 02:32:33 GMT
56
- - request:
57
- method: get
58
- uri: https://api.twitter.com/1/statuses/oembed.json?url=https%3A%2F%2Fwww.twitter.com%2Fbpoweski%2Fstatus%2F71633762
59
- body:
60
- encoding: US-ASCII
61
- string: ''
62
- headers:
63
- Accept-Encoding:
64
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
65
- User-Agent:
66
- - Mozilla/5.0 (compatible; ruby-oembed/0.10.0)
67
- response:
68
- status:
69
- code: 200
70
- message: OK
71
- headers:
72
- Cache-Control:
73
- - must-revalidate, max-age=3153600000
74
- Content-Disposition:
75
- - attachment; filename=json.json
76
- Content-Length:
77
- - '377'
78
- Content-Type:
79
- - application/json; charset=utf-8
80
- Date:
81
- - Sun, 22 May 2016 04:42:51 GMT
82
- Expires:
83
- - Tue, 28 Apr 2116 04:42:51 GMT
84
- Last-Modified:
85
- - Sun, 22 May 2016 04:42:51 GMT
86
- Server:
87
- - tsa_a
88
- Set-Cookie:
89
- - guest_id=v1%3A146389217180318801; Domain=.twitter.com; Path=/; Expires=Tue,
90
- 22-May-2018 04:42:51 UTC
91
- Strict-Transport-Security:
92
- - max-age=631138519
93
- X-Connection-Hash:
94
- - 7a694516718ce415b38581035d0967e0
95
- X-Content-Type-Options:
96
- - nosniff
97
- X-Frame-Options:
98
- - SAMEORIGIN
99
- X-Response-Time:
100
- - '15'
101
- X-Xss-Protection:
102
- - 1; mode=block
103
- body:
104
- encoding: UTF-8
105
- string: '{"url":"https:\/\/twitter.com\/bpoweski\/status\/71633762","author_name":"Ben
106
- Poweski","author_url":"https:\/\/twitter.com\/bpoweski","html":"\u003Cblockquote
107
- class=\"twitter-tweet\"\u003E\u003Cp lang=\"en\" dir=\"ltr\"\u003Eworking
108
- on my Ruby Security book\u003C\/p\u003E— Ben Poweski (@bpoweski) \u003Ca
109
- href=\"https:\/\/twitter.com\/bpoweski\/status\/71633762\"\u003EMay 20, 2007\u003C\/a\u003E\u003C\/blockquote\u003E\n\u003Cscript
110
- async src=\"\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"\u003E\u003C\/script\u003E","width":550,"type":"rich","cache_age":"3153600000","provider_name":"Twitter","provider_url":"https:\/\/twitter.com","height":null,"version":"1.0"}'
111
- http_version: '1.1'
112
- recorded_at: Sat, 28 Mar 2020 02:32:33 GMT
113
- - request:
114
- method: get
115
- uri: https://api.twitter.com/1/statuses/oembed.xml?url=https%3A%2F%2Ftwitter.com%2FRailsGirlsSoC%2Fstatus%2F702136612822634496
116
- body:
117
- encoding: US-ASCII
118
- string: ''
119
- headers:
120
- Accept-Encoding:
121
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
122
- User-Agent:
123
- - Mozilla/5.0 (compatible; ruby-oembed/0.10.0)
124
- response:
125
- status:
126
- code: 410
127
- message: Gone
128
- headers:
129
- Content-Length:
130
- - '181'
131
- Content-Type:
132
- - application/xml;charset=utf-8
133
- Date:
134
- - Sun, 22 May 2016 04:47:50 GMT
135
- Server:
136
- - tsa_a
137
- Set-Cookie:
138
- - guest_id=v1%3A146389247047875048; Domain=.twitter.com; Path=/; Expires=Tue,
139
- 22-May-2018 04:47:50 UTC
140
- Strict-Transport-Security:
141
- - max-age=631138519
142
- X-Connection-Hash:
143
- - 4362d0593f7be75dc40b9a6f51ada770
144
- X-Response-Time:
145
- - '2'
146
- body:
147
- encoding: UTF-8
148
- string: <?xml version="1.0" encoding="UTF-8"?><errors> <error code="64">The
149
- Twitter REST API v1 is no longer active. Please migrate to API v1.1. https://dev.twitter.com/docs/api/1.1/overview.</error></errors>
150
- http_version: '1.1'
151
- recorded_at: Sat, 28 Mar 2020 02:32:33 GMT
152
- - request:
153
- method: get
154
- uri: https://api.twitter.com/1/statuses/oembed.xml?url=https%3A%2F%2Fwww.twitter.com%2Fbpoweski%2Fstatus%2F71633762
155
- body:
156
- encoding: US-ASCII
157
- string: ''
158
- headers:
159
- Accept-Encoding:
160
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
161
- User-Agent:
162
- - Mozilla/5.0 (compatible; ruby-oembed/0.10.0)
163
- response:
164
- status:
165
- code: 410
166
- message: Gone
167
- headers:
168
- Content-Length:
169
- - '181'
170
- Content-Type:
171
- - application/xml;charset=utf-8
172
- Date:
173
- - Sun, 22 May 2016 04:47:50 GMT
174
- Server:
175
- - tsa_a
176
- Set-Cookie:
177
- - guest_id=v1%3A146389247091551370; Domain=.twitter.com; Path=/; Expires=Tue,
178
- 22-May-2018 04:47:50 UTC
179
- Strict-Transport-Security:
180
- - max-age=631138519
181
- X-Connection-Hash:
182
- - 0ad11ae6624c326369f0b9f878dd4faa
183
- X-Response-Time:
184
- - '3'
185
- body:
186
- encoding: UTF-8
187
- string: <?xml version="1.0" encoding="UTF-8"?><errors> <error code="64">The
188
- Twitter REST API v1 is no longer active. Please migrate to API v1.1. https://dev.twitter.com/docs/api/1.1/overview.</error></errors>
189
- http_version: '1.1'
190
- recorded_at: Sat, 28 Mar 2020 02:32:33 GMT
191
- - request:
192
- method: get
193
- uri: https://publish.twitter.com/oembed?url=https%3A%2F%2Ftwitter.com%2FRailsGirlsSoC%2Fstatus%2F702136612822634496&format=json
194
- body:
195
- encoding: US-ASCII
196
- string: ''
197
- headers:
198
- Accept-Encoding:
199
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
200
- User-Agent:
201
- - Mozilla/5.0 (compatible; ruby-oembed/0.10.0)
202
- response:
203
- status:
204
- code: 200
205
- message: OK
206
- headers:
207
- Cache-Control:
208
- - must-revalidate, max-age=3153600000
209
- Content-Disposition:
210
- - attachment; filename=json.json
211
- Content-Length:
212
- - '511'
213
- Content-Type:
214
- - application/json; charset=utf-8
215
- Date:
216
- - Sun, 22 May 2016 05:28:56 GMT
217
- Expires:
218
- - Tue, 28 Apr 2116 05:28:56 GMT
219
- Last-Modified:
220
- - Sun, 22 May 2016 05:28:56 GMT
221
- Server:
222
- - tsa_a
223
- Set-Cookie:
224
- - guest_id=v1%3A146389493674598630; Domain=.twitter.com; Path=/; Expires=Tue,
225
- 22-May-2018 05:28:56 UTC
226
- Strict-Transport-Security:
227
- - max-age=631138519
228
- X-Connection-Hash:
229
- - af69b197ce2eeb32bfa62ea1f1c8647e
230
- X-Content-Type-Options:
231
- - nosniff
232
- X-Frame-Options:
233
- - SAMEORIGIN
234
- X-Response-Time:
235
- - '35'
236
- X-Xss-Protection:
237
- - 1; mode=block
238
- body:
239
- encoding: ASCII-8BIT
240
- string: !binary |-
241
- eyJ1cmwiOiJodHRwczpcL1wvdHdpdHRlci5jb21cL1JhaWxzR2lybHNTb0NcL3N0YXR1c1wvNzAyMTM2NjEyODIyNjM0NDk2IiwiYXV0aG9yX25hbWUiOiJSYWlscyBHaXJscyBTb0MiLCJhdXRob3JfdXJsIjoiaHR0cHM6XC9cL3R3aXR0ZXIuY29tXC9SYWlsc0dpcmxzU29DIiwiaHRtbCI6Ilx1MDAzQ2Jsb2NrcXVvdGUgY2xhc3M9XCJ0d2l0dGVyLXR3ZWV0XCJcdTAwM0VcdTAwM0NwIGxhbmc9XCJlblwiIGRpcj1cImx0clwiXHUwMDNFT3VyIDIwMTYgZnVuZHJhaXNpbmcgY2FtcGFpZ24gaXMgbm93IG9wZW4hISBMZXTigJlzIG1ha2UgYW5vdGhlciBhbWF6aW5nIHN1bW1lciBoYXBwZW4h4pyoXHVEODNEXHVEQzlDXHVEODNEXHVEQ0FBXHVEODNEXHVEQzlB4pyoXHVEODNEXHVEQzQ5IFx1MDAzQ2EgaHJlZj1cImh0dHBzOlwvXC90LmNvXC9SOEpnMzZ4YVF4XCJcdTAwM0VodHRwczpcL1wvdC5jb1wvUjhKZzM2eGFReFx1MDAzQ1wvYVx1MDAzRSBcdTAwM0NhIGhyZWY9XCJodHRwczpcL1wvdC5jb1wvbUl3S1IwZnpHUlwiXHUwMDNFcGljLnR3aXR0ZXIuY29tXC9tSXdLUjBmekdSXHUwMDNDXC9hXHUwMDNFXHUwMDNDXC9wXHUwMDNFJm1kYXNoOyBSYWlscyBHaXJscyBTb0MgKEBSYWlsc0dpcmxzU29DKSBcdTAwM0NhIGhyZWY9XCJodHRwczpcL1wvdHdpdHRlci5jb21cL1JhaWxzR2lybHNTb0NcL3N0YXR1c1wvNzAyMTM2NjEyODIyNjM0NDk2XCJcdTAwM0VGZWJydWFyeSAyMywgMjAxNlx1MDAzQ1wvYVx1MDAzRVx1MDAzQ1wvYmxvY2txdW90ZVx1MDAzRVxuXHUwMDNDc2NyaXB0IGFzeW5jIHNyYz1cIlwvXC9wbGF0Zm9ybS50d2l0dGVyLmNvbVwvd2lkZ2V0cy5qc1wiIGNoYXJzZXQ9XCJ1dGYtOFwiXHUwMDNFXHUwMDNDXC9zY3JpcHRcdTAwM0UiLCJ3aWR0aCI6NTUwLCJ0eXBlIjoicmljaCIsImNhY2hlX2FnZSI6IjMxNTM2MDAwMDAiLCJwcm92aWRlcl9uYW1lIjoiVHdpdHRlciIsInByb3ZpZGVyX3VybCI6Imh0dHBzOlwvXC90d2l0dGVyLmNvbSIsImhlaWdodCI6bnVsbCwidmVyc2lvbiI6IjEuMCJ9
242
- http_version: '1.1'
243
- recorded_at: Sat, 28 Mar 2020 02:32:33 GMT
244
- - request:
245
- method: get
246
- uri: https://publish.twitter.com/oembed?url=https%3A%2F%2Fwww.twitter.com%2Fbpoweski%2Fstatus%2F71633762&format=json
247
- body:
248
- encoding: US-ASCII
249
- string: ''
250
- headers:
251
- Accept-Encoding:
252
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
253
- User-Agent:
254
- - Mozilla/5.0 (compatible; ruby-oembed/0.10.0)
255
- response:
256
- status:
257
- code: 200
258
- message: OK
259
- headers:
260
- Cache-Control:
261
- - must-revalidate, max-age=3153600000
262
- Content-Disposition:
263
- - attachment; filename=json.json
264
- Content-Length:
265
- - '377'
266
- Content-Type:
267
- - application/json; charset=utf-8
268
- Date:
269
- - Sun, 22 May 2016 05:28:58 GMT
270
- Expires:
271
- - Tue, 28 Apr 2116 05:28:58 GMT
272
- Last-Modified:
273
- - Sun, 22 May 2016 05:28:58 GMT
274
- Server:
275
- - tsa_a
276
- Set-Cookie:
277
- - guest_id=v1%3A146389493840609737; Domain=.twitter.com; Path=/; Expires=Tue,
278
- 22-May-2018 05:28:58 UTC
279
- Strict-Transport-Security:
280
- - max-age=631138519
281
- X-Connection-Hash:
282
- - 753e3b3ca5ace007543400fc1a736700
283
- X-Content-Type-Options:
284
- - nosniff
285
- X-Frame-Options:
286
- - SAMEORIGIN
287
- X-Response-Time:
288
- - '15'
289
- X-Xss-Protection:
290
- - 1; mode=block
291
- body:
292
- encoding: UTF-8
293
- string: '{"url":"https:\/\/twitter.com\/bpoweski\/status\/71633762","author_name":"Ben
294
- Poweski","author_url":"https:\/\/twitter.com\/bpoweski","html":"\u003Cblockquote
295
- class=\"twitter-tweet\"\u003E\u003Cp lang=\"en\" dir=\"ltr\"\u003Eworking
296
- on my Ruby Security book\u003C\/p\u003E&mdash; Ben Poweski (@bpoweski) \u003Ca
297
- href=\"https:\/\/twitter.com\/bpoweski\/status\/71633762\"\u003EMay 20, 2007\u003C\/a\u003E\u003C\/blockquote\u003E\n\u003Cscript
298
- async src=\"\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"\u003E\u003C\/script\u003E","width":550,"type":"rich","cache_age":"3153600000","provider_name":"Twitter","provider_url":"https:\/\/twitter.com","height":null,"version":"1.0"}'
299
- http_version: '1.1'
300
- recorded_at: Sat, 28 Mar 2020 02:32:33 GMT
301
- - request:
302
- method: get
303
- uri: https://publish.twitter.com/oembed?url=https%3A%2F%2Ftwitter.com%2FRailsGirlsSoC%2Fstatus%2F702136612822634496&format=xml
304
- body:
305
- encoding: US-ASCII
306
- string: ''
307
- headers:
308
- Accept-Encoding:
309
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
310
- User-Agent:
311
- - Mozilla/5.0 (compatible; ruby-oembed/0.10.0)
312
- response:
313
- status:
314
- code: 400
315
- message: Bad Request
316
- headers:
317
- Content-Disposition:
318
- - attachment; filename=json.json
319
- Content-Length:
320
- - '60'
321
- Content-Type:
322
- - application/json; charset=utf-8
323
- Date:
324
- - Sun, 22 May 2016 05:28:58 GMT
325
- Server:
326
- - tsa_a
327
- Set-Cookie:
328
- - guest_id=v1%3A146389493885489875; Domain=.twitter.com; Path=/; Expires=Tue,
329
- 22-May-2018 05:28:58 UTC
330
- Strict-Transport-Security:
331
- - max-age=631138519
332
- X-Connection-Hash:
333
- - a457da9c9aa85d3abd203831bbbb83d3
334
- X-Content-Type-Options:
335
- - nosniff
336
- X-Frame-Options:
337
- - SAMEORIGIN
338
- X-Response-Time:
339
- - '7'
340
- X-Xss-Protection:
341
- - 1; mode=block
342
- body:
343
- encoding: UTF-8
344
- string: '{"errors":["xml not implemented"]}'
345
- http_version: '1.1'
346
- recorded_at: Sat, 28 Mar 2020 02:32:33 GMT
347
- - request:
348
- method: get
349
- uri: https://publish.twitter.com/oembed?url=https%3A%2F%2Fwww.twitter.com%2Fbpoweski%2Fstatus%2F71633762&format=xml
350
- body:
351
- encoding: US-ASCII
352
- string: ''
353
- headers:
354
- Accept-Encoding:
355
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
356
- User-Agent:
357
- - Mozilla/5.0 (compatible; ruby-oembed/0.10.0)
358
- response:
359
- status:
360
- code: 400
361
- message: Bad Request
362
- headers:
363
- Content-Disposition:
364
- - attachment; filename=json.json
365
- Content-Length:
366
- - '60'
367
- Content-Type:
368
- - application/json; charset=utf-8
369
- Date:
370
- - Sun, 22 May 2016 05:28:59 GMT
371
- Server:
372
- - tsa_a
373
- Set-Cookie:
374
- - guest_id=v1%3A146389493910837135; Domain=.twitter.com; Path=/; Expires=Tue,
375
- 22-May-2018 05:28:59 UTC
376
- Strict-Transport-Security:
377
- - max-age=631138519
378
- X-Connection-Hash:
379
- - 3543953c1c553fbcf1c441417b26f66d
380
- X-Content-Type-Options:
381
- - nosniff
382
- X-Frame-Options:
383
- - SAMEORIGIN
384
- X-Response-Time:
385
- - '6'
386
- X-Xss-Protection:
387
- - 1; mode=block
388
- body:
389
- encoding: UTF-8
390
- string: '{"errors":["xml not implemented"]}'
391
- http_version: '1.1'
392
- recorded_at: Sat, 28 Mar 2020 02:32:33 GMT
393
- - request:
394
- method: get
395
- uri: https://publish.twitter.com/oembed?format=json&url=https://twitter.com/RailsGirlsSoC/status/702136612822634496
396
- body:
397
- encoding: US-ASCII
398
- string: ''
399
- headers:
400
- Accept-Encoding:
401
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
402
- Accept:
403
- - "*/*"
404
- User-Agent:
405
- - Mozilla/5.0 (compatible; ruby-oembed/0.12.0)
406
- response:
407
- status:
408
- code: 200
409
- message: OK
410
- headers:
411
- Cache-Control:
412
- - must-revalidate, max-age=3153600000
413
- Content-Disposition:
414
- - attachment; filename=json.json
415
- Content-Length:
416
- - '534'
417
- Content-Type:
418
- - application/json; charset=utf-8
419
- Date:
420
- - Sat, 28 Mar 2020 02:57:13 GMT
421
- Expires:
422
- - Mon, 04 Mar 2120 02:57:13 GMT
423
- Last-Modified:
424
- - Sat, 28 Mar 2020 02:57:13 GMT
425
- Server:
426
- - tsa_b
427
- Set-Cookie:
428
- - guest_id=v1%3A158536423309272551; Max-Age=63072000; Expires=Mon, 28 Mar 2022
429
- 02:57:13 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
430
- - personalization_id="v1_KiUPAkKw0EcXtxGVGK/V+g=="; Max-Age=63072000; Expires=Mon,
431
- 28 Mar 2022 02:57:13 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
432
- Strict-Transport-Security:
433
- - max-age=631138519
434
- X-Connection-Hash:
435
- - 59bf8165569d5ff7d12803bcf8cb4a3d
436
- X-Content-Type-Options:
437
- - nosniff
438
- X-Frame-Options:
439
- - SAMEORIGIN
440
- X-Response-Time:
441
- - '13'
442
- X-Xss-Protection:
443
- - '0'
444
- body:
445
- encoding: ASCII-8BIT
446
- string: !binary |-
447
- eyJ1cmwiOiJodHRwczpcL1wvdHdpdHRlci5jb21cL1JhaWxzR2lybHNTb0NcL3N0YXR1c1wvNzAyMTM2NjEyODIyNjM0NDk2IiwiYXV0aG9yX25hbWUiOiJSYWlscyBHaXJscyBTdW1tZXIgb2YgQ29kZSIsImF1dGhvcl91cmwiOiJodHRwczpcL1wvdHdpdHRlci5jb21cL1JhaWxzR2lybHNTb0MiLCJodG1sIjoiXHUwMDNDYmxvY2txdW90ZSBjbGFzcz1cInR3aXR0ZXItdHdlZXRcIlx1MDAzRVx1MDAzQ3AgbGFuZz1cImVuXCIgZGlyPVwibHRyXCJcdTAwM0VPdXIgMjAxNiBmdW5kcmFpc2luZyBjYW1wYWlnbiBpcyBub3cgb3BlbiEhIExldOKAmXMgbWFrZSBhbm90aGVyIGFtYXppbmcgc3VtbWVyIGhhcHBlbiHinKhcdUQ4M0RcdURDOUNcdUQ4M0RcdURDQUFcdUQ4M0RcdURDOUHinKhcdUQ4M0RcdURDNDkgXHUwMDNDYSBocmVmPVwiaHR0cHM6XC9cL3QuY29cL1I4SmczNnhhUXhcIlx1MDAzRWh0dHBzOlwvXC90LmNvXC9SOEpnMzZ4YVF4XHUwMDNDXC9hXHUwMDNFIFx1MDAzQ2EgaHJlZj1cImh0dHBzOlwvXC90LmNvXC9tSXdLUjBmekdSXCJcdTAwM0VwaWMudHdpdHRlci5jb21cL21Jd0tSMGZ6R1JcdTAwM0NcL2FcdTAwM0VcdTAwM0NcL3BcdTAwM0UmbWRhc2g7IFJhaWxzIEdpcmxzIFN1bW1lciBvZiBDb2RlIChAUmFpbHNHaXJsc1NvQykgXHUwMDNDYSBocmVmPVwiaHR0cHM6XC9cL3R3aXR0ZXIuY29tXC9SYWlsc0dpcmxzU29DXC9zdGF0dXNcLzcwMjEzNjYxMjgyMjYzNDQ5Nj9yZWZfc3JjPXR3c3JjJTVFdGZ3XCJcdTAwM0VGZWJydWFyeSAyMywgMjAxNlx1MDAzQ1wvYVx1MDAzRVx1MDAzQ1wvYmxvY2txdW90ZVx1MDAzRVxuXHUwMDNDc2NyaXB0IGFzeW5jIHNyYz1cImh0dHBzOlwvXC9wbGF0Zm9ybS50d2l0dGVyLmNvbVwvd2lkZ2V0cy5qc1wiIGNoYXJzZXQ9XCJ1dGYtOFwiXHUwMDNFXHUwMDNDXC9zY3JpcHRcdTAwM0VcbiIsIndpZHRoIjo1NTAsImhlaWdodCI6bnVsbCwidHlwZSI6InJpY2giLCJjYWNoZV9hZ2UiOiIzMTUzNjAwMDAwIiwicHJvdmlkZXJfbmFtZSI6IlR3aXR0ZXIiLCJwcm92aWRlcl91cmwiOiJodHRwczpcL1wvdHdpdHRlci5jb20iLCJ2ZXJzaW9uIjoiMS4wIn0=
448
- http_version: null
449
- recorded_at: Sat, 28 Mar 2020 02:57:13 GMT
450
- - request:
451
- method: get
452
- uri: https://publish.twitter.com/oembed?format=json&url=https://www.twitter.com/bpoweski/status/71633762
453
- body:
454
- encoding: US-ASCII
455
- string: ''
456
- headers:
457
- Accept-Encoding:
458
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
459
- Accept:
460
- - "*/*"
461
- User-Agent:
462
- - Mozilla/5.0 (compatible; ruby-oembed/0.12.0)
463
- response:
464
- status:
465
- code: 200
466
- message: OK
467
- headers:
468
- Cache-Control:
469
- - must-revalidate, max-age=3153600000
470
- Content-Disposition:
471
- - attachment; filename=json.json
472
- Content-Length:
473
- - '390'
474
- Content-Type:
475
- - application/json; charset=utf-8
476
- Date:
477
- - Sat, 28 Mar 2020 02:57:13 GMT
478
- Expires:
479
- - Mon, 04 Mar 2120 02:57:13 GMT
480
- Last-Modified:
481
- - Sat, 28 Mar 2020 02:57:13 GMT
482
- Server:
483
- - tsa_b
484
- Set-Cookie:
485
- - guest_id=v1%3A158536423333913733; Max-Age=63072000; Expires=Mon, 28 Mar 2022
486
- 02:57:13 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
487
- - personalization_id="v1_IZHXNs49gzXyq6HVztwoIA=="; Max-Age=63072000; Expires=Mon,
488
- 28 Mar 2022 02:57:13 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
489
- Strict-Transport-Security:
490
- - max-age=631138519
491
- X-Connection-Hash:
492
- - c8cde87a8443acca9f0c0d47bc2aca11
493
- X-Content-Type-Options:
494
- - nosniff
495
- X-Frame-Options:
496
- - SAMEORIGIN
497
- X-Response-Time:
498
- - '17'
499
- X-Xss-Protection:
500
- - '0'
501
- body:
502
- encoding: ASCII-8BIT
503
- string: '{"url":"https:\/\/twitter.com\/bpoweski\/status\/71633762","author_name":"Ben
504
- Poweski","author_url":"https:\/\/twitter.com\/bpoweski","html":"\u003Cblockquote
505
- class=\"twitter-tweet\"\u003E\u003Cp lang=\"en\" dir=\"ltr\"\u003Eworking
506
- on my Ruby Security book\u003C\/p\u003E&mdash; Ben Poweski (@bpoweski) \u003Ca
507
- href=\"https:\/\/twitter.com\/bpoweski\/status\/71633762?ref_src=twsrc%5Etfw\"\u003EMay
508
- 20, 2007\u003C\/a\u003E\u003C\/blockquote\u003E\n\u003Cscript async src=\"https:\/\/platform.twitter.com\/widgets.js\"
509
- charset=\"utf-8\"\u003E\u003C\/script\u003E\n","width":550,"height":null,"type":"rich","cache_age":"3153600000","provider_name":"Twitter","provider_url":"https:\/\/twitter.com","version":"1.0"}'
510
- http_version: null
511
- recorded_at: Sat, 28 Mar 2020 02:57:13 GMT
512
- - request:
513
- method: get
514
- uri: https://publish.twitter.com/oembed?format=xml&url=https://twitter.com/RailsGirlsSoC/status/702136612822634496
515
- body:
516
- encoding: US-ASCII
517
- string: ''
518
- headers:
519
- Accept-Encoding:
520
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
521
- Accept:
522
- - "*/*"
523
- User-Agent:
524
- - Mozilla/5.0 (compatible; ruby-oembed/0.12.0)
525
- response:
526
- status:
527
- code: 400
528
- message: Bad Request
529
- headers:
530
- Content-Disposition:
531
- - attachment; filename=json.json
532
- Content-Length:
533
- - '82'
534
- Content-Type:
535
- - application/json; charset=utf-8
536
- Date:
537
- - Sat, 28 Mar 2020 02:57:13 GMT
538
- Server:
539
- - tsa_b
540
- Set-Cookie:
541
- - guest_id=v1%3A158536423357150992; Max-Age=63072000; Expires=Mon, 28 Mar 2022
542
- 02:57:13 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
543
- - personalization_id="v1_1iBNx2XMQpbCzil5XE4fYA=="; Max-Age=63072000; Expires=Mon,
544
- 28 Mar 2022 02:57:13 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
545
- Strict-Transport-Security:
546
- - max-age=631138519
547
- X-Connection-Hash:
548
- - 8ebc794f0b8d456857bd216adbc36041
549
- X-Content-Type-Options:
550
- - nosniff
551
- X-Frame-Options:
552
- - SAMEORIGIN
553
- X-Response-Time:
554
- - '5'
555
- X-Xss-Protection:
556
- - '0'
557
- body:
558
- encoding: ASCII-8BIT
559
- string: '{"errors":[{"code":356,"message":"xml not implemented"}]}'
560
- http_version: null
561
- recorded_at: Sat, 28 Mar 2020 02:57:13 GMT
562
- - request:
563
- method: get
564
- uri: https://publish.twitter.com/oembed?format=xml&url=https://www.twitter.com/bpoweski/status/71633762
565
- body:
566
- encoding: US-ASCII
567
- string: ''
568
- headers:
569
- Accept-Encoding:
570
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
571
- Accept:
572
- - "*/*"
573
- User-Agent:
574
- - Mozilla/5.0 (compatible; ruby-oembed/0.12.0)
575
- response:
576
- status:
577
- code: 400
578
- message: Bad Request
579
- headers:
580
- Content-Disposition:
581
- - attachment; filename=json.json
582
- Content-Length:
583
- - '82'
584
- Content-Type:
585
- - application/json; charset=utf-8
586
- Date:
587
- - Sat, 28 Mar 2020 02:57:13 GMT
588
- Server:
589
- - tsa_b
590
- Set-Cookie:
591
- - guest_id=v1%3A158536423380340030; Max-Age=63072000; Expires=Mon, 28 Mar 2022
592
- 02:57:13 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
593
- - personalization_id="v1_2BcqqmIDYZ4fd9wqkZG0lg=="; Max-Age=63072000; Expires=Mon,
594
- 28 Mar 2022 02:57:13 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
595
- Strict-Transport-Security:
596
- - max-age=631138519
597
- X-Connection-Hash:
598
- - 7adc752de391db7dc78aaf4c394223fd
599
- X-Content-Type-Options:
600
- - nosniff
601
- X-Frame-Options:
602
- - SAMEORIGIN
603
- X-Response-Time:
604
- - '5'
605
- X-Xss-Protection:
606
- - '0'
607
- body:
608
- encoding: ASCII-8BIT
609
- string: '{"errors":[{"code":356,"message":"xml not implemented"}]}'
610
- http_version: null
611
- recorded_at: Sat, 28 Mar 2020 02:57:13 GMT
612
- recorded_with: VCR 5.1.0
@@ -1,94 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- class WorkingDuck
4
- # The WorkingDuck Class should work as a Backend
5
- class << self
6
- # Fakes a correct deocde response
7
- def decode(value)
8
- {"version"=>1.0, "string"=>"test", "int"=>42, "html"=>"<i>Cool's</i>\n the \"word\"!",}
9
- end
10
- def parse_error; RuntimeError; end
11
- end
12
-
13
- # A WorkingDuck instance should work as a Backend
14
- def decode(value)
15
- self.class.decode(value)
16
- end
17
- def parse_error; RuntimeError; end
18
- end
19
-
20
- class FailingDuckDecode
21
- # Fakes an incorrect decode response
22
- def decode(value)
23
- {}
24
- end
25
- def parse_error; RuntimeError; end
26
- end
27
-
28
- describe "OEmbed::Formatter::JSON::Backends::DuckType" do
29
- include OEmbedSpecHelper
30
-
31
- it "should work with WorkingDuck Class" do
32
- expect {
33
- OEmbed::Formatter::JSON.backend = WorkingDuck
34
- }.not_to raise_error
35
- expect(OEmbed::Formatter::JSON.backend).to be WorkingDuck
36
- end
37
-
38
- it "should work with a WorkingDuck instance" do
39
- instance = WorkingDuck.new
40
- expect {
41
- OEmbed::Formatter::JSON.backend = instance
42
- }.to_not raise_error
43
- expect(OEmbed::Formatter::JSON.backend).to be instance
44
- end
45
-
46
- it "should fail with FailingDuckDecode Class" do
47
- expect {
48
- OEmbed::Formatter::JSON.backend = FailingDuckDecode
49
- }.to raise_error(LoadError)
50
- expect(OEmbed::Formatter::JSON.backend).to_not be(FailingDuckDecode)
51
- end
52
-
53
- it "should fail with a FailingDuckDecode instance" do
54
- instance = FailingDuckDecode.new
55
- expect {
56
- OEmbed::Formatter::JSON.backend = instance
57
- }.to raise_error(LoadError)
58
- expect(OEmbed::Formatter::JSON.backend).to_not be(instance)
59
- end
60
- end
61
-
62
- describe "OEmbed::Formatter::XML::Backends::DuckType" do
63
- include OEmbedSpecHelper
64
-
65
- it "should work with WorkingDuck Class" do
66
- expect {
67
- OEmbed::Formatter::XML.backend = WorkingDuck
68
- }.to_not raise_error
69
- expect(OEmbed::Formatter::XML.backend).to be(WorkingDuck)
70
- end
71
-
72
- it "should work with a WorkingDuck instance" do
73
- instance = WorkingDuck.new
74
- expect {
75
- OEmbed::Formatter::XML.backend = instance
76
- }.to_not raise_error
77
- expect(OEmbed::Formatter::XML.backend).to be(instance)
78
- end
79
-
80
- it "should fail with FailingDuckDecode Class" do
81
- expect {
82
- OEmbed::Formatter::XML.backend = FailingDuckDecode
83
- }.to raise_error(LoadError)
84
- expect(OEmbed::Formatter::XML.backend).to_not be(FailingDuckDecode)
85
- end
86
-
87
- it "should fail with a FailingDuckDecode instance" do
88
- instance = FailingDuckDecode.new
89
- expect {
90
- OEmbed::Formatter::XML.backend = instance
91
- }.to raise_error(LoadError)
92
- expect(OEmbed::Formatter::XML.backend).to_not be(instance)
93
- end
94
- end