sina 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/lib/sina/base.rb +7 -2
  3. data/sina.gemspec +1 -1
  4. metadata +1 -1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.1.0
@@ -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
- request = Net::HTTP::Get.new("#{url.path}?access_token=#{@access_token}&#{params_to_string(params)}")
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
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sina}
8
- s.version = "0.0.3"
8
+ s.version = "0.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["goshan"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sina
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: