oembedr 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
- # 1.0.0 (2012-01-17)
1
+ ## 0.0.3 (2012-01-19)
2
+
3
+ * fix typo; add more providers.
4
+
5
+ ## 0.0.2 (2012-01-17)
2
6
 
3
7
  * Hello world: initial release
data/README.md CHANGED
@@ -23,9 +23,22 @@ Make consuming oembed from **any source** simple and easy. Uses fast http and fa
23
23
  *N.B.* XML is not supported yet. I've no idea why you might **need** it, but it's on the todo list :).
24
24
 
25
25
  ```ruby
26
- response = OEmbedr.fetch("http://www.youtube.com/watch?v=BxhqVrbixZc")
26
+ response = Oembedr.fetch("http://www.youtube.com/watch?v=BxhqVrbixZc")
27
27
  response.body # => { "type" => "video", ... }
28
28
  # Now you can do whatever you want!
29
+
30
+ # To customize your query:
31
+ Oembedr.fetch("http://www.youtu.be/BxhqVrbixZc", :params => { :maxwidth => 320 })
32
+ Oembedr.fetch("http://custom.com/23423423", :headers => {
33
+ "Accept" => "application/vnd.ms-excel",
34
+ "User-Agent" => "Windows Excel-Based Oembed Service"
35
+ })
36
+ ```
37
+
38
+ #### Other Methods
39
+
40
+ ```ruby
41
+ Oembedr.known_service?("http://www.youtu.be/BxhqVrbixZc") # => true
29
42
  ```
30
43
 
31
44
  #### Configuration
@@ -51,6 +64,8 @@ Use a fast http library, like excon or typhoeus. Use yajl-ruby.
51
64
  * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
52
65
  * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
53
66
 
