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 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.184.130:4567/callback"
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.184.130:4567/callback"
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
@@ -3,5 +3,3 @@ require "weibo_focus"
3
3
  puts Weibo::VERSION
4
4
  Weibo::Config.api_key = "12345678"
5
5
  puts Weibo::Config.api_key
6
-
7
- puts Weibo::INTFOCUS
data/lib/weibo_focus.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require "weibo_focus/version"
2
- #require "weibo_focus/config"
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
- #encoding:utf-8
23
- module Weibo
24
- module Config
25
-
26
- def self.api_key=(val)
27
- @@api_key = val
28
- end
29
-
30
- def self.api_key
31
- @@api_key
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
- #encoding:utf-8
23
- module Weibo
24
- module Config
25
-
26
- def self.api_key=(val)
27
- @@api_key = val
28
- end
29
-
30
- def self.api_key
31
- @@api_key
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
@@ -1,3 +1,3 @@
1
1
  module Weibo
2
- VERSION = "1.0.9"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -1,3 +1,3 @@
1
1
  module Weibo
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weibo_focus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: