weibo2s 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +16 -9
- data/lib/weibo2s.rb +1 -1
- data/lib/weibo2s/version.rb +1 -1
- data/weibo2s.gemspec +3 -3
- metadata +4 -4
data/README.md
CHANGED
@@ -1,21 +1,25 @@
|
|
1
1
|
|
2
|
-
谢谢 simsicon
|
3
|
-
|
4
|
-
这个sdk请求weibo的api的方法是根据weibo_api.yml动态生成的。当微博的api接口有所变动时,可以更改weibo_api.yml来进行更新
|
2
|
+
谢谢 simsicon [weibo_2](https://github.com/simsicon/weibo_2)
|
5
3
|
|
6
4
|
# WeiboOAuth2
|
5
|
+
weibo2s sdk请求weibo的api的方法是根据weibo_api.yml动态生成的。
|
6
|
+
当微博的api接口有所变动时,可以更改weibo_api.yml来进行更新
|
7
7
|
|
8
|
-
|
8
|
+
需配置 config/weibo.yml,config/weibo_api.yml 到相应目录
|
9
9
|
|
10
10
|
## 安装
|
11
11
|
|
12
12
|
```bash
|
13
|
-
$
|
13
|
+
$ gem install weibo2s
|
14
|
+
```
|
15
|
+
或
|
16
|
+
```bash
|
17
|
+
$ get clone https://github.com/cloudorz/weibo2s.git
|
14
18
|
$ rake install
|
15
19
|
```
|
16
20
|
|
17
21
|
## 使用
|
18
|
-
|
22
|
+
具体实例可看example, 修改congig/weibo.yml中的api_key和api_secret
|
19
23
|
|
20
24
|
配置 api_key 和 api_secret
|
21
25
|
|
@@ -31,10 +35,12 @@ WeiboOAuth2::Config.api_secret = YOUR_SECRET
|
|
31
35
|
WeiboOAuth2::Config.redirect_uri = YOUR_CALLBACK_URL
|
32
36
|
```
|
33
37
|
配置微博api接口的yml
|
38
|
+
|
34
39
|
详见weibo_api.yml.example
|
35
|
-
config/weibo_api.yml
|
36
40
|
|
37
|
-
|
41
|
+
文件放置位置config/weibo_api.yml
|
42
|
+
|
43
|
+
1. 获取token
|
38
44
|
|
39
45
|
设置 YOUR_CALLBACK_URL as 'http://127.0.0.1/callback'
|
40
46
|
|
@@ -72,6 +78,7 @@ config/weibo_api.yml
|
|
72
78
|
pic = File.open(tmpfile.path)
|
73
79
|
client.statuses.upload({:status => "分享图片", :pic => pic})
|
74
80
|
```
|
81
|
+
具体使用参考[weibo wiki api说明](http://open.weibo.com/wiki/API%E6%96%87%E6%A1%A3_V2)
|
75
82
|
## 设置SSL
|
76
83
|
|
77
84
|
### Ubuntu
|
@@ -84,7 +91,7 @@ config/weibo_api.yml
|
|
84
91
|
# client = WeiboOAuth2::Client.new('', '', :ssl => {:ca_path => "/usr/lib/ssl/certs"})
|
85
92
|
```
|
86
93
|
|
87
|
-
###
|
94
|
+
### Heroku, Fedora, CentOS
|
88
95
|
|
89
96
|
```ruby
|
90
97
|
client = WeiboOAuth2::Client.new(YOUR_KEY, YOUR_SECRET, :ssl => {:ca_file => '/usr/lib/ssl/certs/ca-certificates.crt'})
|
data/lib/weibo2s.rb
CHANGED
@@ -22,5 +22,5 @@ end
|
|
22
22
|
if File.exists?('config/weibo_api.yml')
|
23
23
|
WeiboOAuth2::Config.apis = YAML.load_file('config/weibo_api.yml')
|
24
24
|
else
|
25
|
-
puts "No apis YAML file can't work."
|
25
|
+
puts "No apis YAML file can't work.\n You should make a config/weibo_api.yml file.\nLike: https://github.com/cloudorz/weibo2s/blob/master/weibo_api.yml.example"
|
26
26
|
end
|
data/lib/weibo2s/version.rb
CHANGED
data/weibo2s.gemspec
CHANGED
@@ -4,9 +4,9 @@ require File.expand_path('../lib/weibo2s/version', __FILE__)
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.authors = ["cloud"]
|
6
6
|
gem.email = ["cloud@gmail.com"]
|
7
|
-
gem.
|
8
|
-
gem.
|
9
|
-
gem.homepage = "https://github.com/cloudorz/
|
7
|
+
gem.summary = "A OAuth2 gem for weibo"
|
8
|
+
gem.description = "Dynamic API methods according to weibo API doc YML file"
|
9
|
+
gem.homepage = "https://github.com/cloudorz/weibo2s"
|
10
10
|
|
11
11
|
gem.files = `git ls-files`.split($\)
|
12
12
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: weibo2s
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -91,7 +91,7 @@ dependencies:
|
|
91
91
|
- - ~>
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
version: 1.6.7
|
94
|
-
description:
|
94
|
+
description: Dynamic API methods according to weibo API doc YML file
|
95
95
|
email:
|
96
96
|
- cloud@gmail.com
|
97
97
|
executables: []
|
@@ -126,7 +126,7 @@ files:
|
|
126
126
|
- weibo.yml.example
|
127
127
|
- weibo2s.gemspec
|
128
128
|
- weibo_api.yml.example
|
129
|
-
homepage: https://github.com/cloudorz/
|
129
|
+
homepage: https://github.com/cloudorz/weibo2s
|
130
130
|
licenses: []
|
131
131
|
post_install_message:
|
132
132
|
rdoc_options: []
|
@@ -149,6 +149,6 @@ rubyforge_project:
|
|
149
149
|
rubygems_version: 1.8.24
|
150
150
|
signing_key:
|
151
151
|
specification_version: 3
|
152
|
-
summary: A
|
152
|
+
summary: A OAuth2 gem for weibo
|
153
153
|
test_files:
|
154
154
|
- spec/client_spec.rb
|