thornbed 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +3 -0
- data/lib/thornbed/provider.rb +1 -1
- data/lib/thornbed/providers/imgur.rb +1 -5
- data/lib/thornbed/providers/quickmeme.rb +0 -1
- data/lib/thornbed/providers.rb +1 -6
- data/lib/thornbed/version.rb +1 -1
- data/lib/thornbed.rb +1 -3
- data/spec/providers/imgur_spec.rb +2 -2
- data/spec/providers/quickmeme_spec.rb +2 -4
- data/spec/spec_helper.rb +1 -1
- data/spec/thornbed_spec.rb +0 -10
- metadata +3 -2
data/.travis.yml
ADDED
data/lib/thornbed/provider.rb
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
require "uri"
|
2
2
|
require "thornbed"
|
3
3
|
|
4
|
-
|
5
4
|
module Thornbed::Providers
|
6
5
|
class Imgur < Thornbed::Providers::Provider
|
7
|
-
|
8
6
|
def initialize
|
9
7
|
@pattern = /^http(s)?:\/\/((i\.)|(www\.))?imgur.com\/(gallery\/)?(\w){5}(s|l|b|m|t)?(\.gif|\.jpg|.jpeg|\.png)?(\?full)?$/
|
10
8
|
@type = "photo"
|
@@ -43,7 +41,5 @@ module Thornbed::Providers
|
|
43
41
|
height: nil
|
44
42
|
}
|
45
43
|
end
|
46
|
-
|
47
|
-
|
48
44
|
end
|
49
|
-
end
|
45
|
+
end
|
data/lib/thornbed/providers.rb
CHANGED
@@ -1,6 +1 @@
|
|
1
|
-
require
|
2
|
-
providers = File.join(File.dirname(__FILE__), 'providers')
|
3
|
-
Dir["#{providers}/*.rb"].each do |name|
|
4
|
-
basename = Pathname.new(name).basename.to_s
|
5
|
-
require "thornbed/providers/#{basename}"
|
6
|
-
end
|
1
|
+
Dir[ File.dirname(__FILE__) + '/providers/*.rb' ].each { |file| require file }
|
data/lib/thornbed/version.rb
CHANGED
data/lib/thornbed.rb
CHANGED
@@ -4,7 +4,6 @@ require "thornbed/provider"
|
|
4
4
|
require "thornbed/providers"
|
5
5
|
require "thornbed/errors"
|
6
6
|
|
7
|
-
|
8
7
|
OEmbed::Providers.register_all
|
9
8
|
|
10
9
|
module Thornbed
|
@@ -15,6 +14,5 @@ module Thornbed
|
|
15
14
|
rescue OEmbed::NotFound
|
16
15
|
res = Thornbed::Providers.get(url)
|
17
16
|
end
|
18
|
-
|
19
17
|
end
|
20
|
-
end
|
18
|
+
end
|
@@ -4,7 +4,7 @@ require "thornbed"
|
|
4
4
|
|
5
5
|
describe "Imgur" do
|
6
6
|
it "should have Imgur as a provider" do
|
7
|
-
Thornbed::Providers.constants.include
|
7
|
+
Thornbed::Providers.constants.should include(:Imgur)
|
8
8
|
end
|
9
9
|
|
10
10
|
it "should accept different imgur urls" do
|
@@ -66,4 +66,4 @@ describe "Imgur" do
|
|
66
66
|
res.should include(url: 'http://i.imgur.com/N2IDN.jpg')
|
67
67
|
res.should include(provider_name: "Imgur")
|
68
68
|
end
|
69
|
-
end
|
69
|
+
end
|
@@ -1,10 +1,8 @@
|
|
1
1
|
require "spec_helper"
|
2
|
-
require "fakeweb"
|
3
|
-
require "thornbed"
|
4
2
|
|
5
3
|
describe "QuickMeme" do
|
6
4
|
it "should have QuickMeme as a provider" do
|
7
|
-
Thornbed::Providers.constants.include
|
5
|
+
Thornbed::Providers.constants.should include(:QuickMeme)
|
8
6
|
end
|
9
7
|
|
10
8
|
it "should accept different quickmeme urls" do
|
@@ -66,4 +64,4 @@ describe "QuickMeme" do
|
|
66
64
|
res.should include(url: 'http://i.qkme.me/353dum.jpg')
|
67
65
|
res.should include(provider_name: "QuickMeme")
|
68
66
|
end
|
69
|
-
end
|
67
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -5,9 +5,9 @@
|
|
5
5
|
#
|
6
6
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
7
|
require "bundler/setup"
|
8
|
+
require "fakeweb"
|
8
9
|
require "thornbed"
|
9
10
|
|
10
|
-
|
11
11
|
RSpec.configure do |config|
|
12
12
|
config.treat_symbols_as_metadata_keys_with_true_values = true
|
13
13
|
config.run_all_when_everything_filtered = true
|
data/spec/thornbed_spec.rb
CHANGED
@@ -1,13 +1,6 @@
|
|
1
1
|
require "spec_helper"
|
2
|
-
require "fakeweb"
|
3
|
-
require "thornbed"
|
4
2
|
|
5
3
|
describe Thornbed do
|
6
|
-
|
7
|
-
it "should have a VERSION constant" do
|
8
|
-
subject.const_get('VERSION').should_not be_empty
|
9
|
-
end
|
10
|
-
|
11
4
|
it "should rely on ruby-oembed when querying for a oembed provider" do
|
12
5
|
good_response = {
|
13
6
|
"provider_url"=>"http://www.youtube.com/",
|
@@ -36,7 +29,4 @@ describe Thornbed do
|
|
36
29
|
imgur = Thornbed::Providers::Imgur.new
|
37
30
|
lambda { imgur.get('http://imgur.com/none.jpg') }.should raise_error(Thornbed::NotValid)
|
38
31
|
end
|
39
|
-
|
40
|
-
|
41
|
-
|
42
32
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thornbed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ruby-oembed
|
@@ -115,6 +115,7 @@ extensions: []
|
|
115
115
|
extra_rdoc_files: []
|
116
116
|
files:
|
117
117
|
- .gitignore
|
118
|
+
- .travis.yml
|
118
119
|
- Gemfile
|
119
120
|
- Guardfile
|
120
121
|
- LICENSE.txt
|