RSS Maker : LastBuildDate / TTL / Copyright

Hi,

Does anyone know how to code an RSS maker to generate additional tags
for the header of the feed? The gem has a method for 'lastBuildDate='
but I cannot get it to work ...

···

************************************************
content = RSS::Maker.make(Version) do |m|
  m.channel.title = "xxxx"
  m.channel.link = "http://yyyyyyyy"
  m.channel.description = "zzzzz"
  m.channel.lastBuildDate= Time.now
************************************************

- produces:

/usr/lib/ruby/1.8/rss/0.9.rb:107:in `lastBuildDate=': value <Tue Jan 18
14:22:44 +0000 2011> of tag <lastBuildDate> is not available.
(RSS::NotAvailableValueError)

I have tried several variations with no joy, and the documentation is
not helpful.

I can't find anything that might set the ttl or copyright values.

Anyone managed to generate a full-feature RSS xml file using this?

Thanks.
Mike.

--
Posted via http://www.ruby-forum.com/.

Hi,

In <73f90e19374a3d055da0b4f668ead97d@ruby-forum.com>
  "RSS Maker : LastBuildDate / TTL / Copyright" on Tue, 18 Jan 2011 23:43:37 +0900,

Does anyone know how to code an RSS maker to generate additional tags
for the header of the feed? The gem has a method for 'lastBuildDate='
but I cannot get it to work ...

************************************************
content = RSS::Maker.make(Version) do |m|
  m.channel.title = "xxxx"
  m.channel.link = "http://yyyyyyyy"
  m.channel.description = "zzzzz"
  m.channel.lastBuildDate= Time.now
************************************************

- produces:

/usr/lib/ruby/1.8/rss/0.9.rb:107:in `lastBuildDate=': value <Tue Jan 18
14:22:44 +0000 2011> of tag <lastBuildDate> is not available.
(RSS::NotAvailableValueError)

What Ruby version are you using?
I tried it in Ruby 1.8.7 and worked well.

I can't find anything that might set the ttl or copyright values.

  m.channel.ttl = 29
  m.channel.copyright = "XXX"

You need to specify "2.0" as "version" of
RSS::Maker.make(version).

Thanks,

···

Mike Flint <mfcoder-ap@yahoo.co.uk> wrote:
--
kou

Hi,

Thanks for the reply.

I'm using Ruby 1.8.7, specifying rss version "2.0".

I have it working now ... well, the copyright is working, and my problem
with lastBuildDate was because I was passing the String representation
of the time, not a Time object - the error message was not obvious.
Passing Time.now and it works.

My final issue (I hope) is that even though I have:

m.channel.ttl = 10

and get no error message, there is no <ttl> tag in the xml. Think I
might need to use some of the Maker class to add it(?)

Thanks again.

···

--
Posted via http://www.ruby-forum.com/.

Ooops!

Scrap that last response. The <ttl> tag is there, it's just at the end
of the XML past the item definitions, but still within the channel.

(grep found what my eyes failed to!)

Sorry for the last post!

Mike.

···

--
Posted via http://www.ruby-forum.com/.