weibo_2 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -17
- data/lib/weibo_2/api/v2/base.rb +2 -2
- data/lib/weibo_2/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 804567e4d657756fd85e6f1ee69d157af8a70c5d
|
4
|
+
data.tar.gz: 62c245c552dbaa0802162bf77442bcda0512bac7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2ab72bcc012887524bbdbf7f75ea27950b2f81891dd6860f45149e5aec11a35b1ae2474410a3c9e460ebb97a83b84aa2073fc8424bad12314c3a5fe065d6e5e
|
7
|
+
data.tar.gz: c0ffcc212443c76091d9c2e08865a145fb8418e5acbfcfdbbc3e6f144a88559da0d1898b098a20ef522c5f2662220ccfed03dc5681c7dc406714a79f27da80f6
|
data/README.md
CHANGED
@@ -73,36 +73,37 @@ It should work.
|
|
73
73
|
Upload a picture.
|
74
74
|
|
75
75
|
```ruby
|
76
|
-
|
77
|
-
|
76
|
+
pic = params[:file].delete(:tempfile)
|
77
|
+
client.statuses.upload(params[:status], pic, params[:file])
|
78
78
|
```
|
79
79
|
|
80
80
|
pass params[:file] into upload method as options could help weibo_2 to build post body, useful options as:
|
81
81
|
* filename, filename with extension of the uploading file, example 'pic.jpg'
|
82
82
|
* type, mime type of the uploading file, example 'image/jpeg'
|
83
|
+
|
83
84
|
## Setting up SSL certificates
|
84
85
|
|
85
|
-
|
86
|
+
This gem using [faraday](https://github.com/technoweenie/faraday) for connection, which supports ssl. According to [this article](https://github.com/technoweenie/faraday/wiki/Setting-up-SSL-certificates), you can do as following to support ssl connection.
|
86
87
|
|
87
|
-
|
88
|
+
### Ubuntu
|
88
89
|
|
89
|
-
|
90
|
+
To locate your SSL certificate folder, type `openssl version -a`. Append `/certs` to the OPENSSLDIR listed, here it would be `/usr/lib/ssl/certs`.
|
90
91
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
92
|
+
```ruby
|
93
|
+
client = WeiboOAuth2::Client.new(YOUR_KEY, YOUR_SECRET, :ssl => {:ca_path => "/usr/lib/ssl/certs"})
|
94
|
+
# or as below if you have set WeiboOAuth2::Config.api_key and WeiboOAuth2::Config.api_secret already
|
95
|
+
# client = WeiboOAuth2::Client.new('', '', :ssl => {:ca_path => "/usr/lib/ssl/certs"})
|
96
|
+
```
|
96
97
|
|
97
|
-
|
98
|
+
### On Heroku, Fedora, CentOS
|
98
99
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
100
|
+
```ruby
|
101
|
+
client = WeiboOAuth2::Client.new(YOUR_KEY, YOUR_SECRET, :ssl => {:ca_file => '/usr/lib/ssl/certs/ca-certificates.crt'})
|
102
|
+
# or as below if you have set WeiboOAuth2::Config.api_key and WeiboOAuth2::Config.api_secret already
|
103
|
+
# client = WeiboOAuth2::Client.new('', '', :ssl => {:ca_file => '/usr/lib/ssl/certs/ca-certificates.crt'})
|
104
|
+
```
|
104
105
|
|
105
|
-
|
106
|
+
For Fedora and CentOS, use the path and file `/etc/pki/tls/certs/ca-bundle.crt` instead, or find your system path with `openssl version -a`.
|
106
107
|
|
107
108
|
## Integrate with Devise and omniauth
|
108
109
|
|
data/lib/weibo_2/api/v2/base.rb
CHANGED
@@ -55,12 +55,12 @@ module WeiboOAuth2
|
|
55
55
|
mime_type = opts.delete(:type) || mime_type(value.path)
|
56
56
|
|
57
57
|
body << bin_encode("Content-Disposition: form-data; name=\"#{esc_key}\"; filename=\"#{filename}\"#{CRLF}")
|
58
|
-
body << bin_encode("Content-Type: #{mime_type}#{CRLF
|
58
|
+
body << bin_encode("Content-Type: #{mime_type}#{CRLF}")
|
59
|
+
body << bin_encode("Content-Transfer-Encoding: binary#{CRLF*2}")
|
59
60
|
body << bin_encode(value.read)
|
60
61
|
else
|
61
62
|
body << bin_encode("Content-Disposition: form-data; name=\"#{esc_key}\"#{CRLF*2}#{value}")
|
62
63
|
end
|
63
|
-
body << bin_encode("Content-Transfer-Encoding: binary")
|
64
64
|
body << bin_encode(CRLF)
|
65
65
|
|
66
66
|
end
|
data/lib/weibo_2/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: weibo_2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- simsicon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|