class LiveJournal::User
A LiveJournal
user. Given a username, password, and server, running a LiveJournal::Request::Login
will fill in the other fields.
Attributes
fullname[RW]
User's self-reported name, as retrieved by LiveJournal::Request::Login
journals[RW]
Journals the user has posting access to
password[RW]
parameter when creating a User
server[RW]
parameter when creating a User
usejournal[RW]
Set usejournal to log in as user username but act as user usejournal. For example, to work with a community you own.
username[RW]
parameter when creating a User
Public Class Methods
new(username=nil, password=nil, server=nil)
click to toggle source
# File lib/livejournal/basic.rb, line 71 def initialize(username=nil, password=nil, server=nil) @username = username @password = password @usejournal = nil @server = server || LiveJournal::DEFAULT_SERVER end
Public Instance Methods
canonical_journal_name()
click to toggle source
# File lib/livejournal/basic.rb, line 83 def canonical_journal_name journal.tr("_", "-") end
journal()
click to toggle source
# File lib/livejournal/basic.rb, line 77 def journal @usejournal || @username end
journal_url()
click to toggle source
# File lib/livejournal/basic.rb, line 86 def journal_url klass = server.use_ssl ? URI::HTTPS : URI::HTTP host = server.host.gsub(/^www\./, "") if journal[0] == "_" klass.build(host: "users.#{host}", port: server.port, path: "/" + canonical_journal_name).to_s else klass.build(host: "#{canonical_journal_name}.#{host}", port: server.port).to_s end end
to_s()
click to toggle source
# File lib/livejournal/basic.rb, line 80 def to_s "#{@username}: '#{@fullname}'" end