Skip to content

Commit

Permalink
Moving errors to OEmbed & lib/oembed/errors.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
judofyr committed May 11, 2008
1 parent 205b123 commit f057f62
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions lib/oembed.rb
Expand Up @@ -8,6 +8,7 @@


require 'net/http' require 'net/http'


require 'oembed/errors'
require 'oembed/provider' require 'oembed/provider'
require 'oembed/providers' require 'oembed/providers'
require 'oembed/response' require 'oembed/response'
4 changes: 4 additions & 0 deletions lib/oembed/errors.rb
@@ -0,0 +1,4 @@
module OEmbed
NotFound = Class.new(StandardError)
UnkownFormat = Class.new(StandardError)
end
3 changes: 0 additions & 3 deletions lib/oembed/provider.rb
@@ -1,8 +1,5 @@
module OEmbed module OEmbed
class Provider class Provider
class NotFound<StandardError;end
class UnknownFormat<StandardError;end

attr_accessor :format, :name, :url, :urls, :endpoint attr_accessor :format, :name, :url, :urls, :endpoint


def initialize(endpoint, format = :json) def initialize(endpoint, format = :json)
Expand Down
4 changes: 2 additions & 2 deletions lib/oembed/providers.rb
Expand Up @@ -28,12 +28,12 @@ def find(url)
end end


def raw(url, options = {}) def raw(url, options = {})
provider = find(url) || raise(OEmbed::Provider::NotFound) provider = find(url) || raise(OEmbed::NotFound)
provider.raw(url, options) provider.raw(url, options)
end end


def get(url, options = {}) def get(url, options = {})
provider = find(url) || raise(OEmbed::Provider::NotFound) provider = find(url) || raise(OEmbed::NotFound)
provider.get(url, options) provider.get(url, options)
end end
end end
Expand Down

0 comments on commit f057f62

Please sign in to comment.