film_snob 1.0.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.rspec +0 -2
- data/.travis.yml +7 -13
- data/CHANGELOG.md +18 -0
- data/README.md +2 -3
- data/Rakefile +8 -10
- data/{Gemfile → gems.rb} +1 -1
- data/lib/film_snob.rb +1 -1
- data/lib/film_snob/oembed_provider.rb +26 -23
- data/lib/film_snob/oembed_providers/instagram.rb +1 -1
- data/lib/film_snob/version.rb +1 -1
- data/spec/film_snob/oembed_providers/vine_spec.rb +4 -4
- data/spec/film_snob/oembed_providers/youtube_spec.rb +4 -4
- metadata +4 -7
- data/lib/film_snob/oembed_providers/rdio.rb +0 -20
- data/spec/film_snob/oembed_providers/rdio_spec.rb +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e78e11fa0a69ae6d0f1cae151f3df7078e92b6c5
|
4
|
+
data.tar.gz: dd1ac5931f67399f2ecb809eae9b9f85d51995bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1eac1d39804a8d5f88bdc23a1a4facaddd60da92e6b40a21a37f08f5e53f3d5aa4a13a0452a791bcbfdaa20a64b0e11551c4bbea618e98966c7f523ded569a74
|
7
|
+
data.tar.gz: d32bf53b9fe35be239c4d384ae1c7cd66517621efbd8d757996de6511fd941a1557381005237cf593ec1e1a4fb0d940a40d27a82063abf9843df41d3a829d110
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/.travis.yml
CHANGED
@@ -3,18 +3,9 @@ cache: bundler
|
|
3
3
|
language: ruby
|
4
4
|
rvm:
|
5
5
|
- 2.0.0
|
6
|
-
- 2.1.
|
7
|
-
- 2.
|
8
|
-
- 2.
|
9
|
-
- 2.1.3
|
10
|
-
- 2.1.4
|
11
|
-
- 2.1.5
|
12
|
-
- 2.1.6
|
13
|
-
- 2.1.7
|
14
|
-
- 2.2.0
|
15
|
-
- 2.2.1
|
16
|
-
- 2.2.2
|
17
|
-
- 2.2.3
|
6
|
+
- 2.1.8
|
7
|
+
- 2.2.4
|
8
|
+
- 2.3.0
|
18
9
|
- ruby-head
|
19
10
|
- jruby-19mode
|
20
11
|
- jruby-9.0.1.0
|
@@ -27,5 +18,8 @@ matrix:
|
|
27
18
|
- rvm: jruby-9.0.1.0
|
28
19
|
- rvm: rbx-2
|
29
20
|
before_install: 'gem install bundler -v 1.10.6'
|
21
|
+
install: bundle install
|
30
22
|
script:
|
31
|
-
- bundle exec
|
23
|
+
- bundle exec rspec
|
24
|
+
- bundle exec rubocop
|
25
|
+
- bundle exec todo_lint
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
## Unreleased
|
4
|
+
|
5
|
+
(nothing yet)
|
6
|
+
|
7
|
+
* * *
|
8
|
+
|
9
|
+
## 2.0.0
|
10
|
+
|
11
|
+
### changes
|
12
|
+
|
13
|
+
* remove support for rdio (which no longer exists)
|
14
|
+
* uri method is now private
|
15
|
+
|
16
|
+
### Fixes
|
17
|
+
|
18
|
+
* Fixed a broken link in the README.md
|
19
|
+
* Fix instagram api (again)
|
20
|
+
|
3
21
|
## 1.0.1 (2015-11-14)
|
4
22
|
|
5
23
|
### New features
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# film_snob
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.org/maxjacobson/film_snob.svg?branch=
|
3
|
+
[![Build Status](https://travis-ci.org/maxjacobson/film_snob.svg?branch=edge)](https://travis-ci.org/maxjacobson/film_snob)
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/film_snob.svg)](http://badge.fury.io/rb/film_snob)
|
5
5
|
[![Code Climate](https://codeclimate.com/github/maxjacobson/film_snob.png)](https://codeclimate.com/github/maxjacobson/film_snob)
|
6
6
|
[![Test Coverage](https://codeclimate.com/github/maxjacobson/film_snob/badges/coverage.svg)](https://codeclimate.com/github/maxjacobson/film_snob)
|
@@ -76,7 +76,6 @@ film.html #=> "<iframe width=\"480\" height=\"270\" src=\"https://www.youtube.co
|
|
76
76
|
* Vine
|
77
77
|
* Rutube
|
78
78
|
* Soundcloud
|
79
|
-
* Rdio
|
80
79
|
|
81
80
|
The same methods work with all of these providers.
|
82
81
|
|
@@ -107,7 +106,7 @@ Ping me in [the Gitter chat room](https://gitter.im/maxjacobson/film_snob) or
|
|
107
106
|
## Contributing
|
108
107
|
|
109
108
|
Bug reports and pull requests are welcome on GitHub at
|
110
|
-
<https://github.com/maxjacobson/
|
109
|
+
<https://github.com/maxjacobson/film_snob>. This project is intended to be a
|
111
110
|
safe, welcoming space for collaboration, and contributors are expected to
|
112
111
|
adhere to the [Contributor Covenant](http://contributor-covenant.org) code of
|
113
112
|
conduct.
|
data/Rakefile
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
-
require "
|
3
|
-
require "rubocop/rake_task"
|
4
|
-
require "todo_lint"
|
2
|
+
require "yaml"
|
5
3
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
task :continuous_integration do
|
5
|
+
YAML.load(File.read("./.travis.yml")).fetch("script").shuffle.each do |cmd|
|
6
|
+
next if system cmd
|
7
|
+
puts "\nFailed: #{cmd.inspect}"
|
8
|
+
exit 1
|
9
|
+
end
|
11
10
|
end
|
12
11
|
|
13
|
-
task :
|
14
|
-
task :default => :ci
|
12
|
+
task :default => [:continuous_integration]
|
data/{Gemfile → gems.rb}
RENAMED
data/lib/film_snob.rb
CHANGED
@@ -19,31 +19,38 @@ class FilmSnob
|
|
19
19
|
@site ||= self.class.to_s.split("::").last.downcase.to_sym
|
20
20
|
end
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
class << self
|
23
|
+
def inherited(base)
|
24
|
+
subclasses << base
|
25
|
+
end
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
def valid_url_patterns
|
28
|
+
[]
|
29
|
+
end
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
def oembed_endpoint
|
32
|
+
""
|
33
|
+
end
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
def http
|
36
|
+
Net::HTTP.new(uri.host, uri.port).tap do |uri|
|
37
|
+
uri.use_ssl = use_ssl?
|
38
|
+
end
|
39
|
+
end
|
38
40
|
|
39
|
-
|
40
|
-
|
41
|
-
uri.use_ssl = use_ssl?
|
41
|
+
def use_ssl?
|
42
|
+
"https" == uri.scheme
|
42
43
|
end
|
43
|
-
end
|
44
44
|
|
45
|
-
|
46
|
-
|
45
|
+
def subclasses
|
46
|
+
@subclasses ||= []
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def uri
|
52
|
+
URI.parse(oembed_endpoint)
|
53
|
+
end
|
47
54
|
end
|
48
55
|
|
49
56
|
def title
|
@@ -60,10 +67,6 @@ class FilmSnob
|
|
60
67
|
raise NotEmbeddableError, "#{clean_url} is not embeddable"
|
61
68
|
end
|
62
69
|
|
63
|
-
def self.uri
|
64
|
-
URI.parse(oembed_endpoint)
|
65
|
-
end
|
66
|
-
|
67
70
|
def lookup(attribute)
|
68
71
|
oembed[attribute.to_s] || not_embeddable!
|
69
72
|
end
|
data/lib/film_snob/version.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
describe FilmSnob::Vine do
|
2
2
|
it "should parse URLs" do
|
3
|
-
film = FilmSnob.new("https://vine.co/v/
|
4
|
-
expect(film.id).to eq "
|
3
|
+
film = FilmSnob.new("https://vine.co/v/OMqDr7r0bKI")
|
4
|
+
expect(film.id).to eq "OMqDr7r0bKI"
|
5
5
|
expect(film.site).to eq :vine
|
6
|
-
VCR.use_cassette "vine/
|
7
|
-
expect(film.title).to eq "
|
6
|
+
VCR.use_cassette "vine/barbie" do
|
7
|
+
expect(film.title).to eq "BarbieQ 🙅🔥🔥 #suicidefairy"
|
8
8
|
expect { film.html }.not_to raise_error
|
9
9
|
end
|
10
10
|
end
|
@@ -54,12 +54,12 @@ describe FilmSnob::YouTube do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
it "can handle junked up URLs" do
|
57
|
-
VCR.use_cassette("youtube/
|
58
|
-
url = "http://www.youtube.com/watch?feature=youtube_gdata&v=
|
59
|
-
title = "
|
57
|
+
VCR.use_cassette("youtube/oliver") do
|
58
|
+
url = "http://www.youtube.com/watch?feature=youtube_gdata&v=vU8dCYocuyI"
|
59
|
+
title = "Last Week Tonight with John Oliver: Border Wall (HBO)"
|
60
60
|
film = FilmSnob.new(url)
|
61
61
|
expect(film).to be_embeddable
|
62
|
-
expect(film.id).to eq "
|
62
|
+
expect(film.id).to eq "vU8dCYocuyI"
|
63
63
|
expect { film.html }.to_not raise_error
|
64
64
|
expect(film.title).to eq title
|
65
65
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: film_snob
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max Jacobson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -39,12 +39,12 @@ files:
|
|
39
39
|
- ".travis.yml"
|
40
40
|
- CHANGELOG.md
|
41
41
|
- CODE_OF_CONDUCT.md
|
42
|
-
- Gemfile
|
43
42
|
- Guardfile
|
44
43
|
- LICENSE.txt
|
45
44
|
- README.md
|
46
45
|
- Rakefile
|
47
46
|
- film_snob.gemspec
|
47
|
+
- gems.rb
|
48
48
|
- lib/film_snob.rb
|
49
49
|
- lib/film_snob/exceptions.rb
|
50
50
|
- lib/film_snob/oembed_provider.rb
|
@@ -53,7 +53,6 @@ files:
|
|
53
53
|
- lib/film_snob/oembed_providers/funny_or_die.rb
|
54
54
|
- lib/film_snob/oembed_providers/hulu.rb
|
55
55
|
- lib/film_snob/oembed_providers/instagram.rb
|
56
|
-
- lib/film_snob/oembed_providers/rdio.rb
|
57
56
|
- lib/film_snob/oembed_providers/rutube.rb
|
58
57
|
- lib/film_snob/oembed_providers/soundcloud.rb
|
59
58
|
- lib/film_snob/oembed_providers/vimeo.rb
|
@@ -68,7 +67,6 @@ files:
|
|
68
67
|
- spec/film_snob/oembed_providers/funny_or_die_spec.rb
|
69
68
|
- spec/film_snob/oembed_providers/hulu_spec.rb
|
70
69
|
- spec/film_snob/oembed_providers/instagram_spec.rb
|
71
|
-
- spec/film_snob/oembed_providers/rdio_spec.rb
|
72
70
|
- spec/film_snob/oembed_providers/rutube_spec.rb
|
73
71
|
- spec/film_snob/oembed_providers/soundcloud_spec.rb
|
74
72
|
- spec/film_snob/oembed_providers/vimeo_spec.rb
|
@@ -96,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
94
|
version: '0'
|
97
95
|
requirements: []
|
98
96
|
rubyforge_project:
|
99
|
-
rubygems_version: 2.5.
|
97
|
+
rubygems_version: 2.5.1
|
100
98
|
signing_key:
|
101
99
|
specification_version: 4
|
102
100
|
summary: Fetch data from oEmbed APIs
|
@@ -108,7 +106,6 @@ test_files:
|
|
108
106
|
- spec/film_snob/oembed_providers/funny_or_die_spec.rb
|
109
107
|
- spec/film_snob/oembed_providers/hulu_spec.rb
|
110
108
|
- spec/film_snob/oembed_providers/instagram_spec.rb
|
111
|
-
- spec/film_snob/oembed_providers/rdio_spec.rb
|
112
109
|
- spec/film_snob/oembed_providers/rutube_spec.rb
|
113
110
|
- spec/film_snob/oembed_providers/soundcloud_spec.rb
|
114
111
|
- spec/film_snob/oembed_providers/vimeo_spec.rb
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require "film_snob/oembed_provider"
|
2
|
-
|
3
|
-
class FilmSnob
|
4
|
-
class Rdio < OembedProvider
|
5
|
-
def self.valid_url_patterns
|
6
|
-
[
|
7
|
-
%r{http?://www.rdio.com/artist/(?:[\w\d\-_]+/album/)}
|
8
|
-
]
|
9
|
-
end
|
10
|
-
|
11
|
-
# in this case, we're trusting Rdio to clean up the URL
|
12
|
-
def clean_url
|
13
|
-
@clean_url = url
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.oembed_endpoint
|
17
|
-
"http://www.rdio.com/api/oembed/"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
describe FilmSnob::Rdio do
|
2
|
-
describe "rdio URLs" do
|
3
|
-
let(:url) { "http://www.rdio.com/#{path}" }
|
4
|
-
|
5
|
-
context "when the URL is an album" do
|
6
|
-
let(:path) { "artist/Sam_Smith/album/In_The_Lonely_Hour/" }
|
7
|
-
|
8
|
-
it "should parse" do
|
9
|
-
snob = FilmSnob.new(url)
|
10
|
-
expect(snob).to be_embeddable
|
11
|
-
expect(snob.site).to eq :rdio
|
12
|
-
VCR.use_cassette("rdio/in the lonely hour") do
|
13
|
-
expect(snob.title).to eq "In The Lonely Hour"
|
14
|
-
expect(snob.html).to include "iframe"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
context "a song" do
|
20
|
-
let(:path) do
|
21
|
-
"artist/Sam_Smith/album/In_The_Lonely_Hour/track/Stay_With_Me"
|
22
|
-
end
|
23
|
-
it "should parse normal track rdio URLs" do
|
24
|
-
snob = FilmSnob.new(url)
|
25
|
-
expect(snob).to be_embeddable
|
26
|
-
expect(snob.site).to eq :rdio
|
27
|
-
VCR.use_cassette("rdio/stay with me") do
|
28
|
-
expect(snob.title).to eq "Stay With Me"
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should not allow weak matches for rdio urls" do
|
34
|
-
snob = FilmSnob.new("google.com/q=rdio")
|
35
|
-
expect(snob).to_not be_embeddable
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|