weibo_focus 1.0.9 → 1.1.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/example/example.rb +1 -2
- data/example/example.rb~ +4 -2
- data/example/weibo.rb +0 -2
- data/lib/weibo_focus.rb +11 -30
- data/lib/weibo_focus.rb~ +10 -29
- data/lib/weibo_focus/version.rb +1 -1
- data/lib/weibo_focus/version.rb~ +1 -1
- metadata +1 -1
data/example/example.rb
CHANGED
@@ -9,7 +9,7 @@ Bundler.setup
|
|
9
9
|
|
10
10
|
Weibo::Config.api_key = "1713173982"
|
11
11
|
Weibo::Config.api_secret = "62170dacd0fa1c70d4eb1263a0855744"
|
12
|
-
Weibo::Config.redirect_uri = "http://192.168.
|
12
|
+
Weibo::Config.redirect_uri = "http://192.168.1.3:4567/users/auth/weibo/callback"
|
13
13
|
|
14
14
|
get '/' do
|
15
15
|
client = Weibo::Client.new
|
@@ -18,7 +18,6 @@ get '/' do
|
|
18
18
|
p "*" * 80 + "validated"
|
19
19
|
p token.inspect
|
20
20
|
p token.validated?
|
21
|
-
|
22
21
|
unless token.validated?
|
23
22
|
reset_session
|
24
23
|
redirect '/connect'
|
data/example/example.rb~
CHANGED
@@ -9,7 +9,7 @@ Bundler.setup
|
|
9
9
|
|
10
10
|
Weibo::Config.api_key = "1713173982"
|
11
11
|
Weibo::Config.api_secret = "62170dacd0fa1c70d4eb1263a0855744"
|
12
|
-
Weibo::Config.redirect_uri = "http://192.168.
|
12
|
+
Weibo::Config.redirect_uri = "http://192.168.1.3:4567/users/auth/weibo/callback"
|
13
13
|
|
14
14
|
get '/' do
|
15
15
|
client = Weibo::Client.new
|
@@ -18,7 +18,6 @@ get '/' do
|
|
18
18
|
p "*" * 80 + "validated"
|
19
19
|
p token.inspect
|
20
20
|
p token.validated?
|
21
|
-
|
22
21
|
unless token.validated?
|
23
22
|
reset_session
|
24
23
|
redirect '/connect'
|
@@ -29,6 +28,9 @@ get '/' do
|
|
29
28
|
@user = client.users.show_by_uid(session[:uid])
|
30
29
|
@statuses = client.statuses
|
31
30
|
end
|
31
|
+
|
32
|
+
p "uid:#{session[:uid]}"
|
33
|
+
p "access_token:#{session[:access_token]}"
|
32
34
|
haml :index
|
33
35
|
end
|
34
36
|
|
data/example/weibo.rb
CHANGED
data/lib/weibo_focus.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require "weibo_focus/version"
|
2
|
-
|
2
|
+
require "weibo_focus/config"
|
3
3
|
require "weibo_focus/base"
|
4
4
|
require "weibo_focus/client"
|
5
5
|
require "weibo_focus/access_token"
|
@@ -19,33 +19,14 @@ require "weibo_focus/api/v2/suggestions"
|
|
19
19
|
require "weibo_focus/api/v2/remind"
|
20
20
|
require "weibo_focus/strategy/auth_code"
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
|
-
def self.api_secret=(val)
|
35
|
-
@@api_secret = val
|
36
|
-
end
|
37
|
-
|
38
|
-
def self.api_secret
|
39
|
-
@@api_secret
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.redirect_uri=(val)
|
43
|
-
@@redirect_uri = val
|
44
|
-
end
|
45
|
-
|
46
|
-
def self.redirect_uri
|
47
|
-
@@redirect_uri
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
22
|
+
if File.exists?('config/weibo.yml')
|
23
|
+
weibo_oauth = YAML.load_file('config/weibo.yml')[ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development"]
|
24
|
+
Weibo::Config.api_key = weibo_oauth["api_key"]
|
25
|
+
Weibo::Config.api_secret = weibo_oauth["api_secret"]
|
26
|
+
Weibo::Config.redirect_uri = weibo_oauth["redirect_uri"]
|
27
|
+
else
|
28
|
+
puts "\n\n=========================================================\n\n" +
|
29
|
+
" You haven't made a config/weibo.yml file.\n\n You should. \n\n The weibo gem will work much better if you do\n\n" +
|
30
|
+
" Please set Weibo::Config.api_key and \n Weibo::Config.api_secret\n Weibo::Config.redirect_uri\n somewhere in your initialization process\n\n" +
|
31
|
+
"=========================================================\n\n"
|
51
32
|
end
|
data/lib/weibo_focus.rb~
CHANGED
@@ -19,33 +19,14 @@ require "weibo_focus/api/v2/suggestions"
|
|
19
19
|
require "weibo_focus/api/v2/remind"
|
20
20
|
require "weibo_focus/strategy/auth_code"
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
|
-
def self.api_secret=(val)
|
35
|
-
@@api_secret = val
|
36
|
-
end
|
37
|
-
|
38
|
-
def self.api_secret
|
39
|
-
@@api_secret
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.redirect_uri=(val)
|
43
|
-
@@redirect_uri = val
|
44
|
-
end
|
45
|
-
|
46
|
-
def self.redirect_uri
|
47
|
-
@@redirect_uri
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
22
|
+
if File.exists?('config/weibo.yml')
|
23
|
+
weibo_oauth = YAML.load_file('config/weibo.yml')[ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development"]
|
24
|
+
Weibo::Config.api_key = weibo_oauth["api_key"]
|
25
|
+
Weibo::Config.api_secret = weibo_oauth["api_secret"]
|
26
|
+
Weibo::Config.redirect_uri = weibo_oauth["redirect_uri"]
|
27
|
+
else
|
28
|
+
puts "\n\n=========================================================\n\n" +
|
29
|
+
" You haven't made a config/weibo.yml file.\n\n You should. \n\n The weibo gem will work much better if you do\n\n" +
|
30
|
+
" Please set Weibo::Config.api_key and \n Weibo::Config.api_secret\n Weibo::Config.redirect_uri\n somewhere in your initialization process\n\n" +
|
31
|
+
"=========================================================\n\n"
|
51
32
|
end
|
data/lib/weibo_focus/version.rb
CHANGED
data/lib/weibo_focus/version.rb~
CHANGED