forked from ruby-oembed/ruby-oembed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
idea.rb
33 lines (27 loc) · 922 Bytes
/
idea.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Adding providers:
# The second argument defines the default format
flickr = OEmbed::Provider.new("http://www.flickr.com/services/oembed/", :xml)
flickr << "http://*.flickr.com/*"
# Optional settings:
flickr.name = "Flickr"
flickr.url = "http://flickr.com/"
# Another one:
# The default format defaults to json
qik = OEmbed::Provider.new("http://qik.com/api/oembed.{format}")
qik << "http://qik.com/*"
# Get a raw XML-file from Flickr:
flickr.raw("http://flickr.com/photos/my_user/1231231312")
# Get a raw JSON-file
flickr.raw("http://flickr.com/photos/my_user/1231231312", :format => :json)
# Returns a OEmbed::Response
flickr.get("http://flickr.com/photos/my_user/1231231312")
# Register them to
OEmbed::Providers.register(flickr, qik)
OEmbed::Providers.raw("http://qik.com/test", :format => :xml)
res.is_a?(OEmbed::Response)
res.type
res.version
res.author_name
res.author_url
res.provider.url
res.provider.name