Class: FeedMe::StrictParserBuilder

Inherits:
ParserBuilder show all
Defined in:
lib/feedme.rb

Instance Attribute Summary collapse

Attributes inherited from ParserBuilder

#aliases, #atom_entry_tags, #atom_tags, #date_tags, #default_transformation, #default_value_tags, #html_helper_lib, #options, #rss_item_tags, #rss_tags, #transformation_fns, #transformations, #value_tags

Instance Method Summary collapse

Methods inherited from ParserBuilder

#emulate_atom!, #emulate_rss!, #parse

Constructor Details

#initialize(options = {}) ⇒ StrictParserBuilder

Returns a new instance of StrictParserBuilder.



219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/feedme.rb', line 219

def initialize(options={})
  super(options)
  
  # rss tags
	@rss_tags = [
	  {
		  :image     => [ :url, :title, :link, :width, :height, :description ],
      :textinput => [ :title, :description, :name, :link ],
      :skiphours => [ :hour ],
      :skipdays  => [ :day ],
      :items     => [ 
        {
          :rdf_seq => [ :rdf_li ]
        },
        :rdf_seq 
      ],
     #:item      => @item_tags
		},
		:title, :link, :description,                          # required
		:language, :copyright, :managingeditor, :webmaster,   # optional
		:pubdate, :lastbuilddate, :category, :generator,
		:docs, :cloud, :ttl, :rating,
		:image, :textinput, :skiphours, :skipdays, :item,     # have subtags
		:items
	]
  @rss_item_tags = [
    {},
    :title, :description,                                 # required
    :link, :author, :category, :comments, :enclosure,     # optional
    :guid, :pubdate, :source, :expirationdate
	]

  #atom tags
  person_tags = [ :name, :uri, :email ]
  @atom_tags = [
    {
      :author       => person_tags,
      :contributor  => person_tags,
     #:entry        => @entry_tags
    },
    :id, :author, :title, :updated,                     # required
    :category, :contributor, :generator, :icon, :logo,  # optional
    :link, :rights, :subtitle
  ]
  @atom_entry_tags = [
    {
      :author       => person_tags, 
      :contributor  => person_tags
    },
    :id, :author, :title, :updated, :summary,           # required
    :category, :content, :contributor, :link, 
    :published, :rights, :source
  ]
  
  @rels = {
    :link => [ 'self', 'alternate', 'edit', 'replies', 'related', 'enclosure', 'via' ]
  }
  
  # extensions
  @feed_ext_tags = [ 
    :dc_date, :feedburner_browserfriendly, 
    :itunes_author, :itunes_category
  ]
  @item_ext_tags = [ 
    :dc_date, :dc_subject, :dc_creator, 
    :dc_title, :dc_rights, :dc_publisher, 
    :trackback_ping, :trackback_about,
    :feedburner_origlink, :media_content,
    :content_encoded
  ]
end

Instance Attribute Details

#feed_ext_tagsObject

Returns the value of attribute feed_ext_tags.



217
218
219
# File 'lib/feedme.rb', line 217

def feed_ext_tags
  @feed_ext_tags
end

#item_ext_tagsObject

Returns the value of attribute item_ext_tags.



217
218
219
# File 'lib/feedme.rb', line 217

def item_ext_tags
  @item_ext_tags
end

#relsObject

Returns the value of attribute rels.



217
218
219
# File 'lib/feedme.rb', line 217

def rels
  @rels
end

Instance Method Details

#all_atom_tagsObject



297
298
299
300
301
# File 'lib/feedme.rb', line 297

def all_atom_tags
  all_tags = atom_tags + (feed_ext_tags or [])
  all_tags[0][:entry] =  + (item_ext_tags or [])
  return all_tags
end

#all_rss_tagsObject



291
292
293
294
295
# File 'lib/feedme.rb', line 291

def all_rss_tags
  all_tags = rss_tags + (feed_ext_tags or [])
  all_tags[0][:item] = rss_item_tags + (item_ext_tags or [])
  return all_tags
end