Class: Redtube::Base
- Inherits:
-
Object
- Object
- Redtube::Base
- Defined in:
- lib/redtube/base.rb
Class Method Summary collapse
- .elements_by_query(query) ⇒ Object
- .find_by_query(query) ⇒ Object
- .get(query) ⇒ Object
- .name ⇒ Object
Class Method Details
.elements_by_query(query) ⇒ Object
7 8 9 |
# File 'lib/redtube/base.rb', line 7 def self.elements_by_query(query) Nokogiri::XML(get(query)).css name.downcase end |
.find_by_query(query) ⇒ Object
3 4 5 |
# File 'lib/redtube/base.rb', line 3 def self.find_by_query(query) elements_by_query(query).map { |element| new element } end |
.get(query) ⇒ Object
11 12 13 |
# File 'lib/redtube/base.rb', line 11 def self.get(query) open("http://api.redtube.com/?output=xml&data=redtube.#{name}s.#{query}").read end |
.name ⇒ Object
15 16 17 |
# File 'lib/redtube/base.rb', line 15 def self.name super.gsub("Redtube::", "") end |