Problem generating RSS feed with enclosures using FeedTools library

Discussion in 'Ruby' started by Alex Castro, Dec 31, 2005.

  1. Alex  Castro

    Alex Castro Guest

    I'm using the FeedTools library to generate an RSS feed with a media
    enclosure. Unfortunately, I can't seem to figure out how to add the
    enclosure data.

    Here is the code:

    require 'rubygems'
    require_gem 'feedtools'

    feed = FeedTools::Feed.new
    feed.title = 'Odeo'
    feed.link = 'http://foo.com/profile/AlexCastro'
    feed.description = 'Alex Channel'

    feed.entries << FeedTools::FeedItem.new

    feed.entries[0].title = 'MacCast 12.22.2005'
    feed.entries[0].link = 'http://www.maccast.com'
    feed.entries[0].content = 'A podcast about all things Macintosh. For
    Mac geeks, by Mac geeks. Show 110. 1GB iPod Shuffles sold out until
    January. Apples marketing group was considering a 1GB iPod Nano. Will
    the first laptop...'
    feed.entries[0].author = 'MacCast'
    feed.entries[0].issued = 'Thu, 22 Dec 2005 10:04:35 GMT'
    feed.entries[0].media_thumbnail_link =
    'http://images.odeo.com/4/2/4/mc_albumart.jpg'

    feed.entries[0].enclosures = FeedTools::FeedItem::Enclosure.new

    feed.entries[0].enclosures.url =
    "http://foo.com/show/download/573556/1034567/paranode.com.topfunky.audio.2005.AviBryant.mp3"
    feed.entries[0].enclosures.type = "audio.mpeg"
    feed.entries[0].enclosures.file_size = "24467810"

    xml = feed.build_xml('rss', 2.0)
    puts xml


    I receive the following error message:

    NoMethodError: undefined method `size' for
    #<FeedTools::FeedItem::Enclosure:0x13a69cc>
    method enclosures in feed_item.rb at line 1133
    Alex Castro, Dec 31, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    5
    Views:
    704
    SpaceGirl
    Feb 25, 2005
  2. Motta
    Replies:
    1
    Views:
    503
    Andy Dingley
    Jun 9, 2004
  3. Patrick Flaherty

    finding audio/mpeg enclosures in RSS feeds

    Patrick Flaherty, Oct 1, 2004, in forum: XML
    Replies:
    1
    Views:
    418
    clintonG
    Oct 3, 2004
  4. Scott Gordo
    Replies:
    5
    Views:
    677
  5. Replies:
    1
    Views:
    141
    Kouhei Sutou
    May 17, 2009
Loading...

Share This Page