tunkrank 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
@@ -0,0 +1,21 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
data/LICENSE ADDED
@@ -0,0 +1,30 @@
1
+ Copyright (c) 2010, Jason Adams
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions
6
+ are met:
7
+
8
+ * Redistributions of source code must retain the above copyright notice,
9
+ this list of conditions and the following disclaimer.
10
+
11
+ * Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ * Neither the name of TunkRank nor the names of its contributors may be used
16
+ to endorse or promote products derived from this software without specific
17
+ prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29
+ THE POSSIBILITY OF SUCH DAMAGE.
30
+
@@ -0,0 +1,32 @@
1
+ # TunkRank
2
+
3
+ Interface to the [TunkRank API](http://tunkrank.com/api). [TunkRank](http://tunkrank.com) is a tool that measures a person's influence on Twitter by looking at how much attention your followers can actually give you. You can read more [here](http://tunrkank.com/about).
4
+
5
+ ## Usage
6
+
7
+ The TunkRank API supports two main methods: `score` and `refresh`. The gem includes two convenience methods for returning just the raw score or just the ranking.
8
+
9
+ require 'tunkrank'
10
+ TunkRank.score('ealdent')
11
+ TunkRank.raw_score('ealdent') # => 6.87
12
+ TunkRank.ranking('ealdent') # => 21
13
+ TunkRank.refresh('ealdent')
14
+
15
+
16
+ The result of the `score` method is a `Hash` that looks like the following
17
+
18
+ {
19
+ "twitter_user" => {
20
+ "ranking" => 21,
21
+ "raw_tunkrank_score" => 6.87,
22
+ "tunkrank_computed_at" => "2010-03-25T00:20:13Z",
23
+ "num_followers" => 575,
24
+ "num_friends" => 219,
25
+ "twitter_id" => 8454562,
26
+ "screen_name" => "ealdent"
27
+ }
28
+ }
29
+
30
+ ## Copyright
31
+
32
+ Copyright (c) 2010 Jason Adams. See LICENSE for details.
@@ -0,0 +1,51 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "tunkrank"
8
+ gem.summary = %Q{Interface to the TunkRank API.}
9
+ gem.description = %Q{RESTful interface to the TunkRank API.}
10
+ gem.email = "jasonmadams@gmail.com"
11
+ gem.homepage = "http://github.com/ealdent/tunkrank"
12
+ gem.authors = ["Jason Adams"]
13
+ end
14
+ Jeweler::GemcutterTasks.new
15
+ rescue LoadError
16
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
17
+ end
18
+
19
+ require 'rake/testtask'
20
+ Rake::TestTask.new(:test) do |test|
21
+ test.libs << 'lib' << 'test'
22
+ test.pattern = 'test/**/test_*.rb'
23
+ test.verbose = true
24
+ end
25
+
26
+ begin
27
+ require 'rcov/rcovtask'
28
+ Rcov::RcovTask.new do |test|
29
+ test.libs << 'test'
30
+ test.pattern = 'test/**/test_*.rb'
31
+ test.verbose = true
32
+ end
33
+ rescue LoadError
34
+ task :rcov do
35
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
36
+ end
37
+ end
38
+
39
+ task :test => :check_dependencies
40
+
41
+ task :default => :test
42
+
43
+ require 'rake/rdoctask'
44
+ Rake::RDocTask.new do |rdoc|
45
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
46
+
47
+ rdoc.rdoc_dir = 'rdoc'
48
+ rdoc.title = "tunkrank #{version}"
49
+ rdoc.rdoc_files.include('README*')
50
+ rdoc.rdoc_files.include('lib/**/*.rb')
51
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.9.0
@@ -0,0 +1,31 @@
1
+ require 'httparty'
2
+
3
+ class TunkRankError < StandardError; end
4
+
5
+ class TunkRank
6
+ include HTTParty
7
+
8
+ base_uri 'http://tunkrank.com'
9
+
10
+ class << self
11
+ def score(twitter_user)
12
+ get("/score/#{twitter_user}.json")
13
+ rescue
14
+ raise TunkRankError, "Unable to fetch score for #{twitter_user}."
15
+ end
16
+
17
+ def raw_score(twitter_user)
18
+ score(twitter_user)['twitter_user']['raw_tunkrank_score']
19
+ end
20
+
21
+ def ranking(twitter_user)
22
+ score(twitter_user)['twitter_user']['ranking']
23
+ end
24
+
25
+ def refresh(twitter_user)
26
+ get("/refresh/#{twitter_user}.json")
27
+ rescue
28
+ raise TunkRankError, "Unable to refresh #{twitter_user}."
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'tunkrank'
8
+
9
+ class Test::Unit::TestCase
10
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestTunkrank < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
@@ -0,0 +1,51 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{tunkrank}
8
+ s.version = "0.9.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Jason Adams"]
12
+ s.date = %q{2010-03-24}
13
+ s.description = %q{RESTful interface to the TunkRank API.}
14
+ s.email = %q{jasonmadams@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.markdown"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ "LICENSE",
23
+ "README.markdown",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "lib/tunkrank.rb",
27
+ "test/helper.rb",
28
+ "test/test_tunkrank.rb",
29
+ "tunkrank.gemspec"
30
+ ]
31
+ s.homepage = %q{http://github.com/ealdent/tunkrank}
32
+ s.rdoc_options = ["--charset=UTF-8"]
33
+ s.require_paths = ["lib"]
34
+ s.rubygems_version = %q{1.3.6}
35
+ s.summary = %q{Interface to the TunkRank API.}
36
+ s.test_files = [
37
+ "test/helper.rb",
38
+ "test/test_tunkrank.rb"
39
+ ]
40
+
41
+ if s.respond_to? :specification_version then
42
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
43
+ s.specification_version = 3
44
+
45
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
46
+ else
47
+ end
48
+ else
49
+ end
50
+ end
51
+
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tunkrank
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 9
8
+ - 0
9
+ version: 0.9.0
10
+ platform: ruby
11
+ authors:
12
+ - Jason Adams
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-03-24 00:00:00 -04:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: RESTful interface to the TunkRank API.
22
+ email: jasonmadams@gmail.com
23
+ executables: []
24
+
25
+ extensions: []
26
+
27
+ extra_rdoc_files:
28
+ - LICENSE
29
+ - README.markdown
30
+ files:
31
+ - .document
32
+ - .gitignore
33
+ - LICENSE
34
+ - README.markdown
35
+ - Rakefile
36
+ - VERSION
37
+ - lib/tunkrank.rb
38
+ - test/helper.rb
39
+ - test/test_tunkrank.rb
40
+ - tunkrank.gemspec
41
+ has_rdoc: true
42
+ homepage: http://github.com/ealdent/tunkrank
43
+ licenses: []
44
+
45
+ post_install_message:
46
+ rdoc_options:
47
+ - --charset=UTF-8
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ segments:
55
+ - 0
56
+ version: "0"
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ segments:
62
+ - 0
63
+ version: "0"
64
+ requirements: []
65
+
66
+ rubyforge_project:
67
+ rubygems_version: 1.3.6
68
+ signing_key:
69
+ specification_version: 3
70
+ summary: Interface to the TunkRank API.
71
+ test_files:
72
+ - test/helper.rb
73
+ - test/test_tunkrank.rb