ruby-oembed 0.7.5 → 0.7.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +1 -1
- data/CHANGELOG.md +29 -0
- data/Gemfile.lock +1 -1
- data/LICENSE +19 -0
- data/README.md +18 -4
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/lib/oembed/providers.rb +1 -0
- data/ruby-oembed.gemspec +9 -7
- metadata +10 -7
- data/idea.rb +0 -59
data/.rvmrc
CHANGED
@@ -1 +1 @@
|
|
1
|
-
rvm
|
1
|
+
rvm default@oembed
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# CHANGELOG
|
2
|
+
|
3
|
+
## 0.7.6 - 11 October 2010
|
4
|
+
|
5
|
+
* Released all recent changes to judofyr/master on GitHub. (Marcos Wright Kuhns)
|
6
|
+
* Added CHANGELOG & LICENSE information. (Marcos Wright Kuhns)
|
7
|
+
|
8
|
+
## 0.7.5 - 29 September 2010
|
9
|
+
|
10
|
+
* Updated the list of [Embedly][embedly] URL schemes. (Aris Bartee)
|
11
|
+
* [rvmrc file](http://rvm.beginrescueend.com/workflow/rvmrc/) added. (Aris Bartee)
|
12
|
+
|
13
|
+
## 0.7.0 - 23 August 2010
|
14
|
+
|
15
|
+
* Gemified. (Aris Bartee)
|
16
|
+
* Added the [Embedly][embedly] Provider. (Alex Kessinger)
|
17
|
+
* OEmbed::Response now includes the original request url. (Colin Shea)
|
18
|
+
* Unregistering providers with duplicate URL patterns works. (Marcos Wright Kuhns)
|
19
|
+
|
20
|
+
## 0.0.0 - May 2008 - July 2010
|
21
|
+
|
22
|
+
* Initial work & release as a library (Magnus Holm, et al.)
|
23
|
+
* Many Providers supported, including [OohEmbed][oohembed].
|
24
|
+
* Support for JSON (via the json gem) and XML (via the xml-simple gem).
|
25
|
+
|
26
|
+
[ruby-oembed]: http://github.com/judofyr/ruby-oembed "The ruby-oembed Library"
|
27
|
+
[oembed]: http://oembed.com "The oEmbed protocol"
|
28
|
+
[oohembed]: http://oohembed.com
|
29
|
+
[embedly]: http://embed.ly
|
data/Gemfile.lock
CHANGED
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2010 Magnus Holm, et al.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -6,21 +6,22 @@ An oEmbed client written in Ruby, letting you easily get embeddable HTML represe
|
|
6
6
|
|
7
7
|
gem install ruby-oembed
|
8
8
|
|
9
|
-
#
|
9
|
+
# Get Started
|
10
10
|
|
11
|
-
|
11
|
+
You get embedable resources via an OEmbed::Provider. This gem comes with many Providers built right in, to make your life easy.
|
12
12
|
|
13
13
|
resource = OEmbed::Providers::YouTube.get("http://www.youtube.com/watch?v=2BYXBC8WQ5k")
|
14
14
|
resource.video? #=> true
|
15
15
|
resource.thumbnail_url #=> "http://i3.ytimg.com/vi/2BYXBC8WQ5k/hqdefault.jpg"
|
16
16
|
resource.html #=> '<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/2BYXBC8WQ5k?fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/2BYXBC8WQ5k?fs=1" type="application/x-shockwave-flash" width="425" height="344" allowscriptaccess="always" allowfullscreen="true"></embed></object>'
|
17
17
|
|
18
|
-
If you'd like to use a provider that isn't included in the library, it's easy to add one
|
18
|
+
If you'd like to use a provider that isn't included in the library, it's easy to add one. Just provide the oEmbed API endpoint and URL scheme(s).
|
19
19
|
|
20
20
|
my_provider = OEmbed::Provider.new("http://my.cool-service.com/api/oembed_endpoint.{format}"
|
21
21
|
my_provider << "http://*.cool-service.com/image/*"
|
22
22
|
my_provider << "http://*.cool-service.com/video/*"
|
23
23
|
resource = my_provider.get("http://a.cool-service.com/video/1") #=> OEmbed::Response
|
24
|
+
resource.provider.name #=> "My Cool Service"
|
24
25
|
|
25
26
|
To use multiple Providers at once, simply register them.
|
26
27
|
|
@@ -31,6 +32,19 @@ To use multiple Providers at once, simply register them.
|
|
31
32
|
|
32
33
|
Last but not least, ruby-oembed supports both [oohEmbed][oohembed] and [Embedly][embedly]. These services are provider aggregators. Each supports a wide array of websites ranging from [Amazon.com](http://www.amazon.com) to [xkcd](http://www.xkcd.com).
|
33
34
|
|
34
|
-
|
35
|
+
# Lend a Hand
|
36
|
+
|
37
|
+
Code for the ruby-oembed library is [hosted on GitHub][ruby-oembed].
|
38
|
+
|
39
|
+
If you encounter any bug, feel free to [Create an Issue](http://github.com/judofyr/ruby-oembed/issues).
|
40
|
+
|
41
|
+
To submit a patch, please [fork](http://help.github.com/forking/) the library and commit your changes along with relevant tests. Once you're happy with the changes, [send a pull request](http://help.github.com/pull-requests/).
|
42
|
+
|
43
|
+
# License
|
44
|
+
|
45
|
+
This code is free to use under the terms of the MIT license.
|
46
|
+
|
47
|
+
[ruby-oembed]: http://github.com/judofyr/ruby-oembed "The ruby-oembed Library"
|
48
|
+
[oembed]: http://oembed.com "The oEmbed protocol"
|
35
49
|
[oohembed]: http://oohembed.com
|
36
50
|
[embedly]: http://embed.ly
|
data/Rakefile
CHANGED
@@ -3,10 +3,10 @@ begin
|
|
3
3
|
Jeweler::Tasks.new do |gemspec|
|
4
4
|
gemspec.name = "ruby-oembed"
|
5
5
|
gemspec.summary = "oEmbed for Ruby"
|
6
|
-
gemspec.description = "
|
6
|
+
gemspec.description = "An oEmbed client written in Ruby, letting you easily get embeddable HTML representations of a supported web pages, based on their URLs. See http://oembed.com for more about the protocol."
|
7
7
|
gemspec.email = "arisbartee@gmail.com"
|
8
|
-
gemspec.homepage = "http://github.com/
|
9
|
-
gemspec.authors = ["Magnus Holm","Alex Kessinger","Aris Bartee"]
|
8
|
+
gemspec.homepage = "http://github.com/judofyr/ruby-oembed"
|
9
|
+
gemspec.authors = ["Magnus Holm","Alex Kessinger","Aris Bartee","Marcos Wright Kuhns"]
|
10
10
|
gemspec.add_dependency("json")
|
11
11
|
gemspec.add_dependency("xml-simple")
|
12
12
|
gemspec.add_development_dependency("rspec")
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.6
|
data/lib/oembed/providers.rb
CHANGED
@@ -85,6 +85,7 @@ module OEmbed
|
|
85
85
|
# Custom providers:
|
86
86
|
Youtube = OEmbed::Provider.new("http://www.youtube.com/oembed")
|
87
87
|
Youtube << "http://*.youtube.com/*"
|
88
|
+
Youtube << "http://*.youtu.be/*"
|
88
89
|
|
89
90
|
Flickr = OEmbed::Provider.new("http://www.flickr.com/services/oembed/")
|
90
91
|
Flickr << "http://*.flickr.com/*"
|
data/ruby-oembed.gemspec
CHANGED
@@ -5,25 +5,27 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ruby-oembed}
|
8
|
-
s.version = "0.7.
|
8
|
+
s.version = "0.7.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Magnus Holm", "Alex Kessinger", "Aris Bartee"]
|
12
|
-
s.date = %q{2010-
|
13
|
-
s.description = %q{
|
11
|
+
s.authors = ["Magnus Holm", "Alex Kessinger", "Aris Bartee", "Marcos Wright Kuhns"]
|
12
|
+
s.date = %q{2010-10-14}
|
13
|
+
s.description = %q{An oEmbed client written in Ruby, letting you easily get embeddable HTML representations of a supported web pages, based on their URLs. See http://oembed.com for more about the protocol.}
|
14
14
|
s.email = %q{arisbartee@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
|
-
"
|
16
|
+
"LICENSE",
|
17
|
+
"README.md"
|
17
18
|
]
|
18
19
|
s.files = [
|
19
20
|
".gitignore",
|
20
21
|
".rvmrc",
|
22
|
+
"CHANGELOG.md",
|
21
23
|
"Gemfile",
|
22
24
|
"Gemfile.lock",
|
25
|
+
"LICENSE",
|
23
26
|
"README.md",
|
24
27
|
"Rakefile",
|
25
28
|
"VERSION",
|
26
|
-
"idea.rb",
|
27
29
|
"integration_test/test.rb",
|
28
30
|
"integration_test/test_urls.csv",
|
29
31
|
"lib/oembed.rb",
|
@@ -45,7 +47,7 @@ Gem::Specification.new do |s|
|
|
45
47
|
"spec/response_spec.rb",
|
46
48
|
"spec/spec_helper.rb"
|
47
49
|
]
|
48
|
-
s.homepage = %q{http://github.com/
|
50
|
+
s.homepage = %q{http://github.com/judofyr/ruby-oembed}
|
49
51
|
s.rdoc_options = ["--charset=UTF-8"]
|
50
52
|
s.require_paths = ["lib"]
|
51
53
|
s.rubygems_version = %q{1.3.7}
|
metadata
CHANGED
@@ -1,23 +1,24 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-oembed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 7
|
9
|
-
-
|
10
|
-
version: 0.7.
|
9
|
+
- 6
|
10
|
+
version: 0.7.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Magnus Holm
|
14
14
|
- Alex Kessinger
|
15
15
|
- Aris Bartee
|
16
|
+
- Marcos Wright Kuhns
|
16
17
|
autorequire:
|
17
18
|
bindir: bin
|
18
19
|
cert_chain: []
|
19
20
|
|
20
|
-
date: 2010-
|
21
|
+
date: 2010-10-14 00:00:00 -05:00
|
21
22
|
default_executable:
|
22
23
|
dependencies:
|
23
24
|
- !ruby/object:Gem::Dependency
|
@@ -62,23 +63,25 @@ dependencies:
|
|
62
63
|
version: "0"
|
63
64
|
type: :development
|
64
65
|
version_requirements: *id003
|
65
|
-
description:
|
66
|
+
description: An oEmbed client written in Ruby, letting you easily get embeddable HTML representations of a supported web pages, based on their URLs. See http://oembed.com for more about the protocol.
|
66
67
|
email: arisbartee@gmail.com
|
67
68
|
executables: []
|
68
69
|
|
69
70
|
extensions: []
|
70
71
|
|
71
72
|
extra_rdoc_files:
|
73
|
+
- LICENSE
|
72
74
|
- README.md
|
73
75
|
files:
|
74
76
|
- .gitignore
|
75
77
|
- .rvmrc
|
78
|
+
- CHANGELOG.md
|
76
79
|
- Gemfile
|
77
80
|
- Gemfile.lock
|
81
|
+
- LICENSE
|
78
82
|
- README.md
|
79
83
|
- Rakefile
|
80
84
|
- VERSION
|
81
|
-
- idea.rb
|
82
85
|
- integration_test/test.rb
|
83
86
|
- integration_test/test_urls.csv
|
84
87
|
- lib/oembed.rb
|
@@ -100,7 +103,7 @@ files:
|
|
100
103
|
- spec/response_spec.rb
|
101
104
|
- spec/spec_helper.rb
|
102
105
|
has_rdoc: true
|
103
|
-
homepage: http://github.com/
|
106
|
+
homepage: http://github.com/judofyr/ruby-oembed
|
104
107
|
licenses: []
|
105
108
|
|
106
109
|
post_install_message:
|
data/idea.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
require "rubygems"
|
2
|
-
require "lib/oembed"
|
3
|
-
# Adding providers:
|
4
|
-
# The second argument defines the default format
|
5
|
-
flickr = OEmbed::Provider.new("http://www.flickr.com/services/oembed/", :xml)
|
6
|
-
flickr << "http://*.flickr.com/*"
|
7
|
-
# Optional settings:
|
8
|
-
flickr.name = "Flickr"
|
9
|
-
flickr.url = "http://flickr.com/"
|
10
|
-
|
11
|
-
# Another one:
|
12
|
-
# The default format is json
|
13
|
-
qik = OEmbed::Provider.new("http://qik.com/api/oembed.{format}")
|
14
|
-
qik << "http://qik.com/*"
|
15
|
-
|
16
|
-
# Get a raw XML-file from Flickrr
|
17
|
-
flickr.raw("http://www.flickr.com/photos/varius/4537325286/")
|
18
|
-
|
19
|
-
# Get a raw JSON-file from Flickr
|
20
|
-
flickr.raw("http://www.flickr.com/photos/varius/4537325286/", :format => :json)
|
21
|
-
|
22
|
-
|
23
|
-
OEmbed::Providers.register_fallback(OEmbed::ProviderDiscovery, OEmbed::Providers::Embedly, OEmbed::Providers::OohEmbed)
|
24
|
-
#Testing embedly
|
25
|
-
|
26
|
-
# Register both providers
|
27
|
-
OEmbed::Providers.register_all()
|
28
|
-
|
29
|
-
# Get a raw XML-file from whichever provider matches
|
30
|
-
res = OEmbed::Providers.raw("http://www.escapistmagazine.com/videos/view/apocalypse-lane/1687-Episode-47-Dirty-Rotten-Cyborgs", :format => :xml)
|
31
|
-
puts res
|
32
|
-
|
33
|
-
res = OEmbed::Providers.raw("http://www.ustream.tv/recorded/6724045/highlight/72611#utm_campaign=fhighlights&utm_source=2&utm_medium=music", :format => :json)
|
34
|
-
puts res
|
35
|
-
|
36
|
-
res = OEmbed::Providers.raw("http://www.thedailyshow.com/collection/271554/steve-carell-s-best-daily-show-returns/269838", :format => :json)
|
37
|
-
puts res
|
38
|
-
|
39
|
-
|
40
|
-
begin
|
41
|
-
res = OEmbed::Providers.raw("http://www.example.com", :format => :json)
|
42
|
-
rescue OEmbed::NotFound
|
43
|
-
puts "not a supported url"
|
44
|
-
end
|
45
|
-
|
46
|
-
|
47
|
-
# Returns a OEmbed::Response using XmlSimple library to parse the response
|
48
|
-
res = flickr.get("http://www.flickr.com/photos/varius/4537325286/", :format => :xml)
|
49
|
-
# Returns a OEmbed::Response using the JSON library to parse the response
|
50
|
-
res = flickr.get("http://www.flickr.com/photos/varius/4537325286/", :format => :json)
|
51
|
-
|
52
|
-
puts res.is_a?(OEmbed::Response) # => true
|
53
|
-
puts res.type # => "photo"
|
54
|
-
puts res.version # => "1.0"
|
55
|
-
puts res.html # => "<img src='http://farm1.static.flickr.com/2312/3123123_123123.jpg' />"
|
56
|
-
puts res.author_name # => "my_user"
|
57
|
-
puts res.author_url # => "http://flickr.com/photos/my_user"
|
58
|
-
puts res.provider.url # => "http://flickr.com/"
|
59
|
-
puts res.provider.name # => "Flickr"
|