film_snob 1.0.1 → 2.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4cc5c14306b0c0572e501a6da1ad9e5e9dd965e2
4
- data.tar.gz: 8da534f23aad778b36c59fc7e040e50764b256fd
3
+ metadata.gz: e78e11fa0a69ae6d0f1cae151f3df7078e92b6c5
4
+ data.tar.gz: dd1ac5931f67399f2ecb809eae9b9f85d51995bd
5
5
  SHA512:
6
- metadata.gz: 5afd834f6f97838e86809620efbc849596befbd4e2207804553c802ee19d87dcec2a216832414e7076e5214a27cc68a3bbf0a73c99722a31848ff1a72ca3f9ca
7
- data.tar.gz: 84212d36c8c0026c24523e2d2cfe4e3dd7b930e0367c0254edbc2dab91e0e942ec9be8a42944bb12c3b5af2b284dac9fa0885b1581deeb1e4ef4ebbda0f1d434
6
+ metadata.gz: 1eac1d39804a8d5f88bdc23a1a4facaddd60da92e6b40a21a37f08f5e53f3d5aa4a13a0452a791bcbfdaa20a64b0e11551c4bbea618e98966c7f523ded569a74
7
+ data.tar.gz: d32bf53b9fe35be239c4d384ae1c7cd66517621efbd8d757996de6511fd941a1557381005237cf593ec1e1a4fb0d940a40d27a82063abf9843df41d3a829d110
data/.gitignore CHANGED
@@ -8,7 +8,7 @@
8
8
  .yardoc
9
9
  /*.bundle
10
10
  /.ruby-version
11
- /Gemfile.lock
11
+ /gems.locked
12
12
  /coverage
13
13
  /doc/
14
14
  /lib/bundler/man
data/.rspec CHANGED
@@ -1,3 +1 @@
1
- --color
2
1
  --require spec_helper
3
- --format documentation
@@ -3,18 +3,9 @@ cache: bundler
3
3
  language: ruby
4
4
  rvm:
5
5
  - 2.0.0
6
- - 2.1.0
7
- - 2.1.1
8
- - 2.1.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 rake ci
23
+ - bundle exec rspec
24
+ - bundle exec rubocop
25
+ - bundle exec todo_lint
@@ -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=master)](https://travis-ci.org/maxjacobson/film_snob)
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/smashcut>. This project is intended to be a
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 "rspec/core/rake_task"
3
- require "rubocop/rake_task"
4
- require "todo_lint"
2
+ require "yaml"
5
3
 
6
- RSpec::Core::RakeTask.new(:spec)
7
- RuboCop::RakeTask.new(:style)
8
-
9
- task :todos do
10
- TodoLint::Cli.new([]).run!
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 :ci => [:spec, :style, :todos]
14
- task :default => :ci
12
+ task :default => [:continuous_integration]
@@ -3,7 +3,7 @@ source "https://rubygems.org"
3
3
  gem "rake", "~> 10.4"
4
4
 
5
5
  gem "pry", "~> 0.10"
6
- gem "rubocop", "~> 0.35"
6
+ gem "rubocop", "~> 0.39"
7
7
  gem "todo_lint", "~> 0.2"
8
8
  gem "rspec", "~> 3.4"
9
9
  gem "webmock", "~> 1.22"
@@ -6,7 +6,7 @@ require "film_snob/exceptions"
6
6
  class FilmSnob
7
7
  extend Forwardable
8
8
 
9
- MEDIA_METHODS = [:site, :id, :clean_url, :title, :html]
9
+ MEDIA_METHODS = [:site, :id, :clean_url, :title, :html].freeze
10
10
 
11
11
  def_delegators :media, *MEDIA_METHODS
12
12
 
@@ -19,31 +19,38 @@ class FilmSnob
19
19
  @site ||= self.class.to_s.split("::").last.downcase.to_sym
20
20
  end
21
21
 
22
- SUBCLASSES = []
23
- def self.inherited(base)
24
- SUBCLASSES << base
25
- end
22
+ class << self
23
+ def inherited(base)
24
+ subclasses << base
25
+ end
26
26
 
27
- def self.subclasses
28
- SUBCLASSES
29
- end
27
+ def valid_url_patterns
28
+ []
29
+ end
30
30
 
31
- def self.valid_url_patterns
32
- []
33
- end
31
+ def oembed_endpoint
32
+ ""
33
+ end
34
34
 
35
- def self.oembed_endpoint
36
- ""
37
- end
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
- def self.http
40
- Net::HTTP.new(uri.host, uri.port).tap do |uri|
41
- uri.use_ssl = use_ssl?
41
+ def use_ssl?
42
+ "https" == uri.scheme
42
43
  end
43
- end
44
44
 
45
- def self.use_ssl?
46
- "https" == uri.scheme
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
@@ -10,7 +10,7 @@ class FilmSnob
10
10
  end
11
11
 
12
12
  def self.oembed_endpoint
13
- "http://instagram.com/publicapi/oembed/"
13
+ "https://api.instagram.com/oembed/"
14
14
  end
15
15
 
16
16
  def clean_url
@@ -1,3 +1,3 @@
1
1
  class FilmSnob
2
- VERSION = "1.0.1"
2
+ VERSION = "2.0.0".freeze
3
3
  end
@@ -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/1")
4
- expect(film.id).to eq "1"
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/dom hofman" do
7
- expect(film.title).to eq "Dom Hofmann's post on Vine"
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/pete") do
58
- url = "http://www.youtube.com/watch?feature=youtube_gdata&v=fq-xGD_thXo"
59
- title = "Pete Meets Olympic Freestyle Skier Torin Yater-Wallace"
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 "fq-xGD_thXo"
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: 1.0.1
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: 2015-11-15 00:00:00.000000000 Z
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.0
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