class LiveJournal::Request::EditEvent

Public Class Methods

new(user, entry, opts={}) click to toggle source

To edit an entry, pass in a #User and an #Entry to this and run it. To delete an entry, pass in :delete => true as the third parameter. (In this case, the Entry object only needs its itemid filled in.)

The LiveJournal API for deletion is to “edit” an entry to have an empty event. To prevent accidentally deleting entries, if you pass in an entry with an empty event without passing the delete flag, this will raise the AccidentalDeleteError exception.

Calls superclass method
# File lib/livejournal/entry.rb, line 367
def initialize(user, entry, opts={})
  super(user, 'editevent')

  @request['itemid'] = entry.itemid
  if opts.has_key? :delete
    @request['event'] = ''
  else
    entry.add_to_request @request
  end

  if @request['event'].nil? or @request['event'].empty?
    raise AccidentalDeleteError unless opts.has_key? :delete
  end
end