Class: ActiveLastfm
- Inherits:
-
ActiveResource::Base
- Object
- ActiveResource::Base
- ActiveLastfm
- Defined in:
- lib/active_lastfm.rb
Overview
This abstract base-class extends ActiveResource::Base to make requests to last.fm Based largely on the ActiveYouTube examples found at:
Class Method Summary collapse
-
.collection_path(prefix_options = {}, query_options = nil) ⇒ Object
Remove format from the url.
-
.element_path(id, prefix_options = {}, query_options = nil) ⇒ Object
Remove format from the url.
-
.instantiate_collection(collection, prefix_options = {}) ⇒ Object
For a collection call, ActiveResource formatting is not compliant with YouTube’s output.
Methods inherited from ActiveResource::Base
Class Method Details
.collection_path(prefix_options = {}, query_options = nil) ⇒ Object
Remove format from the url.
22 23 24 25 |
# File 'lib/active_lastfm.rb', line 22 def collection_path( = {}, = nil) , = () if .nil? "#{prefix()}#{query_string()}" end |
.element_path(id, prefix_options = {}, query_options = nil) ⇒ Object
Remove format from the url.
16 17 18 19 |
# File 'lib/active_lastfm.rb', line 16 def element_path(id, = {}, = nil) , = () if .nil? "#{prefix()}#{query_string()}" end |
.instantiate_collection(collection, prefix_options = {}) ⇒ Object
For a collection call, ActiveResource formatting is not compliant with YouTube’s output.
29 30 31 32 33 34 35 36 |
# File 'lib/active_lastfm.rb', line 29 def instantiate_collection(collection, = {}) puts collection.inspect unless collection.kind_of? Array [instantiate_record(collection, )] else collection.collect! { |record| instantiate_record(record, ) } end end |