renren2 1.0.1 → 1.0.2
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/lib/renren2/interface/base.rb +3 -1
- data/lib/renren2/interface/photos.rb +4 -3
- data/lib/renren2/version.rb +1 -1
- metadata +6 -6
@@ -26,7 +26,7 @@ module Renren2
|
|
26
26
|
:v => "1.0",
|
27
27
|
:format => "JSON"}.merge(opts.delete(:body) || {})
|
28
28
|
.merge(opts.delete(:params) || {})
|
29
|
-
opts.merge!(:
|
29
|
+
opts.merge!(:body => params.merge(:sig => compute_sig(params)), :parse => :json)
|
30
30
|
|
31
31
|
# use the old server
|
32
32
|
path = "http://api.renren.com/restserver.do"
|
@@ -45,7 +45,9 @@ module Renren2
|
|
45
45
|
private
|
46
46
|
|
47
47
|
def compute_sig(params={})
|
48
|
+
params = params.reject {|k,v| v.class == Faraday::UploadIO }
|
48
49
|
str = params.collect {|k,v| "#{k}=#{v}"}.sort.join("") + @client.secret
|
50
|
+
p str
|
49
51
|
Digest::MD5.hexdigest(str)
|
50
52
|
end
|
51
53
|
end
|
@@ -40,7 +40,8 @@ module Renren2
|
|
40
40
|
|
41
41
|
# 上传照片到用户的相册,同时返回这张照片的信息
|
42
42
|
#
|
43
|
-
# @param [
|
43
|
+
# @param [String] upload 待上传照片路径
|
44
|
+
# @param [String] content_type 待上传照片格式
|
44
45
|
# @param [Hash] opts
|
45
46
|
# @option opts [String] :caption 照片的描述信息
|
46
47
|
# @option opts [int] :aid 相册的ID,如果指定此参数,将会传到指定相册,默认传到手机相册
|
@@ -48,9 +49,9 @@ module Renren2
|
|
48
49
|
# @note require "photo_upload" scope
|
49
50
|
#
|
50
51
|
# @see http://wiki.dev.renren.com/wiki/Photos.upload
|
51
|
-
def upload(upload, opts={})
|
52
|
+
def upload(upload, content_type, opts={})
|
52
53
|
check_scope "photo_upload"
|
53
|
-
post 'photos.upload', :body => {:upload => upload}.merge(opts)
|
54
|
+
post 'photos.upload', :body => {:upload => Faraday::UploadIO.new(upload, content_type)}.merge(opts)
|
54
55
|
end
|
55
56
|
|
56
57
|
# 获取可见照片的相关信息
|
data/lib/renren2/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: renren2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-05-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: oauth2
|
16
|
-
requirement: &
|
16
|
+
requirement: &70165702270120 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.5.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70165702270120
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: sqlite3
|
27
|
-
requirement: &
|
27
|
+
requirement: &70165702269320 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70165702269320
|
36
36
|
description: A wrapper for Renren OAuth2 API.
|
37
37
|
email:
|
38
38
|
- acenqiu@gmail.com
|