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

- (User) initialize(username = nil, password = nil, server = nil)

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

- (Object) fullname

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

- (Object) journals

Journals the user has posting access to



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

def journals
  @journals
end

- (Object) password

parameter when creating a User



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

def password
  @password
end

- (Object) server

parameter when creating a User



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

def server
  @server
end

- (Object) usejournal

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

- (Object) username

parameter when creating a User



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

def username
  @username
end

Instance Method Details

- (Object) journal



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

def journal
  @usejournal || @username
end

- (Object) to_s



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

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