Class Atom::Collection
In: lib/atom/collection.rb
Parent: Feed

represents an Atom Publishing Protocol Collection

Methods

delete!   new   post!   post_media!   put!   put_media!  

Attributes

accepts  [RW]  comma separated string that contains a list of media types accepted by a collection.

XXX I should parse this in some way, but I’m not sure what’s useful

Public Class methods

[Source]

    # File lib/atom/collection.rb, line 16
16:     def initialize(uri, http = Atom::HTTP.new)
17:       super uri, http
18:     end

Public Instance methods

DELETE an entry from the collection

[Source]

    # File lib/atom/collection.rb, line 35
35:     def delete!(entry, url = entry.edit_url)
36:       @http.delete(url)
37:     end

POST an entry to the collection, with a slug

[Source]

    # File lib/atom/collection.rb, line 21
21:     def post!(entry, slug = nil)
22:       raise "Cowardly refusing to POST a non-Atom::Entry" unless entry.is_a? Atom::Entry
23:       headers = {"Content-Type" => "application/atom+xml" }
24:       headers["Slug"] = slug if slug
25:       
26:       @http.post(@uri, entry.to_s, headers)
27:     end

POST a media item to the collection

[Source]

    # File lib/atom/collection.rb, line 40
40:     def post_media!(data, content_type, slug = nil)
41:       headers = {"Content-Type" => content_type}
42:       headers["Slug"] = slug if slug
43:       
44:       @http.post(@uri, data, headers)
45:     end

PUT an updated version of an entry to the collection

[Source]

    # File lib/atom/collection.rb, line 30
30:     def put!(entry, url = entry.edit_url)
31:       @http.put_atom_entry(entry, url)
32:     end

PUT a media item to the collection

[Source]

    # File lib/atom/collection.rb, line 48
48:     def put_media!(data, content_type, slug = nil)
49:       headers = {"Content-Type" => content_type}
50: 
51:       @http.put(url, data, headers)
52:     end

[Validate]