Class: GovernorLivejournal::Livejournal

Inherits:
Object
  • Object
show all
Includes:
LiveJournal
Defined in:
lib/governor_livejournal/livejournal.rb

Instance Method Summary collapse

Constructor Details

#initialize(article_or_entry_id) ⇒ Livejournal

Returns a new instance of Livejournal.



5
6
7
8
9
10
# File 'lib/governor_livejournal/livejournal.rb', line 5

def initialize(article_or_entry_id)
  @article = article_or_entry_id
  @user = User.new(GovernorLivejournal.config.username, GovernorLivejournal.config.password)
   = Request::Login.new(@user)
  .run
end

Instance Method Details

#deleteObject



31
32
33
34
# File 'lib/governor_livejournal/livejournal.rb', line 31

def delete
  delete_event = Request::EditEvent.new(@user, get, :delete => true)
  delete_event.run
end

#getObject



19
20
21
22
# File 'lib/governor_livejournal/livejournal.rb', line 19

def get
  get_events = Request::GetEvents.new(@user, :itemid => livejournal_id)
  get_events.run
end

#postObject



12
13
14
15
16
17
# File 'lib/governor_livejournal/livejournal.rb', line 12

def post
  entry = populate_entry(Entry.new)
  post_event = Request::PostEvent.new(@user, entry)
  post_event.run
  entry.itemid
end

#putObject



24
25
26
27
28
29
# File 'lib/governor_livejournal/livejournal.rb', line 24

def put
  entry = populate_entry(get)
  edit_event = Request::EditEvent.new(@user, entry)
  edit_event.run
  entry.itemid
end