67
+ A big thanks to everyone who [contributes](https://github.com/agoragames/oembedr/contributors)!
68
+
54
69
  ## Copyright
55
70
 
56
71
  Copyright (c) 2012 Matthew Wilson. MIT-license: see LICENSE.txt for further details.
@@ -3,7 +3,7 @@ module Oembedr
3
3
 
4
4
  # from ruby-oembed with a couple more I know of from user feedback :).
5
5
  LIST = {
6
- /(yotu\.be|youtube)/ => "http://www.youtube.com/oembed",
6
+ /(youtu\.be|youtube)/ => "http://www.youtube.com/oembed",
7
7
  /(flic\.kr|flickr)/ => "http://www.flickr.com/services/oembed/",
8
8
  /viddler/ => "http://lab.viddler.com/services/oembed/",
9
9
  /qik/ => "http://qik.com/api/oembed.{format}",
@@ -19,6 +19,12 @@ module Oembedr
19
19
  /skitch\.com/ => 'http://skitch.com/oembed',
20
20
  /twitch\.tv/ => false, # OMG! Support OEmbed!
21
21
  /twitter\.com/ => 'https://api.twitter.com/1/statuses/oembed.{format}',
22
+ /dailymotion\.com/ => 'http://www.dailymotion.com/api/oembed/',
23
+ /scribd\.com/ => 'http://www.scribd.com/services/oembed',
24
+ /dotsub\.com/ => 'http://dotsub.com/services/oembed',
25
+ /clikthrough\.com/ => 'http://clikthrough.com/services/oembed',
26
+ /kinomap\.com/ => 'http://www.kinomap.com/oembed',
27
+ /photobucket\.com/ => 'http://photobucket.com/oembed'
22
28
  # ...
23
29
  }
24
30
 
@@ -29,7 +35,7 @@ module Oembedr
29
35
  # @return the url, or false if no known endpoint.
30
36
  def service_endpoint url
31
37
  endpoint = LIST.find do |(pattern, endpoint)|
32
- pattern.match(url)
38
+ url =~ pattern
33
39
  end
34
40
  endpoint ? endpoint.last : false
35
41
  end
@@ -1,3 +1,3 @@
1
1
  module Oembedr
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -23,7 +23,9 @@ module Oembedr
23
23
  context "testing ALL THE THINGS" do
24
24
  {
25
25
  "http://www.youtube.com/watch?v=b9XsTtFu64Y" => "http://www.youtube.com/oembed",
26
+ "http://youtu.be/b9XsTtFu64Y" => "http://www.youtube.com/oembed",
26
27
  "http://www.flickr.com/photos/puzzlemaster/6693154925/in/photostream" => "http://www.flickr.com/services/oembed/",
28
+ "http://www.flic.kr/6693154925" => "http://www.flickr.com/services/oembed/",
27
29
  "http://www.viddler.com/v/a802f490" => "http://lab.viddler.com/services/oembed/",
28
30
  "http://qik.com/video/15944" => "http://qik.com/api/oembed.{format}",
29
31
  "http://revision3.com/tbhs/holidaycontroller" => "http://revision3.com/api/oembed/",
@@ -37,7 +39,13 @@ module Oembedr
37
39
  "http://opera.com" => 'http://my.opera.com/service/oembed',
38
40
  "http://skitch.com/hannaolsen/rq33h/vday" => 'http://skitch.com/oembed',
39
41
  "http://www.twitch.tv/i_like_turtlez" => false, # OMG! Support OEmbed!
40
- "https://twitter.com/hypomodern/status/158203918323695616" => 'https://api.twitter.com/1/statuses/oembed.{format}'
42
+ "https://twitter.com/hypomodern/status/158203918323695616" => 'https://api.twitter.com/1/statuses/oembed.{format}',
43
+ "http://www.dailymotion.com/video/x5ioet_phoenix-mars-lander_tech" => 'http://www.dailymotion.com/api/oembed/',
44
+ "http://www.scribd.com/doc/17896323/Indian-Automobile-industryPEST" => 'http://www.scribd.com/services/oembed',
45
+ "http://dotsub.com/view/10e3cb5e-96c7-4cfb-bcea-8ab11e04e090" => 'http://dotsub.com/services/oembed',
46
+ "http://www.clikthrough.com/theater/video/55" => 'http://clikthrough.com/services/oembed',
47
+ "http://www.kinomap.com/kms-vzkpc7" => 'http://www.kinomap.com/oembed',
48
+ "http://img.photobucket.com/albums/v211/JAV123/Michael%20Holland%20Candle%20Burning/_MG_5661.jpg" => 'http://photobucket.com/oembed'
41
49
  }.each do |(test_url, expected_value)|
42
50
  it "should match #{test_url} to #{expected_value}" do
43
51
  Oembedr.service_endpoint(test_url).should == expected_value
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oembedr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-17 00:00:00.000000000 Z
12
+ date: 2012-01-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &2164342700 !ruby/object:Gem::Requirement
16
+ requirement: &2152421940 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2164342700
24
+ version_requirements: *2152421940
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: yajl-ruby
27
- requirement: &2164339500 !ruby/object:Gem::Requirement
27
+ requirement: &2152421480 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2164339500
35
+ version_requirements: *2152421480
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: typhoeus
38
- requirement: &2164338500 !ruby/object:Gem::Requirement
38
+ requirement: &2152421040 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2164338500
46
+ version_requirements: *2152421040
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: vcr
49
- requirement: &2164337200 !ruby/object:Gem::Requirement
49
+ requirement: &2152420520 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 2.0.0.rc1
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2164337200
57
+ version_requirements: *2152420520
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: fakeweb
60
- requirement: &2164336240 !ruby/object:Gem::Requirement
60
+ requirement: &2152420100 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2164336240
68
+ version_requirements: *2152420100
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: guard
71
- requirement: &2164334940 !ruby/object:Gem::Requirement
71
+ requirement: &2152419620 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *2164334940
79
+ version_requirements: *2152419620
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: guard-rspec
82
- requirement: &2164333700 !ruby/object:Gem::Requirement
82
+ requirement: &2152419140 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *2164333700
90
+ version_requirements: *2152419140
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: guard-bundler
93
- requirement: &2164331340 !ruby/object:Gem::Requirement
93
+ requirement: &2152418700 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *2164331340
101
+ version_requirements: *2152418700
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: multi_json
104
- requirement: &2164328280 !ruby/object:Gem::Requirement
104
+ requirement: &2152418240 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '0'
110
110
  type: :runtime
111
111
  prerelease: false
112
- version_requirements: *2164328280
112
+ version_requirements: *2152418240
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: faraday
115
- requirement: &2164327160 !ruby/object:Gem::Requirement
115
+ requirement: &2152417780 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: '0'
121
121
  type: :runtime
122
122
  prerelease: false
123
- version_requirements: *2164327160
123
+ version_requirements: *2152417780
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: faraday_middleware
126
- requirement: &2164326060 !ruby/object:Gem::Requirement
126
+ requirement: &2152417220 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ! '>='
@@ -131,7 +131,7 @@ dependencies:
131
131
  version: '0'
132
132
  type: :runtime
133
133
  prerelease: false
134
- version_requirements: *2164326060
134
+ version_requirements: *2152417220
135
135
  description: oembedr aims to make consuming oembed resources easy
136
136
  email:
137
137
  - mhw@hypomodern.com