oh-my-embed 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -4
- data/lib/oh_my_embed.rb +11 -2
- data/lib/oh_my_embed/crawler.rb +5 -5
- data/lib/oh_my_embed/provider.rb +5 -4
- data/lib/oh_my_embed/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/facebook_posts.yml +7 -5
- data/spec/fixtures/vcr_cassettes/facebook_videos.yml +7 -5
- data/spec/fixtures/vcr_cassettes/flickr.yml +44 -42
- data/spec/fixtures/vcr_cassettes/instagram.yml +13 -11
- data/spec/fixtures/vcr_cassettes/kickstarter.yml +9 -7
- data/spec/fixtures/vcr_cassettes/slideshare.yml +26 -25
- data/spec/fixtures/vcr_cassettes/soundcloud.yml +8 -6
- data/spec/fixtures/vcr_cassettes/spotify.yml +13 -6
- data/spec/fixtures/vcr_cassettes/twitter.yml +13 -11
- data/spec/fixtures/vcr_cassettes/youtube.yml +22 -21
- data/spec/oh_my_embed/crawler_spec.rb +19 -19
- data/spec/oh_my_embed/providers/instagram_spec.rb +3 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef02d0fbce362fff167ba19d1b45c72160e4b16d
|
4
|
+
data.tar.gz: 3b7d47c493798f383a3e755d3b9cac2b79cd7291
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50a2eeae2938af6c2c8bab6f52b6bb1a2203b736c9dfaaa92a3a0b9f6af40a685dbd3678c6a200dd24f1a5d15581ddd0f44e2eb83fa2dff77c88636984d88b9e
|
7
|
+
data.tar.gz: 49a25748b9daae8dff640bb7854ce2c9ee4a0b523f0b31927deaaae8883bbeb31f3a6841c910d7c613c9d21972f0870521a1aee50943312b14be86f24221b1b0
|
data/README.md
CHANGED
@@ -24,7 +24,7 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
$ gem install oh-my-embed
|
26
26
|
|
27
|
-
##
|
27
|
+
## Built-in providers
|
28
28
|
|
29
29
|
- Youtube
|
30
30
|
- Slideshare
|
@@ -44,10 +44,10 @@ See the custom provider section for more informations.
|
|
44
44
|
|
45
45
|
### Basics
|
46
46
|
First of all you have to create a `OhMyEmbed::Crawler` object and register your desired providers.
|
47
|
-
You can use all
|
47
|
+
You can use all built-in providers, select only a few or mix them up with your custom providers.
|
48
48
|
|
49
49
|
```ruby
|
50
|
-
# Crawler with all
|
50
|
+
# Crawler with all built-in providers (includes all classes you added to the OhMyEmbed::Providers module)
|
51
51
|
crawler = OhMyEmbed::Crawler.new(all: true)
|
52
52
|
|
53
53
|
# Crawler with specific providers
|
@@ -56,7 +56,7 @@ crawler = OhMyEmbed::Crawler.new(:youtube, :slideshare)
|
|
56
56
|
# Crawler with custom providers
|
57
57
|
crawler = OhMyEmbed::Crawler.new(:youtube, MyProvider)
|
58
58
|
|
59
|
-
# Crawler with all
|
59
|
+
# Crawler with all built-in and a custom provider
|
60
60
|
crawler = OhMyEmbed::Crawler.new(MyProvider, all: true)
|
61
61
|
```
|
62
62
|
|
data/lib/oh_my_embed.rb
CHANGED
@@ -1,9 +1,18 @@
|
|
1
1
|
require 'active_support/all'
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
require 'oh_my_embed/crawler'
|
4
|
+
require 'oh_my_embed/provider'
|
5
|
+
require 'oh_my_embed/version'
|
5
6
|
|
6
7
|
module OhMyEmbed
|
8
|
+
|
9
|
+
module Providers
|
10
|
+
# Setup autoloading for every provider in oh_my_embed/providers
|
11
|
+
Dir.glob(File.join(__dir__, 'oh_my_embed', 'providers', '*.rb')).each do |provider_path|
|
12
|
+
autoload File.basename(provider_path, '.rb').camelize, provider_path
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
7
16
|
# All OhMyEmbed errors inherits from a generic OhMyEmbed::Error class
|
8
17
|
#
|
9
18
|
# - OhMyEmbed::UnknownProvider
|
data/lib/oh_my_embed/crawler.rb
CHANGED
@@ -10,7 +10,7 @@ module OhMyEmbed
|
|
10
10
|
|
11
11
|
options = providers.extract_options!
|
12
12
|
|
13
|
-
|
13
|
+
register_all_built_in_providers if options[:all]
|
14
14
|
providers.each do |provider|
|
15
15
|
register provider
|
16
16
|
end
|
@@ -32,10 +32,10 @@ module OhMyEmbed
|
|
32
32
|
@providers.add provider
|
33
33
|
end
|
34
34
|
|
35
|
-
# Register all
|
35
|
+
# Register all built-in providers for this crawler
|
36
36
|
#
|
37
|
-
def
|
38
|
-
|
37
|
+
def register_all_built_in_providers
|
38
|
+
built_in_providers.each do |provider|
|
39
39
|
register provider
|
40
40
|
end
|
41
41
|
end
|
@@ -69,7 +69,7 @@ module OhMyEmbed
|
|
69
69
|
# Select all provider constants from the OhMyEmbed::Providers module
|
70
70
|
#
|
71
71
|
# @return [Array<Symbol>]
|
72
|
-
def
|
72
|
+
def built_in_providers
|
73
73
|
OhMyEmbed::Providers.constants
|
74
74
|
.select { |c| OhMyEmbed::Providers.const_get(c) < OhMyEmbed::Provider }
|
75
75
|
end
|
data/lib/oh_my_embed/provider.rb
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'oh_my_embed/response'
|
3
|
+
|
1
4
|
module OhMyEmbed
|
2
5
|
##
|
3
6
|
# Provider
|
@@ -49,11 +52,9 @@ module OhMyEmbed
|
|
49
52
|
format: 'json',
|
50
53
|
}))
|
51
54
|
|
52
|
-
connection = Net::HTTP.new(uri.host, uri.port)
|
53
|
-
connection.use_ssl = (uri.port == URI::HTTPS::DEFAULT_PORT)
|
54
|
-
|
55
55
|
begin
|
56
|
-
|
56
|
+
http = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https')
|
57
|
+
response = http.request_get(uri, { 'User-Agent' => "Ruby/#{RUBY_VERSION}" })
|
57
58
|
rescue Timeout::Error
|
58
59
|
raise OhMyEmbed::Error.new('Request timed out')
|
59
60
|
end
|
data/lib/oh_my_embed/version.rb
CHANGED
@@ -7,12 +7,14 @@ http_interactions:
|
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
9
9
|
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Ruby/2.2.3
|
10
12
|
Accept-Encoding:
|
11
13
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
14
|
Accept:
|
13
15
|
- "*/*"
|
14
|
-
|
15
|
-
-
|
16
|
+
Host:
|
17
|
+
- www.facebook.com
|
16
18
|
response:
|
17
19
|
status:
|
18
20
|
code: 200
|
@@ -40,9 +42,9 @@ http_interactions:
|
|
40
42
|
Vary:
|
41
43
|
- Accept-Encoding
|
42
44
|
X-Fb-Debug:
|
43
|
-
-
|
45
|
+
- Tzox8b6mgFPotc6d4sFiHi9lhAMhulnc2A/G+3LVu3XlLLeL8Jb1LjmfBueNtoavcP06sTrN1GDwUAPwGa8DPg==
|
44
46
|
Date:
|
45
|
-
-
|
47
|
+
- Tue, 10 May 2016 17:27:30 GMT
|
46
48
|
Transfer-Encoding:
|
47
49
|
- chunked
|
48
50
|
Connection:
|
@@ -61,5 +63,5 @@ http_interactions:
|
|
61
63
|
on \u003Ca href=\"https://www.facebook.com/FacebookDeutschland/posts/10153796066380932\">Donnerstag,
|
62
64
|
25. Februar 2016\u003C/a>\u003C/blockquote>\u003C/div>\u003C/div>","type":"rich","version":"1.0","url":"https://www.facebook.com/FacebookDeutschland/posts/10153796066380932","width":552}'
|
63
65
|
http_version:
|
64
|
-
recorded_at:
|
66
|
+
recorded_at: Tue, 10 May 2016 17:27:30 GMT
|
65
67
|
recorded_with: VCR 3.0.1
|
@@ -7,12 +7,14 @@ http_interactions:
|
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
9
9
|
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Ruby/2.2.3
|
10
12
|
Accept-Encoding:
|
11
13
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
14
|
Accept:
|
13
15
|
- "*/*"
|
14
|
-
|
15
|
-
-
|
16
|
+
Host:
|
17
|
+
- www.facebook.com
|
16
18
|
response:
|
17
19
|
status:
|
18
20
|
code: 200
|
@@ -40,9 +42,9 @@ http_interactions:
|
|
40
42
|
Vary:
|
41
43
|
- Accept-Encoding
|
42
44
|
X-Fb-Debug:
|
43
|
-
-
|
45
|
+
- NwSlTuHrh1bfJY/Gssu2NEka0qtxrgdfuRkIf+X2A8yoqfaPszYN24nBRZLntIb/Fdw60QHtBIk9mSgFrHk3bw==
|
44
46
|
Date:
|
45
|
-
-
|
47
|
+
- Tue, 10 May 2016 17:27:30 GMT
|
46
48
|
Transfer-Encoding:
|
47
49
|
- chunked
|
48
50
|
Connection:
|
@@ -61,5 +63,5 @@ http_interactions:
|
|
61
63
|
by \u003Ca href=\"https://www.facebook.com/facebook/\">Facebook\u003C/a> on
|
62
64
|
Freitag, 5. Dezember 2014\u003C/blockquote>\u003C/div>\u003C/div>","type":"video","version":"1.0","url":"https://www.facebook.com/facebook/videos/10153231379946729/","width":500}'
|
63
65
|
http_version:
|
64
|
-
recorded_at:
|
66
|
+
recorded_at: Tue, 10 May 2016 17:27:30 GMT
|
65
67
|
recorded_with: VCR 3.0.1
|
@@ -7,19 +7,21 @@ http_interactions:
|
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
9
9
|
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Ruby/2.2.3
|
10
12
|
Accept-Encoding:
|
11
13
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
14
|
Accept:
|
13
15
|
- "*/*"
|
14
|
-
|
15
|
-
-
|
16
|
+
Host:
|
17
|
+
- www.flickr.com
|
16
18
|
response:
|
17
19
|
status:
|
18
20
|
code: 200
|
19
21
|
message: OK
|
20
22
|
headers:
|
21
23
|
Date:
|
22
|
-
-
|
24
|
+
- Tue, 10 May 2016 17:27:30 GMT
|
23
25
|
Content-Type:
|
24
26
|
- application/json
|
25
27
|
Content-Length:
|
@@ -29,62 +31,62 @@ http_interactions:
|
|
29
31
|
DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND
|
30
32
|
PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC GOV"
|
31
33
|
Set-Cookie:
|
32
|
-
- flrb=
|
34
|
+
- flrb=49; expires=Tue, 10-May-2016 18:27:30 GMT; path=/; domain=.flickr.com;
|
33
35
|
httponly
|
34
|
-
- flrbcr=
|
35
|
-
|
36
|
-
- flrbgdrp=
|
37
|
-
|
38
|
-
- flrbgmrp=
|
39
|
-
|
40
|
-
- flrbgrp=
|
41
|
-
|
42
|
-
- flrbp=
|
43
|
-
|
44
|
-
- flrbra=
|
45
|
-
|
46
|
-
- flrbras=
|
47
|
-
|
48
|
-
- flrbre=
|
49
|
-
|
50
|
-
- flrbrf=
|
51
|
-
|
52
|
-
- flrbrgs=
|
53
|
-
|
54
|
-
- flrbrp=
|
55
|
-
|
56
|
-
- flrbrps=
|
57
|
-
|
58
|
-
- flrbrst=
|
59
|
-
|
60
|
-
- flrbs=
|
61
|
-
|
62
|
-
- flrtags=
|
63
|
-
|
64
|
-
- localization=en-us%3Bde%3Bde; expires=
|
36
|
+
- flrbcr=1462901250-16eec3513dd43eec5de0fe266948b49367670733; expires=Sun, 06-Nov-2016
|
37
|
+
17:27:30 GMT; path=/; domain=.flickr.com; httponly
|
38
|
+
- flrbgdrp=1462901250-1406eb8bfcac14b53dfb323926be52b9dfa08679; expires=Sun,
|
39
|
+
06-Nov-2016 17:27:30 GMT; path=/; domain=.flickr.com; httponly
|
40
|
+
- flrbgmrp=1462901250-d000e80da56261c68caa64e637c06169334f8cfe; expires=Sun,
|
41
|
+
06-Nov-2016 17:27:30 GMT; path=/; domain=.flickr.com; httponly
|
42
|
+
- flrbgrp=1462901250-871a974f9430ecc4a1db4f6e767694fa45839b59; expires=Sun,
|
43
|
+
06-Nov-2016 17:27:30 GMT; path=/; domain=.flickr.com; httponly
|
44
|
+
- flrbp=1462901250-b89dca47140505ec7a3c0eb6d53f068c4eb31686; expires=Sun, 06-Nov-2016
|
45
|
+
17:27:30 GMT; path=/; domain=.flickr.com; httponly
|
46
|
+
- flrbra=1462901250-883d45fe5a187b7fea8308629a5d5363bd348931; expires=Sun, 06-Nov-2016
|
47
|
+
17:27:30 GMT; path=/; domain=.flickr.com; httponly
|
48
|
+
- flrbras=1462901250-3ddd9e8a185a751f54331803f5a4786b80532aa6; expires=Sun,
|
49
|
+
06-Nov-2016 17:27:30 GMT; path=/; domain=.flickr.com; httponly
|
50
|
+
- flrbre=1462901250-601cbbf50396b251c97edd5b40250bed905be376; expires=Sun, 06-Nov-2016
|
51
|
+
17:27:30 GMT; path=/; domain=.flickr.com; httponly
|
52
|
+
- flrbrf=1462901250-3d8b9f8d006210db47536cb3ea5b4ad2785e403c; expires=Sun, 06-Nov-2016
|
53
|
+
17:27:30 GMT; path=/; domain=.flickr.com; httponly
|
54
|
+
- flrbrgs=1462901250-1dd1efa1340b689b9f10f77a422d9a57a8a6a602; expires=Sun,
|
55
|
+
06-Nov-2016 17:27:30 GMT; path=/; domain=.flickr.com; httponly
|
56
|
+
- flrbrp=1462901250-2e071b0370054678e31d3bfa1438db8bad0364fa; expires=Sun, 06-Nov-2016
|
57
|
+
17:27:30 GMT; path=/; domain=.flickr.com; httponly
|
58
|
+
- flrbrps=1462901250-bc5dd2aec071f9d7404ac317272dadbae5a707ba; expires=Sun,
|
59
|
+
06-Nov-2016 17:27:30 GMT; path=/; domain=.flickr.com; httponly
|
60
|
+
- flrbrst=1462901250-1c332e978ef4f22ec0e7bdc455cf3bacd726a09b; expires=Sun,
|
61
|
+
06-Nov-2016 17:27:30 GMT; path=/; domain=.flickr.com; httponly
|
62
|
+
- flrbs=1462901250-3e83c8866ed725eed4900f0967fedd5807c798bb; expires=Sun, 06-Nov-2016
|
63
|
+
17:27:30 GMT; path=/; domain=.flickr.com; httponly
|
64
|
+
- flrtags=1462901250-cc337a217432bd77847e867e3b3296ffa4719367; expires=Sun,
|
65
|
+
06-Nov-2016 17:27:30 GMT; path=/; domain=.flickr.com; httponly
|
66
|
+
- localization=en-us%3Bde%3Bde; expires=Tue, 08-May-2018 17:27:30 GMT; path=/;
|
65
67
|
domain=.flickr.com
|
66
|
-
- xb=
|
68
|
+
- xb=171599; expires=Fri, 11-May-2018 17:27:30 GMT; path=/; domain=.flickr.com
|
67
69
|
Cache-Control:
|
68
70
|
- private
|
69
71
|
X-Served-By:
|
70
|
-
-
|
72
|
+
- www291.flickr.bf1.yahoo.com
|
71
73
|
Vary:
|
72
74
|
- Accept-Encoding
|
73
75
|
Age:
|
74
|
-
- '
|
76
|
+
- '0'
|
75
77
|
Via:
|
76
|
-
- http/1.1
|
77
|
-
|
78
|
+
- http/1.1 fts124.flickr.bf1.yahoo.com (ApacheTrafficServer [cMsSf ]), http/1.1
|
79
|
+
r10.ycpi.loa.yahoo.net (ApacheTrafficServer [cMsSf ])
|
78
80
|
Server:
|
79
81
|
- ATS
|
80
82
|
Connection:
|
81
83
|
- keep-alive
|
82
84
|
Y-Trace:
|
83
|
-
-
|
85
|
+
- BAEAQAAAAACohNTsiiS5yQAAAAAAAAAAM2z3Uq_gF90AAAAAAAAAAAAFMoA9ZHkoAAUygD1n1O3eEmEuAAAAAA--
|
84
86
|
body:
|
85
87
|
encoding: ASCII-8BIT
|
86
88
|
string: |
|
87
89
|
{"type":"photo","flickr_type":"photo","title":"T-21","author_name":"BeyondBrickz","author_url":"https:\/\/www.flickr.com\/photos\/66038491@N06\/","width":"1024","height":"629","url":"https:\/\/farm8.staticflickr.com\/7231\/26861401435_c1dbfe8703_b.jpg","web_page":"https:\/\/www.flickr.com\/photos\/66038491@N06\/26861401435\/","thumbnail_url":"https:\/\/farm8.staticflickr.com\/7231\/26861401435_c1dbfe8703_q.jpg","thumbnail_width":150,"thumbnail_height":150,"web_page_short_url":"https:\/\/flic.kr\/p\/GVDGNX","license":"All Rights Reserved","license_id":0,"html":"<a data-flickr-embed=\"true\" href=\"https:\/\/www.flickr.com\/photos\/66038491@N06\/26861401435\/\" title=\"T-21 by BeyondBrickz, on Flickr\"><img src=\"https:\/\/farm8.staticflickr.com\/7231\/26861401435_c1dbfe8703_b.jpg\" width=\"1024\" height=\"629\" alt=\"T-21\"><\/a><script async src=\"https:\/\/embedr.flickr.com\/assets\/client-code.js\" charset=\"utf-8\"><\/script>","version":"1.0","cache_age":3600,"provider_name":"Flickr","provider_url":"https:\/\/www.flickr.com\/"}
|
88
90
|
http_version:
|
89
|
-
recorded_at:
|
91
|
+
recorded_at: Tue, 10 May 2016 17:27:30 GMT
|
90
92
|
recorded_with: VCR 3.0.1
|
@@ -7,12 +7,14 @@ http_interactions:
|
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
9
9
|
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Ruby/2.2.3
|
10
12
|
Accept-Encoding:
|
11
13
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
14
|
Accept:
|
13
15
|
- "*/*"
|
14
|
-
|
15
|
-
-
|
16
|
+
Host:
|
17
|
+
- api.instagram.com
|
16
18
|
response:
|
17
19
|
status:
|
18
20
|
code: 200
|
@@ -29,25 +31,25 @@ http_interactions:
|
|
29
31
|
Cache-Control:
|
30
32
|
- private, no-cache, no-store, must-revalidate
|
31
33
|
Date:
|
32
|
-
-
|
34
|
+
- Tue, 10 May 2016 17:27:31 GMT
|
33
35
|
Content-Type:
|
34
36
|
- application/json
|
35
37
|
Set-Cookie:
|
36
|
-
- csrftoken=
|
38
|
+
- csrftoken=8f4dacd4a68f2934b4de8db475c1e6cb; expires=Tue, 09-May-2017 17:27:31
|
37
39
|
GMT; Max-Age=31449600; Path=/
|
38
|
-
- mid=
|
40
|
+
- mid=VzIaAwAEAAE3nyLm3C-s_zAajIeH; expires=Mon, 05-May-2036 17:27:31 GMT; Max-Age=630720000;
|
39
41
|
Path=/
|
40
|
-
- s_network=; expires=
|
41
|
-
- sessionid=
|
42
|
-
expires=
|
42
|
+
- s_network=; expires=Tue, 10-May-2016 18:27:31 GMT; Max-Age=3600; Path=/
|
43
|
+
- sessionid=IGSC172cb5dc8a3a464594e13968285068a25f697470da7f859efea1505ee7f6513e%3A5JABAA5qawnpjtBgRwf7r0dq39cMUpF1%3A%7B%22asns%22%3A%7B%2294.79.132.90%22%3A6830%2C%22time%22%3A1462901251%7D%7D;
|
44
|
+
expires=Mon, 08-Aug-2016 17:27:31 GMT; httponly; Max-Age=7776000; Path=/
|
43
45
|
Connection:
|
44
46
|
- keep-alive
|
45
47
|
Content-Length:
|
46
|
-
- '
|
48
|
+
- '1403'
|
47
49
|
body:
|
48
50
|
encoding: ASCII-8BIT
|
49
51
|
string: '{"provider_url": "https://www.instagram.com", "media_id": "558717847597368461_9538472",
|
50
|
-
"author_name": "diegoquinteiro", "height": null, "thumbnail_url": "https://scontent-
|
52
|
+
"author_name": "diegoquinteiro", "height": null, "thumbnail_url": "https://scontent-ams3-1.cdninstagram.com/t51.2885-15/e15/11358196_1472850273007829_614249870_n.jpg?ig_cache_key=NTU4NzE3ODQ3NTk3MzY4NDYx.2",
|
51
53
|
"thumbnail_width": 640, "thumbnail_height": 640, "provider_name": "Instagram",
|
52
54
|
"title": "Wii Gato (Lipe Sleep)", "html": "\u003cblockquote class=\"instagram-media\"
|
53
55
|
data-instgrm-captioned data-instgrm-version=\"6\" style=\" background:#FFF;
|
@@ -71,5 +73,5 @@ http_interactions:
|
|
71
73
|
"width": 658, "version": "1.0", "author_url": "https://www.instagram.com/diegoquinteiro",
|
72
74
|
"author_id": 9538472, "type": "rich"}'
|
73
75
|
http_version:
|
74
|
-
recorded_at:
|
76
|
+
recorded_at: Tue, 10 May 2016 17:27:31 GMT
|
75
77
|
recorded_with: VCR 3.0.1
|
@@ -7,12 +7,14 @@ http_interactions:
|
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
9
9
|
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Ruby/2.2.3
|
10
12
|
Accept-Encoding:
|
11
13
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
14
|
Accept:
|
13
15
|
- "*/*"
|
14
|
-
|
15
|
-
-
|
16
|
+
Host:
|
17
|
+
- www.kickstarter.com
|
16
18
|
response:
|
17
19
|
status:
|
18
20
|
code: 200
|
@@ -35,15 +37,15 @@ http_interactions:
|
|
35
37
|
Cache-Control:
|
36
38
|
- max-age=0, private, must-revalidate
|
37
39
|
X-Request-Id:
|
38
|
-
-
|
40
|
+
- 4a3cf514-c706-4767-988b-5097a6c230b8
|
39
41
|
X-Runtime:
|
40
|
-
- '0.
|
42
|
+
- '0.033783'
|
41
43
|
Transfer-Encoding:
|
42
44
|
- chunked
|
43
45
|
Accept-Ranges:
|
44
46
|
- bytes
|
45
47
|
Date:
|
46
|
-
-
|
48
|
+
- Tue, 10 May 2016 17:27:32 GMT
|
47
49
|
Via:
|
48
50
|
- 1.1 varnish
|
49
51
|
Age:
|
@@ -51,7 +53,7 @@ http_interactions:
|
|
51
53
|
Connection:
|
52
54
|
- keep-alive
|
53
55
|
X-Served-By:
|
54
|
-
- cache-
|
56
|
+
- cache-ams4134-AMS
|
55
57
|
X-Cache:
|
56
58
|
- MISS
|
57
59
|
X-Cache-Hits:
|
@@ -61,5 +63,5 @@ http_interactions:
|
|
61
63
|
string: |
|
62
64
|
{"version":"1.0","type":"rich","provider_name":"Kickstarter","provider_url":"https://www.kickstarter.com/","title":"Professional 3 Stage Knife Sharpener","author_name":"Kongqiang","author_url":"https://www.kickstarter.com/profile/531257408","thumbnail_url":"https://ksr-ugc.imgix.net/projects/2452435/photo-original.jpg?w=560&h=315&fit=fill&bg=FFFFFF&v=1461877181&auto=format&q=92&s=aae8e61c91e611fd27cc2db1c25a8916","thumbnail_width":560,"thumbnail_height":315.0,"width":480,"height":270.0,"html":"<iframe frameborder=\"0\" height=\"270.0\" scrolling=\"no\" src=\"https://www.kickstarter.com/projects/531257408/professional-3-stage-knife-sharpener/widget/video.html\" width=\"480\"></iframe>"}
|
63
65
|
http_version:
|
64
|
-
recorded_at:
|
66
|
+
recorded_at: Tue, 10 May 2016 17:27:32 GMT
|
65
67
|
recorded_with: VCR 3.0.1
|
@@ -7,12 +7,14 @@ http_interactions:
|
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
9
9
|
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Ruby/2.2.3
|
10
12
|
Accept-Encoding:
|
11
13
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
14
|
Accept:
|
13
15
|
- "*/*"
|
14
|
-
|
15
|
-
-
|
16
|
+
Host:
|
17
|
+
- www.slideshare.net
|
16
18
|
response:
|
17
19
|
status:
|
18
20
|
code: 200
|
@@ -21,7 +23,7 @@ http_interactions:
|
|
21
23
|
Server:
|
22
24
|
- nginx
|
23
25
|
Date:
|
24
|
-
-
|
26
|
+
- Tue, 10 May 2016 17:27:39 GMT
|
25
27
|
Content-Type:
|
26
28
|
- application/json; charset=utf-8
|
27
29
|
Status:
|
@@ -29,37 +31,37 @@ http_interactions:
|
|
29
31
|
X-Content-Type-Options:
|
30
32
|
- nosniff
|
31
33
|
- nosniff
|
32
|
-
X-Runtime:
|
33
|
-
- '0.029925'
|
34
|
-
X-Request-Uuid:
|
35
|
-
- klA26xRYoRi0KQ4PET8oZw==
|
36
|
-
X-Xss-Protection:
|
37
|
-
- 1; mode=block
|
38
|
-
X-Ua-Compatible:
|
39
|
-
- IE=Edge,chrome=1
|
40
34
|
Cache-Control:
|
41
35
|
- max-age=0, private, must-revalidate
|
36
|
+
X-Ua-Compatible:
|
37
|
+
- IE=Edge,chrome=1
|
38
|
+
X-Xss-Protection:
|
39
|
+
- 1; mode=block
|
40
|
+
X-Runtime:
|
41
|
+
- '0.035600'
|
42
42
|
X-Bench-Route:
|
43
43
|
- oembed/get_oembed_code
|
44
44
|
X-Request-Id:
|
45
|
-
-
|
45
|
+
- a609ac1efddfbe20749eb86bc632ce64
|
46
|
+
X-Request-Uuid:
|
47
|
+
- V7ANU6f31m3Gsj1cnH8UfA==
|
46
48
|
P3p:
|
47
49
|
- CP="OTI DSP COR CUR ADM DEV PSD IVD CONo OUR IND"
|
48
50
|
X-Varnish:
|
49
|
-
- '
|
51
|
+
- '692146762'
|
50
52
|
Age:
|
51
53
|
- '0'
|
52
54
|
Accept-Ranges:
|
53
55
|
- bytes
|
54
56
|
X-Fs-Uuid:
|
55
|
-
-
|
57
|
+
- 1b83dfddf1444d142062cfe5aa2b0000
|
56
58
|
X-Li-Fabric:
|
57
59
|
- prod-lva1
|
58
60
|
Set-Cookie:
|
59
|
-
- SERVERID=r88|
|
60
|
-
- _uv_id=
|
61
|
-
- bcookie="v=2&
|
62
|
-
Path=/; Expires=
|
61
|
+
- SERVERID=r88|VzIaD|VzIaD; path=/
|
62
|
+
- _uv_id=1688034539; Path=/; Domain=.slideshare.net
|
63
|
+
- bcookie="v=2&771ddf0e-ec90-40c5-825c-89d29f698830"; domain=.slideshare.net;
|
64
|
+
Path=/; Expires=Fri, 11-May-2018 05:05:11 GMT
|
63
65
|
Transfer-Encoding:
|
64
66
|
- chunked
|
65
67
|
Connection:
|
@@ -67,12 +69,10 @@ http_interactions:
|
|
67
69
|
X-Li-Pop:
|
68
70
|
- prod-tln1
|
69
71
|
X-Li-Uuid:
|
70
|
-
-
|
72
|
+
- G4Pf3fFETRQgYs/lqisAAA==
|
71
73
|
body:
|
72
74
|
encoding: ASCII-8BIT
|
73
|
-
string: '{"
|
74
|
-
Quotes for 2011","provider_url":"http://www.slideshare.net","version":"1.0","slide_image_baseurl":"//image.slidesharecdn.com/110103quotes2010-12-110103073149-phpapp01/95/slide-","conversion_version":2,"width":425,"thumbnail_width":170,"version_no":"1294104671","author_url":"http://www.slideshare.net/haraldf","thumbnail_height":128,"slideshow_id":6435157,"html":"\u003Ciframe
|
75
|
-
src=\"https://www.slideshare.net/slideshow/embed_code/key/6PCWPGFw9SwsAY\"
|
75
|
+
string: '{"html":"\u003Ciframe src=\"https://www.slideshare.net/slideshow/embed_code/key/6PCWPGFw9SwsAY\"
|
76
76
|
width=\"427\" height=\"356\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\"
|
77
77
|
scrolling=\"no\" style=\"border:1px solid #CCC; border-width:1px; margin-bottom:5px;
|
78
78
|
max-width: 100%;\" allowfullscreen\u003E \u003C/iframe\u003E \u003Cdiv style=\"margin-bottom:5px\"\u003E
|
@@ -80,8 +80,9 @@ http_interactions:
|
|
80
80
|
title=\"Business Quotes for 2011\" target=\"_blank\"\u003EBusiness Quotes
|
81
81
|
for 2011\u003C/a\u003E \u003C/strong\u003E from \u003Cstrong\u003E\u003Ca
|
82
82
|
href=\"http://www.slideshare.net/haraldf\" target=\"_blank\"\u003EHarald Felgner
|
83
|
-
(PhD)\u003C/a\u003E\u003C/strong\u003E \u003C/div\u003E\n\n","
|
84
|
-
|
83
|
+
(PhD)\u003C/a\u003E\u003C/strong\u003E \u003C/div\u003E\n\n","slideshow_id":6435157,"author_url":"http://www.slideshare.net/haraldf","version":"1.0","thumbnail_width":170,"version_no":"1294104671","height":355,"title":"Business
|
84
|
+
Quotes for 2011","conversion_version":2,"slide_image_baseurl_suffix":"-1024.jpg","thumbnail_height":128,"width":425,"author_name":"Harald
|
85
|
+
Felgner (PhD)","type":"rich","provider_name":"SlideShare","provider_url":"http://www.slideshare.net","slide_image_baseurl":"//image.slidesharecdn.com/110103quotes2010-12-110103073149-phpapp01/95/slide-","thumbnail":"//cdn.slidesharecdn.com/ss_thumbnails/110103quotes2010-12-110103073149-phpapp01-thumbnail.jpg?cb=1294104671","total_slides":75}'
|
85
86
|
http_version:
|
86
|
-
recorded_at:
|
87
|
+
recorded_at: Tue, 10 May 2016 17:27:39 GMT
|
87
88
|
recorded_with: VCR 3.0.1
|
@@ -7,12 +7,14 @@ http_interactions:
|
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
9
9
|
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Ruby/2.2.3
|
10
12
|
Accept-Encoding:
|
11
13
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
14
|
Accept:
|
13
15
|
- "*/*"
|
14
|
-
|
15
|
-
-
|
16
|
+
Host:
|
17
|
+
- soundcloud.com
|
16
18
|
response:
|
17
19
|
status:
|
18
20
|
code: 200
|
@@ -31,14 +33,14 @@ http_interactions:
|
|
31
33
|
Content-Type:
|
32
34
|
- application/json; charset=utf-8
|
33
35
|
Date:
|
34
|
-
-
|
36
|
+
- Tue, 10 May 2016 17:27:39 GMT
|
35
37
|
Etag:
|
36
38
|
- '"2d6b1f97d0ed1cbecef9424944baa728"'
|
37
39
|
Server:
|
38
40
|
- am/2
|
39
41
|
Set-Cookie:
|
40
|
-
- sc_anonymous_id=
|
41
|
-
|
42
|
+
- sc_anonymous_id=868951-405843-685342-731802; path=/; expires=Fri, 08 May 2026
|
43
|
+
17:27:39 GMT; domain=.soundcloud.com
|
42
44
|
Status:
|
43
45
|
- 200 OK
|
44
46
|
X-Frame-Options:
|
@@ -53,5 +55,5 @@ http_interactions:
|
|
53
55
|
","thumbnail_url":"http://i1.sndcdn.com/artworks-000067273316-smsiqx-t500x500.jpg","html":"\u003Ciframe
|
54
56
|
width=\"100%\" height=\"400\" scrolling=\"no\" frameborder=\"no\" src=\"https://w.soundcloud.com/player/?visual=true\u0026url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F293\u0026show_artwork=true\"\u003E\u003C/iframe\u003E","author_name":"Forss","author_url":"http://soundcloud.com/forss"}'
|
55
57
|
http_version:
|
56
|
-
recorded_at:
|
58
|
+
recorded_at: Tue, 10 May 2016 17:27:39 GMT
|
57
59
|
recorded_with: VCR 3.0.1
|
@@ -7,12 +7,14 @@ http_interactions:
|
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
9
9
|
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Ruby/2.2.3
|
10
12
|
Accept-Encoding:
|
11
13
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
14
|
Accept:
|
13
15
|
- "*/*"
|
14
|
-
|
15
|
-
-
|
16
|
+
Host:
|
17
|
+
- embed.spotify.com
|
16
18
|
response:
|
17
19
|
status:
|
18
20
|
code: 200
|
@@ -21,9 +23,9 @@ http_interactions:
|
|
21
23
|
Server:
|
22
24
|
- nginx
|
23
25
|
Date:
|
24
|
-
-
|
26
|
+
- Tue, 10 May 2016 17:27:40 GMT
|
25
27
|
Content-Type:
|
26
|
-
-
|
28
|
+
- application/json
|
27
29
|
Transfer-Encoding:
|
28
30
|
- chunked
|
29
31
|
Connection:
|
@@ -32,13 +34,18 @@ http_interactions:
|
|
32
34
|
- timeout=10
|
33
35
|
Vary:
|
34
36
|
- Accept-Encoding
|
37
|
+
P3p:
|
38
|
+
- CP="NOI OUR"
|
35
39
|
X-Content-Type-Options:
|
36
40
|
- nosniff
|
37
41
|
Strict-Transport-Security:
|
38
42
|
- max-age=31536000;
|
39
43
|
body:
|
40
44
|
encoding: ASCII-8BIT
|
41
|
-
string: '{"provider_url":"https:\/\/www.spotify.com","version":"1.0","thumbnail_width":300,"height":380,"thumbnail_height":300,"title":"John
|
45
|
+
string: '{"provider_url":"https:\/\/www.spotify.com","version":"1.0","thumbnail_width":300,"height":380,"thumbnail_height":300,"title":"John
|
46
|
+
De Sohn - Dance Our Tears Away - Radio Edit","width":300,"thumbnail_url":"https:\/\/d3rt1990lpmkn.cloudfront.net\/cover\/35ff8ecde854e7c713dc4ffad2f31441e7bc1207","provider_name":"Spotify","type":"rich","html":"<iframe
|
47
|
+
src=\"https:\/\/embed.spotify.com\/?uri=spotify:track:298gs9ATwr2rD9tGYJKlQR\"
|
48
|
+
width=\"300\" height=\"380\" frameborder=\"0\" allowtransparency=\"true\"><\/iframe>"}'
|
42
49
|
http_version:
|
43
|
-
recorded_at:
|
50
|
+
recorded_at: Tue, 10 May 2016 17:27:40 GMT
|
44
51
|
recorded_with: VCR 3.0.1
|
@@ -7,12 +7,14 @@ http_interactions:
|
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
9
9
|
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Ruby/2.2.3
|
10
12
|
Accept-Encoding:
|
11
13
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
14
|
Accept:
|
13
15
|
- "*/*"
|
14
|
-
|
15
|
-
-
|
16
|
+
Host:
|
17
|
+
- publish.twitter.com
|
16
18
|
response:
|
17
19
|
status:
|
18
20
|
code: 200
|
@@ -27,26 +29,26 @@ http_interactions:
|
|
27
29
|
Content-Type:
|
28
30
|
- application/json; charset=utf-8
|
29
31
|
Date:
|
30
|
-
-
|
32
|
+
- Tue, 10 May 2016 17:27:40 GMT
|
31
33
|
Expires:
|
32
|
-
-
|
34
|
+
- Thu, 16 Apr 2116 17:27:40 GMT
|
33
35
|
Last-Modified:
|
34
|
-
-
|
36
|
+
- Tue, 10 May 2016 17:27:40 GMT
|
35
37
|
Server:
|
36
|
-
-
|
38
|
+
- tsa_b
|
37
39
|
Set-Cookie:
|
38
|
-
- guest_id=v1%
|
39
|
-
|
40
|
+
- guest_id=v1%3A146290126090217547; Domain=.twitter.com; Path=/; Expires=Thu,
|
41
|
+
10-May-2018 17:27:40 UTC
|
40
42
|
Strict-Transport-Security:
|
41
43
|
- max-age=631138519
|
42
44
|
X-Connection-Hash:
|
43
|
-
-
|
45
|
+
- a0e52c894a7cb519d0de0b80f683a258
|
44
46
|
X-Content-Type-Options:
|
45
47
|
- nosniff
|
46
48
|
X-Frame-Options:
|
47
49
|
- SAMEORIGIN
|
48
50
|
X-Response-Time:
|
49
|
-
- '
|
51
|
+
- '14'
|
50
52
|
X-Xss-Protection:
|
51
53
|
- 1; mode=block
|
52
54
|
body:
|
@@ -62,5 +64,5 @@ http_interactions:
|
|
62
64
|
3, 2014\u003C\/a\u003E\u003C\/blockquote\u003E\n\u003Cscript async src=\"\/\/platform.twitter.com\/widgets.js\"
|
63
65
|
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"}'
|
64
66
|
http_version:
|
65
|
-
recorded_at:
|
67
|
+
recorded_at: Tue, 10 May 2016 17:27:40 GMT
|
66
68
|
recorded_with: VCR 3.0.1
|
@@ -7,34 +7,36 @@ http_interactions:
|
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
9
9
|
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Ruby/2.2.3
|
10
12
|
Accept-Encoding:
|
11
13
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
14
|
Accept:
|
13
15
|
- "*/*"
|
14
|
-
|
15
|
-
-
|
16
|
+
Host:
|
17
|
+
- www.youtube.com
|
16
18
|
response:
|
17
19
|
status:
|
18
20
|
code: 200
|
19
21
|
message: OK
|
20
22
|
headers:
|
21
|
-
Content-Type:
|
22
|
-
- application/json
|
23
|
-
Cache-Control:
|
24
|
-
- no-cache
|
25
|
-
X-Content-Type-Options:
|
26
|
-
- nosniff
|
27
23
|
X-Xss-Protection:
|
28
24
|
- 1; mode=block; report=https://www.google.com/appserve/security-bugs/log/youtube
|
29
|
-
|
30
|
-
-
|
25
|
+
Expires:
|
26
|
+
- Tue, 27 Apr 1971 19:44:06 EST
|
27
|
+
X-Content-Type-Options:
|
28
|
+
- nosniff
|
31
29
|
P3p:
|
32
30
|
- CP="This is not a P3P policy! See http://support.google.com/accounts/answer/151657?hl=en
|
33
31
|
for more info."
|
34
|
-
|
35
|
-
-
|
32
|
+
Strict-Transport-Security:
|
33
|
+
- max-age=604800
|
34
|
+
Content-Type:
|
35
|
+
- application/json
|
36
|
+
Cache-Control:
|
37
|
+
- no-cache
|
36
38
|
Date:
|
37
|
-
-
|
39
|
+
- Tue, 10 May 2016 17:27:41 GMT
|
38
40
|
Server:
|
39
41
|
- Ytfe_Worker
|
40
42
|
Alternate-Protocol:
|
@@ -45,13 +47,12 @@ http_interactions:
|
|
45
47
|
- chunked
|
46
48
|
body:
|
47
49
|
encoding: ASCII-8BIT
|
48
|
-
string: '{"
|
49
|
-
"
|
50
|
-
"
|
51
|
-
"
|
52
|
-
|
53
|
-
"
|
54
|
-
frameborder=\"0\" allowfullscreen\u003e\u003c\/iframe\u003e"}'
|
50
|
+
string: '{"provider_name": "YouTube", "width": 459, "thumbnail_url": "https:\/\/i.ytimg.com\/vi\/EErY75MXYXI\/hqdefault.jpg",
|
51
|
+
"thumbnail_height": 360, "type": "video", "provider_url": "https:\/\/www.youtube.com\/",
|
52
|
+
"height": 344, "thumbnail_width": 480, "author_url": "https:\/\/www.youtube.com\/user\/NyaAnimeParty",
|
53
|
+
"version": "1.0", "html": "\u003ciframe width=\"459\" height=\"344\" src=\"https:\/\/www.youtube.com\/embed\/EErY75MXYXI?feature=oembed\"
|
54
|
+
frameborder=\"0\" allowfullscreen\u003e\u003c\/iframe\u003e", "author_name":
|
55
|
+
"NyaAnimeParty", "title": "Nyan Cat - 24 Hour Edition"}'
|
55
56
|
http_version:
|
56
|
-
recorded_at:
|
57
|
+
recorded_at: Tue, 10 May 2016 17:27:41 GMT
|
57
58
|
recorded_with: VCR 3.0.1
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
class OhMyEmbed::Providers::
|
3
|
+
class OhMyEmbed::Providers::BuiltInDummy < OhMyEmbed::Provider
|
4
4
|
self.schemes = [
|
5
5
|
'//*.example.com/*'
|
6
6
|
]
|
@@ -16,7 +16,7 @@ describe OhMyEmbed::Crawler do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'register the default providers with option all: true' do
|
19
|
-
expect_any_instance_of(OhMyEmbed::Crawler).to receive(:
|
19
|
+
expect_any_instance_of(OhMyEmbed::Crawler).to receive(:register_all_built_in_providers)
|
20
20
|
|
21
21
|
OhMyEmbed::Crawler.new all: true
|
22
22
|
end
|
@@ -31,13 +31,13 @@ describe OhMyEmbed::Crawler do
|
|
31
31
|
|
32
32
|
describe '#register' do
|
33
33
|
it 'finds the provider by symbol and add it to the providers list' do
|
34
|
-
expect{ crawler.register(:
|
35
|
-
expect(crawler.providers.first).to be OhMyEmbed::Providers::
|
34
|
+
expect{ crawler.register(:built_in_dummy) }.to change{ crawler.providers.count }.from(0).to(1)
|
35
|
+
expect(crawler.providers.first).to be OhMyEmbed::Providers::BuiltInDummy
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'it add the provider class to the providers list' do
|
39
|
-
expect{ crawler.register(OhMyEmbed::Providers::
|
40
|
-
expect(crawler.providers.first).to be OhMyEmbed::Providers::
|
39
|
+
expect{ crawler.register(OhMyEmbed::Providers::BuiltInDummy) }.to change{ crawler.providers.count }.from(0).to(1)
|
40
|
+
expect(crawler.providers.first).to be OhMyEmbed::Providers::BuiltInDummy
|
41
41
|
end
|
42
42
|
|
43
43
|
it 'raises an error if no provider class found' do
|
@@ -45,30 +45,30 @@ describe OhMyEmbed::Crawler do
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
describe '#
|
49
|
-
it 'adds all the
|
50
|
-
expect{ crawler.
|
51
|
-
expect(crawler.providers.include?(OhMyEmbed::Providers::
|
48
|
+
describe '#register_all_built_in_providers' do
|
49
|
+
it 'adds all the built-in providers' do
|
50
|
+
expect{ crawler.register_all_built_in_providers }.to change{ crawler.providers.count }
|
51
|
+
expect(crawler.providers.include?(OhMyEmbed::Providers::BuiltInDummy)).to be true
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
describe '#
|
56
|
-
it 'returns a symbols array with all
|
57
|
-
|
58
|
-
expect(
|
59
|
-
expect(
|
60
|
-
expect(
|
55
|
+
describe '#built_in_providers' do
|
56
|
+
it 'returns a symbols array with all built-in providers' do
|
57
|
+
built_in_providers = crawler.built_in_providers
|
58
|
+
expect(built_in_providers).to be_a Array
|
59
|
+
expect(built_in_providers.all?{ |p| p.is_a? Symbol }).to be true
|
60
|
+
expect(built_in_providers.include?(:BuiltInDummy)).to be true
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
64
|
context 'crawler with a dummy provider' do
|
65
65
|
before do
|
66
|
-
crawler.register :
|
66
|
+
crawler.register :built_in_dummy
|
67
67
|
end
|
68
68
|
|
69
69
|
describe '#fetch' do
|
70
70
|
it 'calls fetch on the found provider and return an OhMyEmbed::Response' do
|
71
|
-
expect(OhMyEmbed::Providers::
|
71
|
+
expect(OhMyEmbed::Providers::BuiltInDummy).to receive(:fetch).with(url).and_return(OhMyEmbed::Response.new(OhMyEmbed::Providers::BuiltInDummy, url))
|
72
72
|
response = crawler.fetch(url)
|
73
73
|
|
74
74
|
expect(response).to be_a OhMyEmbed::Response
|
@@ -82,7 +82,7 @@ describe OhMyEmbed::Crawler do
|
|
82
82
|
|
83
83
|
it 'finds and return the matching provider' do
|
84
84
|
provider = crawler.provider_for(url)
|
85
|
-
expect(provider).to be OhMyEmbed::Providers::
|
85
|
+
expect(provider).to be OhMyEmbed::Providers::BuiltInDummy
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
@@ -29,11 +29,9 @@ describe OhMyEmbed::Providers::Instagram do
|
|
29
29
|
url: 'https://www.instagram.com/diegoquinteiro',
|
30
30
|
})
|
31
31
|
|
32
|
-
expect(response.thumbnail).to
|
33
|
-
|
34
|
-
|
35
|
-
height: 640,
|
36
|
-
})
|
32
|
+
expect(response.thumbnail[:url]).to be_a String
|
33
|
+
expect(response.thumbnail[:width]).to eq 640
|
34
|
+
expect(response.thumbnail[:height]).to eq 640
|
37
35
|
|
38
36
|
expect(response.embed[:html]).to be_a String
|
39
37
|
expect(response.embed[:width]).to eq 658
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oh-my-embed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Axel Wahlen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|