livejournal 0.3.1 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Changes +7 -1
- data/{README → README.md} +27 -20
- data/Rakefile +18 -36
- data/lib/livejournal.rb +6 -0
- data/lib/livejournal/basic.rb +3 -0
- data/lib/livejournal/comment.rb +2 -0
- data/lib/livejournal/comments-xml.rb +0 -0
- data/lib/livejournal/database.rb +1 -1
- data/lib/livejournal/entry.rb +22 -15
- data/lib/livejournal/friends.rb +0 -0
- data/lib/livejournal/login.rb +1 -0
- data/lib/livejournal/logjam.rb +0 -0
- data/lib/livejournal/request.rb +0 -0
- data/lib/livejournal/sync.rb +0 -0
- data/sample/export +0 -0
- data/sample/fuse +0 -0
- data/sample/graph +0 -0
- data/test/checkfriends.rb +0 -0
- data/test/comments-xml.rb +0 -0
- data/test/database.rb +0 -0
- data/test/login.rb +0 -0
- data/test/roundtrip.rb +0 -0
- data/test/time.rb +0 -0
- metadata +66 -41
data/Changes
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
0.
|
1
|
+
0.3.3: Sat, Apr 23 2011
|
2
|
+
- Populate the list of journals the user has posting access to.
|
3
|
+
|
4
|
+
0.3.2: Mon, Nov 22 2010
|
5
|
+
- Support for the new LiveJournal entry properties
|
6
|
+
|
7
|
+
0.3.1: Sat, 06 Jan 2007 10:21:05 -0800
|
2
8
|
- Don't die on the "useragent" prop.
|
3
9
|
- Add a :strict => false option to GetEvents so we won't die on any new prop.
|
4
10
|
see the GetEvents documentation for details.
|
data/{README → README.md}
RENAMED
@@ -1,50 +1,57 @@
|
|
1
|
-
|
1
|
+
# ljrb: LiveJournal Ruby module
|
2
2
|
|
3
|
-
Copyright
|
4
|
-
|
3
|
+
Copyright: Copyright (C) 2005 Evan Martin <martine@danga.com>
|
4
|
+
|
5
|
+
Website: http://neugierig.org/software/livejournal/ruby
|
5
6
|
|
6
7
|
Example usage:
|
7
|
-
|
8
|
+
require 'livejournal/login'
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
puts "Logging in..."
|
11
|
+
user = LiveJournal::User.new('test', 'test')
|
12
|
+
login = LiveJournal::Request::Login.new(user)
|
13
|
+
login.run
|
13
14
|
|
14
|
-
|
15
|
-
|
15
|
+
puts "Login response:"
|
16
|
+
login.dumpresponse
|
16
17
|
|
17
|
-
|
18
|
+
puts "User's full name: #{user.fullname}"
|
18
19
|
|
19
|
-
|
20
|
+
## LiveJournal Datatypes
|
20
21
|
* LiveJournal::Server
|
21
22
|
* LiveJournal::User
|
22
23
|
* LiveJournal::Entry
|
23
24
|
* LiveJournal::Comment
|
24
25
|
* LiveJournal::Friend
|
25
26
|
|
26
|
-
|
27
|
-
|
27
|
+
## Implemented Requests
|
28
|
+
|
29
|
+
### Login Requests
|
28
30
|
* LiveJournal::Request::Login
|
29
|
-
|
31
|
+
|
32
|
+
### Friend Requests
|
30
33
|
* LiveJournal::Request::Friends
|
31
34
|
* LiveJournal::Request::FriendOfs
|
32
35
|
* LiveJournal::Request::CheckFriends
|
33
|
-
|
36
|
+
|
37
|
+
### Entry Requests
|
34
38
|
* LiveJournal::Request::PostEvent
|
35
39
|
* LiveJournal::Request::GetEvents
|
36
40
|
* LiveJournal::Request::EditEvent
|
37
41
|
|
38
|
-
|
42
|
+
### Comments Requests
|
43
|
+
* Livejournal::Request::GetComments
|
44
|
+
* Livejournal::Request::GetRecentComments
|
45
|
+
|
46
|
+
## Journal Offline Synchronization
|
39
47
|
* LiveJournal::Sync::Entries
|
40
48
|
* LiveJournal::Sync::Comments
|
41
49
|
See samples/export for an example of how to use these.
|
42
50
|
|
43
|
-
|
51
|
+
## SQLite3 Support
|
44
52
|
* LiveJournal::Database -- storing/loading entries+comments with SQLite3
|
45
53
|
Integrates well with syncing. See samples/export.
|
46
54
|
|
47
|
-
|
55
|
+
## Other Features
|
48
56
|
* LiveJournal::LogJam -- interface with LogJam (http://logjam.danga.com) 's
|
49
57
|
journal exports. (XXX currently broken)
|
50
|
-
|
data/Rakefile
CHANGED
@@ -4,41 +4,34 @@ require 'rake/packagetask'
|
|
4
4
|
require 'rake/rdoctask'
|
5
5
|
require 'rake/testtask'
|
6
6
|
|
7
|
-
PKG_NAME = 'livejournal'
|
8
|
-
PKG_VERSION = '0.3.1'
|
9
|
-
|
10
7
|
FILES = FileList[
|
11
|
-
'Rakefile', 'README', 'Changes', 'LICENSE', 'setup.rb',
|
8
|
+
'Rakefile', 'README.md', 'Changes', 'LICENSE', 'setup.rb',
|
12
9
|
'lib/**/*', 'sample/*', 'test/*'
|
13
10
|
]
|
14
11
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
Rake::GemPackageTask.new(spec) do |p|
|
31
|
-
p.need_tar = true
|
32
|
-
p.need_zip = true
|
12
|
+
begin
|
13
|
+
require 'jeweler'
|
14
|
+
Jeweler::Tasks.new do |gem|
|
15
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
16
|
+
gem.name = 'livejournal'
|
17
|
+
gem.summary = 'Module for interacting with livejournal'
|
18
|
+
gem.description = %q{LiveJournal module. Post to livejournal, retrieve friends lists, edit entries, sync journal to an offline database.}
|
19
|
+
gem.email = 'romanbsd@yahoo.com'
|
20
|
+
gem.homepage = 'http://neugierig.org/software/livejournal/ruby/'
|
21
|
+
gem.authors = ['Evan Martin', 'Roman Shterenzon']
|
22
|
+
gem.files = FILES.to_a
|
23
|
+
end
|
24
|
+
Jeweler::GemcutterTasks.new
|
25
|
+
rescue LoadError
|
26
|
+
puts "Jeweler not available. Install it with: gem install jeweler"
|
33
27
|
end
|
34
28
|
|
35
|
-
|
36
29
|
desc 'Generate RDoc'
|
37
30
|
Rake::RDocTask.new :rdoc do |rd|
|
38
31
|
rd.title = "ljrb (LiveJournal Ruby module) Documentation"
|
39
32
|
rd.rdoc_dir = 'doc'
|
40
|
-
rd.rdoc_files.add 'lib/livejournal/*.rb', 'README', 'LICENSE'
|
41
|
-
rd.main = 'README'
|
33
|
+
rd.rdoc_files.add 'lib/livejournal/*.rb', 'README.md', 'LICENSE'
|
34
|
+
rd.main = 'README.md'
|
42
35
|
end
|
43
36
|
|
44
37
|
desc 'Run Tests'
|
@@ -46,15 +39,4 @@ Rake::TestTask.new :test do |t|
|
|
46
39
|
t.test_files = FileList['test/*.rb']
|
47
40
|
end
|
48
41
|
|
49
|
-
desc 'Push data to my webspace'
|
50
|
-
task :pushweb => [:rdoc, :package] do
|
51
|
-
pkg = "pkg/#{PKG_NAME}-#{PKG_VERSION}"
|
52
|
-
target = 'neugierig.org:/home/martine/www/neugierig/htdocs/software/livejournal/ruby'
|
53
|
-
sh %{rsync -av --delete doc/* #{target}/doc/}
|
54
|
-
sh %{rsync -av #{pkg}.* #{target}/download/}
|
55
|
-
end
|
56
|
-
|
57
|
-
desc 'Push everything'
|
58
|
-
task :push => [:pushweb] # XXX push to rubyforge
|
59
|
-
|
60
42
|
# vim: set ts=2 sw=2 et :
|
data/lib/livejournal.rb
ADDED
data/lib/livejournal/basic.rb
CHANGED
@@ -44,6 +44,9 @@ module LiveJournal
|
|
44
44
|
attr_accessor :usejournal
|
45
45
|
# User's self-reported name, as retrieved by LiveJournal::Request::Login
|
46
46
|
attr_accessor :fullname
|
47
|
+
# Journals the user has posting access to
|
48
|
+
attr_accessor :journals
|
49
|
+
|
47
50
|
def initialize(username=nil, password=nil, server=nil)
|
48
51
|
@username = username
|
49
52
|
@password = password
|
data/lib/livejournal/comment.rb
CHANGED
@@ -49,6 +49,7 @@ module LiveJournal
|
|
49
49
|
when 'A'; :active
|
50
50
|
when 'D'; :deleted
|
51
51
|
when 'S'; :screened
|
52
|
+
when 'F'; :frozen
|
52
53
|
else raise ArgumentError, "Invalid comment state: #{str.inspect}"
|
53
54
|
end
|
54
55
|
end
|
@@ -60,6 +61,7 @@ module LiveJournal
|
|
60
61
|
when :active; nil
|
61
62
|
when :deleted; 'D'
|
62
63
|
when :screened; 'S'
|
64
|
+
when :frozen; 'F'
|
63
65
|
else raise ArgumentError, "Invalid comment state: #{state.inspect}"
|
64
66
|
end
|
65
67
|
end
|
File without changes
|
data/lib/livejournal/database.rb
CHANGED
data/lib/livejournal/entry.rb
CHANGED
@@ -53,6 +53,7 @@ module LiveJournal
|
|
53
53
|
attr_accessor :security # values: {:public, :private, :friends, :custom}
|
54
54
|
attr_accessor :allowmask
|
55
55
|
attr_accessor :screening # values {:default, :all, :anonymous, :nonfriends, :none}
|
56
|
+
attr_accessor :interface # values {:web, ...}
|
56
57
|
|
57
58
|
# A hash of any leftover properties (including those in KNOWN_EXTRA_PROPS)
|
58
59
|
# that aren't explicitly supported by ljrb. (See the
|
@@ -60,7 +61,11 @@ module LiveJournal
|
|
60
61
|
attr_accessor :props
|
61
62
|
# A list of extra properties we're aware of but don't wrap explicitly.
|
62
63
|
# Upon retrieval stored in the props hash.
|
63
|
-
|
64
|
+
# See: http://www.livejournal.com/doc/server/ljp.csp.proplist.html
|
65
|
+
KNOWN_EXTRA_PROPS = %w{admin_content_flag adult_content commentalter
|
66
|
+
current_coords personifi_lang personifi_tags personifi_word_count
|
67
|
+
qotdid revnum revtime sms_msgid statusvis syn_id syn_link unknown8bit
|
68
|
+
unsuspend_supportid used_rte useragent verticals_list}
|
64
69
|
|
65
70
|
def initialize
|
66
71
|
@subject = nil
|
@@ -74,7 +79,7 @@ module LiveJournal
|
|
74
79
|
@preformatted = false
|
75
80
|
@backdated = false
|
76
81
|
@comments = :normal
|
77
|
-
@time =
|
82
|
+
@time = Time.now
|
78
83
|
@security = :public
|
79
84
|
@allowmask = nil
|
80
85
|
@screening = :default
|
@@ -128,26 +133,26 @@ module LiveJournal
|
|
128
133
|
|
129
134
|
def load_prop(name, value, strict=false) #:nodoc:#
|
130
135
|
case name
|
136
|
+
when 'current_location'
|
137
|
+
@location = value
|
131
138
|
when 'current_mood'
|
132
|
-
@mood = value
|
139
|
+
@mood = value
|
133
140
|
when 'current_moodid'
|
134
141
|
@moodid = value.to_i
|
135
142
|
when 'current_music'
|
136
143
|
@music = value
|
137
|
-
when '
|
138
|
-
@
|
139
|
-
when '
|
140
|
-
@
|
141
|
-
when '
|
142
|
-
@
|
143
|
-
when 'opt_preformatted'
|
144
|
-
@preformatted = value == '1'
|
144
|
+
when 'hasscreened'
|
145
|
+
@screened = value == '1'
|
146
|
+
when 'interface'
|
147
|
+
@interface = value.intern
|
148
|
+
when 'opt_backdated'
|
149
|
+
@backdated = value == '1'
|
145
150
|
when 'opt_nocomments'
|
146
151
|
@comments = :none
|
147
152
|
when 'opt_noemail'
|
148
153
|
@comments = :noemail
|
149
|
-
when '
|
150
|
-
@
|
154
|
+
when 'opt_preformatted'
|
155
|
+
@preformatted = value == '1'
|
151
156
|
when 'opt_screening'
|
152
157
|
case value
|
153
158
|
when 'A'; @screening = :all
|
@@ -158,8 +163,10 @@ module LiveJournal
|
|
158
163
|
raise LiveJournalException,
|
159
164
|
"unknown opt_screening value #{value.inspect}"
|
160
165
|
end
|
161
|
-
when '
|
162
|
-
@
|
166
|
+
when 'picture_keyword'
|
167
|
+
@pickeyword = value
|
168
|
+
when 'taglist'
|
169
|
+
@taglist = value.split(/,\s/).sort
|
163
170
|
else
|
164
171
|
# LJ keeps adding props, so we store all leftovers in a hash.
|
165
172
|
# Unfortunately, we don't know which of these need to be passed
|
data/lib/livejournal/friends.rb
CHANGED
File without changes
|
data/lib/livejournal/login.rb
CHANGED
data/lib/livejournal/logjam.rb
CHANGED
File without changes
|
data/lib/livejournal/request.rb
CHANGED
File without changes
|
data/lib/livejournal/sync.rb
CHANGED
File without changes
|
data/sample/export
CHANGED
File without changes
|
data/sample/fuse
CHANGED
File without changes
|
data/sample/graph
CHANGED
File without changes
|
data/test/checkfriends.rb
CHANGED
File without changes
|
data/test/comments-xml.rb
CHANGED
File without changes
|
data/test/database.rb
CHANGED
File without changes
|
data/test/login.rb
CHANGED
File without changes
|
data/test/roundtrip.rb
CHANGED
File without changes
|
data/test/time.rb
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,44 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.0
|
3
|
-
specification_version: 1
|
4
2
|
name: livejournal
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
-
|
11
|
-
|
12
|
-
homepage: http://neugierig.org/software/livejournal/ruby/
|
13
|
-
rubyforge_project:
|
14
|
-
description: LiveJournal module. Post to livejournal, retrieve friends lists, edit entries, sync journal to an offline database.
|
15
|
-
autorequire:
|
16
|
-
default_executable:
|
17
|
-
bindir: bin
|
18
|
-
has_rdoc: true
|
19
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.0.0
|
24
|
-
version:
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 3
|
8
|
+
- 3
|
9
|
+
version: 0.3.3
|
25
10
|
platform: ruby
|
26
|
-
signing_key:
|
27
|
-
cert_chain:
|
28
|
-
post_install_message:
|
29
11
|
authors:
|
30
12
|
- Evan Martin
|
13
|
+
- Roman Shterenzon
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-04-23 00:00:00 +03:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: LiveJournal module. Post to livejournal, retrieve friends lists, edit entries, sync journal to an offline database.
|
23
|
+
email: romanbsd@yahoo.com
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files:
|
29
|
+
- LICENSE
|
30
|
+
- README.md
|
31
31
|
files:
|
32
|
-
- Rakefile
|
33
|
-
- README
|
34
32
|
- Changes
|
35
33
|
- LICENSE
|
36
|
-
-
|
37
|
-
-
|
38
|
-
- lib/livejournal
|
34
|
+
- README.md
|
35
|
+
- Rakefile
|
36
|
+
- lib/livejournal.rb
|
39
37
|
- lib/livejournal/basic.rb
|
40
38
|
- lib/livejournal/comment.rb
|
41
39
|
- lib/livejournal/comments-xml.rb
|
40
|
+
- lib/livejournal/database.rb
|
42
41
|
- lib/livejournal/entry.rb
|
43
42
|
- lib/livejournal/friends.rb
|
44
43
|
- lib/livejournal/login.rb
|
@@ -46,26 +45,52 @@ files:
|
|
46
45
|
- lib/livejournal/request.rb
|
47
46
|
- lib/livejournal/sync.rb
|
48
47
|
- sample/export
|
49
|
-
- sample/graph
|
50
48
|
- sample/fuse
|
49
|
+
- sample/graph
|
51
50
|
- sample/progressbar.rb
|
52
|
-
-
|
51
|
+
- setup.rb
|
53
52
|
- test/checkfriends.rb
|
54
53
|
- test/comments-xml.rb
|
55
54
|
- test/database.rb
|
56
|
-
- test/
|
55
|
+
- test/login.rb
|
57
56
|
- test/roundtrip.rb
|
58
|
-
|
57
|
+
- test/time.rb
|
58
|
+
has_rdoc: true
|
59
|
+
homepage: http://neugierig.org/software/livejournal/ruby/
|
60
|
+
licenses: []
|
59
61
|
|
62
|
+
post_install_message:
|
60
63
|
rdoc_options: []
|
61
64
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
version: "0"
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
segments:
|
81
|
+
- 0
|
82
|
+
version: "0"
|
68
83
|
requirements: []
|
69
84
|
|
70
|
-
|
71
|
-
|
85
|
+
rubyforge_project:
|
86
|
+
rubygems_version: 1.3.7
|
87
|
+
signing_key:
|
88
|
+
specification_version: 3
|
89
|
+
summary: Module for interacting with livejournal
|
90
|
+
test_files:
|
91
|
+
- test/checkfriends.rb
|
92
|
+
- test/comments-xml.rb
|
93
|
+
- test/database.rb
|
94
|
+
- test/login.rb
|
95
|
+
- test/roundtrip.rb
|
96
|
+
- test/time.rb
|