Class | Atom::Collection |
In: |
lib/atom/collection.rb
|
Parent: | Feed |
a Collection is an Atom::Feed with extra Protocol-specific methods
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 |
# File lib/atom/collection.rb, line 16 16: def initialize(uri, http = Atom::HTTP.new) 17: super uri, http 18: end
DELETE an entry from the collection
# 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 an optional slug
# 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
# 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
# File lib/atom/collection.rb, line 30 30: def put!(entry, url = entry.edit_url) 31: @http.put_atom_entry(entry, url) 32: end