Class: ActiveYoutube

Inherits:
ActiveResource::Base
  • Object
show all
Defined in:
lib/simple_youtube/activeyoutube.rb

Class Method Summary collapse

Class Method Details

.convert_entry_to_array(object) ⇒ Object

if youtube only returns a single entry, then convert to an array to standardize subsequent feed processing



15
16
17
18
19
20
# File 'lib/simple_youtube/activeyoutube.rb', line 15

def self.convert_entry_to_array object
  if object.respond_to?:entry and !(object.entry.kind_of? Array)
    object.entry=[object.entry]
  end
  object
end

.find(args) ⇒ Object



7
8
9
10
11
12
# File 'lib/simple_youtube/activeyoutube.rb', line 7

def self.find(args)
  scope, type, query = args[:scope], args[:type], args[:params]
  headers['Accept'] = "application/atom+xml"
  path = "#{prefix()}#{collection_name}#{'/' if scope}#{scope}#{'/' if type}#{type}#{query_string(query)}"
  convert_entry_to_array(instantiate_record(connection.get(path, headers)))
end