weibo2_plugins 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +13 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +18 -0
- data/lib/weibo2_plugins/version.rb +3 -0
- data/lib/weibo2_plugins/weibo2_plugins.rb +42 -0
- data/lib/weibo2_plugins.rb +12 -0
- data/weibo2_plugins.gemspec +20 -0
- metadata +55 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 alex
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Weibo2Plugins
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'weibo2_plugins'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install weibo2_plugins
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
require "bundler/gem_tasks"
|
3
|
+
|
4
|
+
require 'rspec/core'
|
5
|
+
require 'rspec/core/rake_task'
|
6
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
7
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
8
|
+
end
|
9
|
+
|
10
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
11
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
12
|
+
spec.rcov = true
|
13
|
+
end
|
14
|
+
|
15
|
+
task :default => :spec
|
16
|
+
|
17
|
+
require 'yard'
|
18
|
+
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# This is weibo2 client interface
|
2
|
+
# author alex_tian
|
3
|
+
require 'typhoeus'
|
4
|
+
|
5
|
+
module Weibo2Plugins
|
6
|
+
# Weibo2Plugins::Base.get_call_back_url('2154274819','74e4428b7ed95bf47317ee31075ea802',"http://www.tianji.com/api/users/weibo_callback")
|
7
|
+
class Base
|
8
|
+
def initialize(weibo_key,weibo_secret,call_back_url)
|
9
|
+
Weibo2::Config.api_key = weibo_key
|
10
|
+
Weibo2::Config.api_secret = weibo_secret
|
11
|
+
Weibo2::Config.redirect_uri = call_back_url
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.get_call_back_url call_back_url
|
15
|
+
Base.new call_back_url
|
16
|
+
client = Weibo2::Client.new
|
17
|
+
client.auth_code.authorize_url(:response_type => "token")
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
# Weibo2Plugins::Tools::Base.get_friend('1925715145','/friendships/friends.json','2.00hTG1GCDSHn2C64fbb3f2d30n2pHb')
|
22
|
+
module Tools
|
23
|
+
class Base
|
24
|
+
HOST = "https://api.weibo.com/2"
|
25
|
+
def self.get_friend(uid,url,access_token)
|
26
|
+
params = {uid: uid, access_token: access_token, count: 200}
|
27
|
+
atts = {
|
28
|
+
headers: {"Content-Type" => "application/json","Accept"=>"application/json;charset=utf-8","User-Agent"=>"Mozilla/5.0 (X11; Linux x86_64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1"},
|
29
|
+
method: :get, timeout: 3000, :cache_timeout => 0, params: params
|
30
|
+
}
|
31
|
+
request = Typhoeus::Request.new("#{HOST}#{url}",atts)
|
32
|
+
hydra = Typhoeus::Hydra.new
|
33
|
+
hydra.queue(request)
|
34
|
+
hydra.run
|
35
|
+
|
36
|
+
result = $json.decode(request.response.body)
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'weibo2_plugins/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "weibo2_plugins"
|
8
|
+
gem.platform = Gem::Platform::RUBY
|
9
|
+
gem.version = Weibo2Plugins::VERSION
|
10
|
+
gem.authors = ["alex_tian"]
|
11
|
+
gem.email = ["peterwillcn@gmail.com"]
|
12
|
+
gem.description = %q{a weibo2 plugs,easy get callback_url and interface data array.}
|
13
|
+
gem.summary = %q{a weibo2 plugs}
|
14
|
+
gem.homepage = "http://www.openxid.com"
|
15
|
+
|
16
|
+
gem.files = `git ls-files`.split($/)
|
17
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
18
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
|
+
gem.require_paths = ["lib"]
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: weibo2_plugins
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- alex_tian
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-10-12 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: a weibo2 plugs,easy get callback_url and interface data array.
|
15
|
+
email:
|
16
|
+
- peterwillcn@gmail.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- .gitignore
|
22
|
+
- Gemfile
|
23
|
+
- LICENSE.txt
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- lib/weibo2_plugins.rb
|
27
|
+
- lib/weibo2_plugins/version.rb
|
28
|
+
- lib/weibo2_plugins/weibo2_plugins.rb
|
29
|
+
- weibo2_plugins.gemspec
|
30
|
+
homepage: http://www.openxid.com
|
31
|
+
licenses: []
|
32
|
+
post_install_message:
|
33
|
+
rdoc_options: []
|
34
|
+
require_paths:
|
35
|
+
- lib
|
36
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ! '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
requirements: []
|
49
|
+
rubyforge_project:
|
50
|
+
rubygems_version: 1.8.24
|
51
|
+
signing_key:
|
52
|
+
specification_version: 3
|
53
|
+
summary: a weibo2 plugs
|
54
|
+
test_files: []
|
55
|
+
has_rdoc:
|