lj 0.1.0 → 0.2.0
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/Readme.txt +13 -0
- data/VERSION.yml +1 -1
- data/lib/lj.rb +2 -3
- data/lib/lj/base.rb +14 -13
- data/lib/lj/client.rb +1 -1
- data/lib/lj/request.rb +6 -4
- metadata +3 -2
data/Readme.txt
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Current alpha version of API to work with LiveJournal
|
2
|
+
|
3
|
+
sudo gem install lj
|
4
|
+
|
5
|
+
/////
|
6
|
+
|
7
|
+
require 'rubygems'
|
8
|
+
require 'lj'
|
9
|
+
|
10
|
+
auth = LJ::Client.new('username', 'password')
|
11
|
+
client = LJ::Base.new(auth)
|
12
|
+
client.event(title,body,keywords) #Post message to your journal
|
13
|
+
client.comunity(comunity_name,title,body,keywords) # Post Message to your community
|
data/VERSION.yml
CHANGED
data/lib/lj.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'forwardable'
|
2
1
|
require 'rubygems'
|
3
2
|
|
4
3
|
module LJ
|
@@ -23,8 +22,8 @@ end
|
|
23
22
|
|
24
23
|
directory = File.expand_path(File.dirname(__FILE__))
|
25
24
|
|
26
|
-
require File.join(directory, 'lj', '
|
25
|
+
require File.join(directory, 'lj', 'client')
|
27
26
|
require File.join(directory, 'lj', 'request')
|
28
27
|
require File.join(directory, 'lj', 'base')
|
29
|
-
|
28
|
+
|
30
29
|
|
data/lib/lj/base.rb
CHANGED
@@ -6,14 +6,14 @@ module LJ
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def event(title,body,keywords)
|
9
|
-
options = base_event
|
9
|
+
options = base_event(title,body,keywords)
|
10
10
|
perform('postevent',options)
|
11
11
|
end
|
12
12
|
|
13
13
|
def comunity(comynity_name,title,body,keywords)
|
14
|
-
options = base_event
|
14
|
+
options = base_event(title,body,keywords)
|
15
15
|
options["usejournal"]=comynity_name
|
16
|
-
perform('
|
16
|
+
perform('postevent',options)
|
17
17
|
end
|
18
18
|
|
19
19
|
|
@@ -26,22 +26,23 @@ module LJ
|
|
26
26
|
def common_options
|
27
27
|
t=Time.now
|
28
28
|
options = {}
|
29
|
-
options["year"]=t.year
|
30
|
-
options["mon"]=t.mon
|
31
|
-
options["day"]=t.day
|
32
|
-
options["hour"]=t.hour
|
33
|
-
options["min"]=t.min
|
29
|
+
options["year"] = t.year
|
30
|
+
options["mon"] = t.mon
|
31
|
+
options["day"] = t.day
|
32
|
+
options["hour"] = t.hour
|
33
|
+
options["min"] = t.min
|
34
|
+
options["ver"] = 1
|
34
35
|
options['username'] = @client.username
|
35
36
|
options['password'] = @client.password
|
36
37
|
options
|
37
38
|
end
|
38
39
|
|
39
|
-
def base_event
|
40
|
+
def base_event(title,body,keywords)
|
40
41
|
options = common_options()
|
41
|
-
options["mode"]="postevent"
|
42
|
-
options["
|
43
|
-
options["subject"]=title
|
44
|
-
options["event"]=body
|
42
|
+
options["mode"] = "postevent"
|
43
|
+
options["props"] = {:taglist => keywords}
|
44
|
+
options["subject"] = title
|
45
|
+
options["event"] = body
|
45
46
|
options
|
46
47
|
end
|
47
48
|
end
|
data/lib/lj/client.rb
CHANGED
data/lib/lj/request.rb
CHANGED
@@ -3,8 +3,10 @@ require 'xmlrpc/client'
|
|
3
3
|
module LJ
|
4
4
|
class Request
|
5
5
|
|
6
|
-
def initialize(
|
7
|
-
|
6
|
+
def initialize( function , options)
|
7
|
+
@client = XMLRPC::Client.new( "www.livejournal.com", "/interface/xmlrpc")
|
8
|
+
@function = function
|
9
|
+
@options = options
|
8
10
|
end
|
9
11
|
|
10
12
|
def self.perform(function,options = {})
|
@@ -12,8 +14,8 @@ module LJ
|
|
12
14
|
end
|
13
15
|
|
14
16
|
|
15
|
-
def send(
|
16
|
-
|
17
|
+
def send()
|
18
|
+
@client.call("LJ.XMLRPC.#{@function}", @options)
|
17
19
|
end
|
18
20
|
|
19
21
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dieinzige
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-12-
|
12
|
+
date: 2009-12-24 00:00:00 +03:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -24,6 +24,7 @@ extra_rdoc_files: []
|
|
24
24
|
files:
|
25
25
|
- License
|
26
26
|
- Rakefile
|
27
|
+
- Readme.txt
|
27
28
|
- VERSION.yml
|
28
29
|
- lib/lj.rb
|
29
30
|
- lib/lj/base.rb
|