Class: LiveJournal::User

Inherits:
Object
  • Object
show all
Defined in:
lib/livejournal/basic.rb

Overview

A LiveJournal user. Given a username, password, and server, running a LiveJournal::Request::Login will fill in the other fields.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(username = nil, password = nil, server = nil) ⇒ User

Returns a new instance of User.



50
51
52
53
54
55
# File 'lib/livejournal/basic.rb', line 50

def initialize(username=nil, password=nil, server=nil)
  @username = username
  @password = password
  @usejournal = nil
  @server = server || LiveJournal::DEFAULT_SERVER
end

Instance Attribute Details

#fullnameObject

User’s self-reported name, as retrieved by LiveJournal::Request::Login



46
47
48
# File 'lib/livejournal/basic.rb', line 46

def fullname
  @fullname
end

#journalsObject

Journals the user has posting access to



48
49
50
# File 'lib/livejournal/basic.rb', line 48

def journals
  @journals
end

#passwordObject

parameter when creating a User



41
42
43
# File 'lib/livejournal/basic.rb', line 41

def password
  @password
end

#serverObject

parameter when creating a User



41
42
43
# File 'lib/livejournal/basic.rb', line 41

def server
  @server
end

#usejournalObject

Set usejournal to log in as user username but act as user usejournal. For example, to work with a community you own.



44
45
46
# File 'lib/livejournal/basic.rb', line 44

def usejournal
  @usejournal
end

#usernameObject

parameter when creating a User



41
42
43
# File 'lib/livejournal/basic.rb', line 41

def username
  @username
end

Instance Method Details

#journalObject



56
57
58
# File 'lib/livejournal/basic.rb', line 56

def journal
  @usejournal || @username
end

#to_sObject



59
60
61
# File 'lib/livejournal/basic.rb', line 59

def to_s
  "#{@username}: '#{@fullname}'"
end