Class: Embedit::Media
- Inherits:
-
Object
- Object
- Embedit::Media
- Defined in:
- lib/embedit/media.rb
Instance Attribute Summary collapse
-
#format ⇒ Object
Returns the value of attribute format.
-
#html(args = {}) ⇒ Object
Returns the value of attribute html.
-
#provider ⇒ Object
Returns the value of attribute provider.
-
#title ⇒ Object
Returns the value of attribute title.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(url) ⇒ Media
constructor
delegate :title, :html, :format, :to => :provider.
- #valid? ⇒ Boolean
Constructor Details
#initialize(url) ⇒ Media
delegate :title, :html, :format, :to => :provider
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/embedit/media.rb', line 10 def initialize(url) @valid = true @url = url @provider = Provider.find(url) # The validation does a expensive GET request. needs to be fixed. (request only the headers?!) if !@provider || !Validate.new(@url).valid? @valid = false return end rescue #Horrible hack, but flickrs poor status headers == :( @valid = false #if it breaks, its gotta be invalid, I suggest removing when debugging end |
Instance Attribute Details
#format ⇒ Object
Returns the value of attribute format.
5 6 7 |
# File 'lib/embedit/media.rb', line 5 def format @format end |
#html(args = {}) ⇒ Object
Returns the value of attribute html.
5 6 7 |
# File 'lib/embedit/media.rb', line 5 def html @html end |
#provider ⇒ Object
Returns the value of attribute provider.
5 6 7 |
# File 'lib/embedit/media.rb', line 5 def provider @provider end |
#title ⇒ Object
Returns the value of attribute title.
5 6 7 |
# File 'lib/embedit/media.rb', line 5 def title @title end |
#url ⇒ Object
Returns the value of attribute url.
5 6 7 |
# File 'lib/embedit/media.rb', line 5 def url @url end |
Instance Method Details
#valid? ⇒ Boolean
37 38 39 |
# File 'lib/embedit/media.rb', line 37 def valid? @valid end |