renren 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -1
- data/README.rdoc +14 -3
- data/VERSION +1 -1
- data/lib/renren/base.rb +6 -1
- data/renren.gemspec +5 -2
- metadata +20 -4
data/Gemfile
CHANGED
data/README.rdoc
CHANGED
@@ -1,8 +1,19 @@
|
|
1
|
-
= renren
|
2
|
-
|
3
|
-
One of the goals of this gem was to have the same syntax as the twitter gem wherever possible so that it would be easy to learn and use. Download the gem and give it a try. Also, I've put together a small demo using sinatra showing how you can use the renren gem.
|
4
1
|
|
2
|
+
A third party, non-official renren API gem created by huangxiangdan. Inspired by ballantyne's weibo API gem.
|
5
3
|
|
6
4
|
To install the gem simply enter:
|
7
5
|
|
8
6
|
gem install renren
|
7
|
+
|
8
|
+
This is a minimalistic API implementation, where all function calls goes through a single method. For example to publish a feed item one might do the following:
|
9
|
+
|
10
|
+
param = {:method, "feed.publishFeed", :name, "foo", :description, "bar", :url, "http://jihua.fm"}
|
11
|
+
renren = Renren::Base.new(token)
|
12
|
+
renren.call_method(param)
|
13
|
+
|
14
|
+
You can use Omniauth-renren to get the token.Also you can visit https://github.com/huangxiangdan/renren-example to see the example.
|
15
|
+
|
16
|
+
This gem was made in the process of creating 计划FM [http://jihua.fm], please take a moment and go and check out that project for example usage.
|
17
|
+
|
18
|
+
== Sites using the renren gem
|
19
|
+
计划FM [http://jihua.fm]
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.13
|
data/lib/renren/base.rb
CHANGED
@@ -3,6 +3,7 @@ require 'uri'
|
|
3
3
|
require 'multi_json'
|
4
4
|
require 'net/http'
|
5
5
|
require 'digest'
|
6
|
+
require 'rest_client'
|
6
7
|
|
7
8
|
module Renren
|
8
9
|
class Base
|
@@ -17,10 +18,14 @@ module Renren
|
|
17
18
|
@params[:access_token] = access_token
|
18
19
|
end
|
19
20
|
|
20
|
-
def call_method(opts = {:method => users.
|
21
|
+
def call_method(opts = {:method => "users.getInfo"})
|
21
22
|
MultiJson.decode(Net::HTTP.post_form(URI.parse('http://api.renren.com/restserver.do'), update_params(opts)).body)
|
22
23
|
end
|
23
24
|
|
25
|
+
def upload_file(filename, opts = {})
|
26
|
+
MultiJson.decode(RestClient.post('http://api.renren.com/restserver.do', update_params(opts).merge(:upload => File.new(filename))))
|
27
|
+
end
|
28
|
+
|
24
29
|
private
|
25
30
|
def update_params(opts)
|
26
31
|
params = @params.merge(opts){|key, first, second| second}
|
data/renren.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{renren}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.13"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Huang Xiangdan"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2012-02-28}
|
13
13
|
s.description = %q{this gem is an adaptation of John Nunemaker's Twitter gem. I modified it to make api integration for 新浪微博 (t.sina.com.cn) easier.}
|
14
14
|
s.email = %q{xd_huang1986@163.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -41,13 +41,16 @@ Gem::Specification.new do |s|
|
|
41
41
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
42
42
|
s.add_runtime_dependency(%q<httparty>, [">= 0"])
|
43
43
|
s.add_runtime_dependency(%q<httparty>, [">= 0.5.2"])
|
44
|
+
s.add_runtime_dependency(%q<rest-client>, [">= 1.6.7"])
|
44
45
|
else
|
45
46
|
s.add_dependency(%q<httparty>, [">= 0"])
|
46
47
|
s.add_dependency(%q<httparty>, [">= 0.5.2"])
|
48
|
+
s.add_dependency(%q<rest-client>, [">= 1.6.7"])
|
47
49
|
end
|
48
50
|
else
|
49
51
|
s.add_dependency(%q<httparty>, [">= 0"])
|
50
52
|
s.add_dependency(%q<httparty>, [">= 0.5.2"])
|
53
|
+
s.add_dependency(%q<rest-client>, [">= 1.6.7"])
|
51
54
|
end
|
52
55
|
end
|
53
56
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: renren
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 13
|
10
|
+
version: 0.0.13
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Huang Xiangdan
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2012-02-28 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: httparty
|
@@ -47,6 +47,22 @@ dependencies:
|
|
47
47
|
version: 0.5.2
|
48
48
|
type: :runtime
|
49
49
|
version_requirements: *id002
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: rest-client
|
52
|
+
prerelease: false
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
hash: 1
|
59
|
+
segments:
|
60
|
+
- 1
|
61
|
+
- 6
|
62
|
+
- 7
|
63
|
+
version: 1.6.7
|
64
|
+
type: :runtime
|
65
|
+
version_requirements: *id003
|
50
66
|
description: "this gem is an adaptation of John Nunemaker's Twitter gem. I modified it to make api integration for \xE6\x96\xB0\xE6\xB5\xAA\xE5\xBE\xAE\xE5\x8D\x9A (t.sina.com.cn) easier."
|
51
67
|
email: xd_huang1986@163.com
|
52
68
|
executables: []
|