livejournal 0.3.1 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Changes CHANGED
@@ -1,4 +1,10 @@
1
- 0.2.1: Sat, 06 Jan 2007 10:21:05 -0800
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.
@@ -1,50 +1,57 @@
1
- =ljrb: LiveJournal Ruby module
1
+ # ljrb: LiveJournal Ruby module
2
2
 
3
- Copyright:: Copyright (C) 2005 Evan Martin <martine@danga.com>
4
- Website:: http://neugierig.org/software/livejournal/ruby
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
- require 'livejournal/login'
8
+ require 'livejournal/login'
8
9
 
9
- puts "Logging in..."
10
- user = LiveJournal::User.new('test', 'test')
11
- login = LiveJournal::Request::Login.new(user)
12
- login.run
10
+ puts "Logging in..."
11
+ user = LiveJournal::User.new('test', 'test')
12
+ login = LiveJournal::Request::Login.new(user)
13
+ login.run
13
14
 
14
- puts "Login response:"
15
- login.dumpresponse
15
+ puts "Login response:"
16
+ login.dumpresponse
16
17
 
17
- puts "User's full name: #{user.fullname}"
18
+ puts "User's full name: #{user.fullname}"
18
19
 
19
- ==LiveJournal Datatypes
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
- ==Implemented Requests
27
- ===Login Requests
27
+ ## Implemented Requests
28
+
29
+ ### Login Requests
28
30
  * LiveJournal::Request::Login
29
- ===Friend Requests
31
+
32
+ ### Friend Requests
30
33
  * LiveJournal::Request::Friends
31
34
  * LiveJournal::Request::FriendOfs
32
35
  * LiveJournal::Request::CheckFriends
33
- ===Entry Requests
36
+
37
+ ### Entry Requests
34
38
  * LiveJournal::Request::PostEvent
35
39
  * LiveJournal::Request::GetEvents
36
40
  * LiveJournal::Request::EditEvent
37
41
 
38
- ==Journal Offline Synchronization
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
- ==SQLite3 Support
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
- ==Other Features
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
- spec = Gem::Specification.new do |s|
16
- s.name = PKG_NAME
17
- s.version = PKG_VERSION
18
- s.summary = 'module for interacting with livejournal'
19
- s.description = %q{LiveJournal module. Post to livejournal, retrieve friends
20
- lists, edit entries, sync journal to an offline database.}
21
- s.author = 'Evan Martin'
22
- s.email = 'martine@danga.com'
23
- s.homepage = 'http://neugierig.org/software/livejournal/ruby/'
24
-
25
- s.has_rdoc = true
26
- s.files = FILES.to_a
27
- end
28
-
29
- desc 'Build Package'
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 :
@@ -0,0 +1,6 @@
1
+ require 'livejournal/entry'
2
+ require 'livejournal/login'
3
+
4
+ module LiveJournal
5
+ VERSION = File.read(File.expand_path('../../VERSION',__FILE__)).chomp.freeze
6
+ end
@@ -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
@@ -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
@@ -54,7 +54,7 @@ module LiveJournal
54
54
  posterid INTEGER,
55
55
  itemid INTEGER,
56
56
  parentid INTEGER,
57
- state TEXT, -- screened/deleted/active
57
+ state TEXT, -- screened/deleted/frozen/active
58
58
  subject TEXT,
59
59
  body TEXT,
60
60
  timestamp INTEGER -- unix timestamp
@@ -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
- KNOWN_EXTRA_PROPS = %w{revnum revtime commentalter unknown8bit useragent}
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 = nil
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.to_i
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 'current_location'
138
- @location = value
139
- when 'taglist'
140
- @taglist = value.split(/, /).sort
141
- when 'picture_keyword'
142
- @pickeyword = value
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 'opt_backdated'
150
- @backdated = value == '1'
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 'hasscreened'
162
- @screened = value == '1'
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
File without changes
@@ -36,6 +36,7 @@ module LiveJournal
36
36
  super
37
37
  u = @user # should we clone here?
38
38
  u.fullname = @result['name']
39
+ u.journals = @result.select{|k,v| k=~/^access_\d+/}.collect{|k,v| v}.sort
39
40
  u
40
41
  end
41
42
  end
File without changes
File without changes
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
- version: 0.3.1
7
- date: 2007-01-06 00:00:00 -08:00
8
- summary: module for interacting with livejournal
9
- require_paths:
10
- - lib
11
- email: martine@danga.com
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
- - setup.rb
37
- - lib/livejournal
38
- - lib/livejournal/database.rb
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
- - test/login.rb
51
+ - setup.rb
53
52
  - test/checkfriends.rb
54
53
  - test/comments-xml.rb
55
54
  - test/database.rb
56
- - test/time.rb
55
+ - test/login.rb
57
56
  - test/roundtrip.rb
58
- test_files: []
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
- extra_rdoc_files: []
63
-
64
- executables: []
65
-
66
- extensions: []
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
- dependencies: []
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