sina 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/sina/base.rb +7 -2
- data/sina.gemspec +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/lib/sina/base.rb
CHANGED
@@ -14,11 +14,16 @@ module Sina
|
|
14
14
|
@access_token = access_token
|
15
15
|
end
|
16
16
|
|
17
|
-
def call_method(function = "users/show", params)
|
17
|
+
def call_method(type, function = "users/show", params)
|
18
18
|
url = URI.parse("https://api.weibo.com/2/#{function}.json")
|
19
19
|
http = Net::HTTP.new(url.host, url.port)
|
20
20
|
http.use_ssl = true if url.scheme == 'https'
|
21
|
-
|
21
|
+
if type == "get"
|
22
|
+
request = Net::HTTP::Get.new("#{url.path}?access_token=#{@access_token}&#{params_to_string(params)}")
|
23
|
+
elsif type == "post"
|
24
|
+
request = Net::HTTP::Post.new("#{url.path}?access_token=#{@access_token}")
|
25
|
+
request.set_form_data(params)
|
26
|
+
end
|
22
27
|
MultiJson.decode(http.request(request).body)
|
23
28
|
end
|
24
29
|
|
data/sina.gemspec
CHANGED