ruby-oembed 0.10.0 → 0.13.1
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 +5 -5
- data/.coveralls.yml +1 -0
- data/.gitignore +11 -2
- data/.travis.yml +3 -6
- data/CHANGELOG.rdoc +35 -0
- data/Gemfile +12 -10
- data/README.md +118 -0
- data/Rakefile +2 -0
- data/lib/oembed/providers.rb +56 -5
- data/lib/oembed/providers/embedly_urls.yml +1000 -133
- data/lib/oembed/providers/noembed_urls.yml +321 -0
- data/lib/oembed/version.rb +3 -3
- data/lib/tasks/oembed.rake +24 -23
- data/ruby-oembed.gemspec +5 -33
- data/spec/cassettes/OEmbed_Provider.yml +882 -119
- data/spec/cassettes/OEmbed_ProviderDiscovery.yml +26007 -35598
- data/spec/cassettes/OEmbed_Providers_Slideshare.yml +1433 -0
- data/spec/cassettes/OEmbed_Providers_Twitter.yml +612 -0
- data/spec/provider_discovery_spec.rb +3 -15
- data/spec/provider_spec.rb +9 -23
- data/spec/providers/slideshare_spec.rb +42 -0
- data/spec/providers/twitter_spec.rb +44 -0
- data/spec/spec_helper.rb +12 -0
- data/spec/spec_helper_examples.yml +6 -16
- data/spec/support/shared_examples_for_providers.rb +39 -0
- metadata +20 -80
- data/README.rdoc +0 -87
data/README.rdoc
DELETED
@@ -1,87 +0,0 @@
|
|
1
|
-
= ruby-oembed http://stillmaintained.com/metavida/ruby-oembed.png
|
2
|
-
|
3
|
-
An oEmbed consumer library written in Ruby, letting you easily get embeddable HTML representations of supported web pages, based on their URLs. See {oembed.com}[http://oembed.com] for more about the protocol.
|
4
|
-
|
5
|
-
= Installation
|
6
|
-
|
7
|
-
gem install ruby-oembed
|
8
|
-
|
9
|
-
= Get Started
|
10
|
-
|
11
|
-
== Providers
|
12
|
-
|
13
|
-
Get information about a URL via an OEmbed::Provider. This library comes with many Providers built right in, to make your life easy.
|
14
|
-
|
15
|
-
resource = OEmbed::Providers::Youtube.get("http://www.youtube.com/watch?v=2BYXBC8WQ5k")
|
16
|
-
resource.video? #=> true
|
17
|
-
resource.thumbnail_url #=> "http://i3.ytimg.com/vi/2BYXBC8WQ5k/hqdefault.jpg"
|
18
|
-
resource.html #=> <<-HTML
|
19
|
-
<object width="425" height="344">
|
20
|
-
<param name="movie" value="http://www.youtube.com/v/2BYXBC8WQ5k?fs=1"></param>
|
21
|
-
<param name="allowFullScreen" value="true"></param>
|
22
|
-
<param name="allowscriptaccess" value="always"></param>
|
23
|
-
<embed src="http://www.youtube.com/v/2BYXBC8WQ5k?fs=1" type="application/x-shockwave-flash" width="425" height="344" allowscriptaccess="always" allowfullscreen="true"></embed>
|
24
|
-
</object>
|
25
|
-
HTML
|
26
|
-
|
27
|
-
If you'd like to use a provider that isn't included in the library, it's easy to create one. Just provide the oEmbed API endpoint and URL scheme(s).
|
28
|
-
|
29
|
-
my_provider = OEmbed::Provider.new("http://my.cool-service.com/api/oembed_endpoint.{format}")
|
30
|
-
my_provider << "http://*.cool-service.com/image/*"
|
31
|
-
my_provider << "http://*.cool-service.com/video/*"
|
32
|
-
resource = my_provider.get("http://a.cool-service.com/video/1") #=> OEmbed::Response
|
33
|
-
resource.provider.name #=> "My Cool Service"
|
34
|
-
|
35
|
-
To use multiple Providers at once, simply register them.
|
36
|
-
|
37
|
-
OEmbed::Providers.register(OEmbed::Providers::Youtube, my_provider)
|
38
|
-
resource = OEmbed::Providers.get("http://www.youtube.com/watch?v=2BYXBC8WQ5k") #=> OEmbed::Response
|
39
|
-
resource.type #=> "video"
|
40
|
-
resource.provider.name #=> "Youtube"
|
41
|
-
|
42
|
-
Last but not least, ruby-oembed supports both {oohEmbed}[http://oohembed.com] and {Embedly}[http://embed.ly]. 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].
|
43
|
-
|
44
|
-
== Formatters
|
45
|
-
|
46
|
-
This library works wonderfully on its own, but can get a speed boost by using 3rd party libraries to parse oEmbed data. To use a 3rd party Formatter, just be sure to require the library _before_ ruby-oembed.
|
47
|
-
|
48
|
-
require 'json'
|
49
|
-
require 'xmlsimple'
|
50
|
-
require 'oembed'
|
51
|
-
|
52
|
-
OEmbed::Formatter::JSON.backend #=> OEmbed::Formatter::JSON::Backends::JSONGem
|
53
|
-
OEmbed::Formatter::XML.backend #=> OEmbed::Formatter::XML::Backends::XmlSimple
|
54
|
-
|
55
|
-
The following, optional, backends are currently supported:
|
56
|
-
* The {JSON implementation for Ruby}[http://flori.github.com/json/]
|
57
|
-
* Rails' ActiveSupport::JSON (confirmed to work with Rails 3.0.x and should work with Rails 2.0+)
|
58
|
-
* {XmlSimple}[http://xml-simple.rubyforge.org/]
|
59
|
-
|
60
|
-
= Lend a Hand
|
61
|
-
|
62
|
-
Code for the ruby-oembed library is {hosted on GitHub}[https://github.com/judofyr/ruby-oembed].
|
63
|
-
|
64
|
-
# Get the code.
|
65
|
-
git clone git://github.com/judofyr/ruby-oembed.git
|
66
|
-
cd ruby-oembed
|
67
|
-
# Install all development-related gems.
|
68
|
-
gem install bundler
|
69
|
-
bundle install
|
70
|
-
# Run the tests.
|
71
|
-
bundle exec rake
|
72
|
-
# or run the test continually
|
73
|
-
bundle exec guard
|
74
|
-
|
75
|
-
If you encounter any bug, feel free to {create an Issue}[https://github.com/judofyr/ruby-oembed/issues].
|
76
|
-
|
77
|
-
We gladly accept pull requests! Just {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/].
|
78
|
-
|
79
|
-
We do our best to {keep our tests green}[http://travis-ci.org/metavida/ruby-oembed] https://secure.travis-ci.org/metavida/ruby-oembed.png
|
80
|
-
|
81
|
-
= Contributors
|
82
|
-
|
83
|
-
Thanks to {all who have made contributions}[https://github.com/judofyr/ruby-oembed/contributors] to this gem, both large and small.
|
84
|
-
|
85
|
-
= License
|
86
|
-
|
87
|
-
This code is free to use under the terms of the MIT license.
|