kloutbg 1.0.0 → 1.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/README +11 -5
  2. data/klout.gemspec +3 -3
  3. data/lib/klout.rb +63 -8
  4. metadata +5 -5
data/README CHANGED
@@ -4,17 +4,23 @@ See http://klout.com for more information about their service
4
4
 
5
5
  Install:
6
6
 
7
- sudo gem install klout
7
+ sudo gem install kloutbg
8
8
 
9
9
  Usage and Example
10
10
 
11
11
  >> require 'rubygems'
12
- >> require 'klout'
13
- >> Klout.api_key = "yourkloutapikey"
14
- >> Klout.score('jasontorres')
12
+ >> require 'kloutbg'
13
+ >> Kloutbg.base_host = "http://api.klout.com"
14
+ >> Kloutbg.api_key = "yourkloutapikey"
15
+
16
+
17
+ Not supported in this Gem:
18
+ >> Kloutbg.score('jasontorres')
15
19
  => {"user"=>{"kscore"=>19.74, "status"=>200, "status_message"=>"OK"}}
16
- >> Klout.profile('jasontorres')
20
+ >> Kloutbg.profile('jasontorres')
17
21
  {"user"=>{"score"=>{"slope"=>0, "kscore"=>"19.7429", "kclass"=>"connector", "true_reach"=>"195", "amplification_score"=>"0", "kscore_description"=>"", "network_score"=>"0", "kclass_description"=>"You are a constant source of information to your friends and co-workers. There is a good chance that you probably introduced several of your friends to Twitter. Your taste and opinion is respected and your judgment is trusted.", "date_updated"=>"2009-07-09 00:59:08"}, "twitter_screen_name"=>"jasontorres", "status"=>200, "twitter_id"=>"406073", "status_message"=>"OK"}}
22
+
23
+
18
24
 
19
25
  Disclaimer: Author is not anyway involved w/ Klout.com
20
26
 
@@ -2,19 +2,19 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{kloutbg}
5
- s.version = "1.0.0"
5
+ s.version = "1.1.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Jason Torres", "Brad Gilreath"]
9
9
  s.date = %q{2010-11-04}
10
- s.description = %q{Kloutbg - Fork of Jason Torres and updated to recent Klout API}
10
+ s.description = %q{Kloutbg - Fork of Jason Torres and updated to recent Klout API. No testing.}
11
11
  s.email = %q{bwgilreath@gmail.com}
12
12
  s.extra_rdoc_files = ["lib/klout.rb", "README", "tasks/rspec.rake"]
13
13
  s.files = ["lib/klout.rb", "Manifest", "Rakefile", "README", "spec/klout_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/rspec.rake", "klout.gemspec"]
14
14
  s.homepage = %q{https://github.com/bgilreath/klout}
15
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Klout", "--main", "README"]
16
16
  s.require_paths = ["lib"]
17
- s.rubyforge_project = %q{klout}
17
+ s.rubyforge_project = %q{kloutbg}
18
18
  s.rubygems_version = %q{1.3.6}
19
19
  s.summary = %q{Kloutbg - Twitter Analytics}
20
20
 
@@ -18,7 +18,7 @@ Klout.score('jasontorres')
18
18
 
19
19
 
20
20
  class Klout
21
- VERSION = '0.0.1'
21
+ VERSION = '1.1.0'
22
22
  class << self
23
23
 
24
24
  @@base_host = "http://api.klout.com"
@@ -41,17 +41,74 @@ class Klout
41
41
  @@api_key
42
42
  end
43
43
 
44
- def score(username)
44
+ #Legacy Method :Score
45
+ #def score(username)
46
+ #request_uri = "#{@@base_host}/api/twitter/1/klout/#{@@api_key}/#{username}.json"
47
+ # request_uri = "#{@@base_host}/#{@@api_version}/klout.json?key=#{@@api_key}&users=#{username}"
48
+ # return request(request_uri)
49
+ #end
50
+
51
+ #Legacy Method :Profile
52
+ #def profile(username)
53
+ #request_uri = "http://api.klout.com/api/twitter/1.1/profiledetail/#{@@api_key}/#{username}.json"
54
+ #return request(request_uri)
55
+ #end
56
+
57
+ #Score method: /klout
58
+ def klout(username)
45
59
  #request_uri = "http://klout.com/api/twitter/1/klout/#{@@api_key}/#{username}.json"
46
60
  request_uri = "#{@@base_host}/#{@@api_version}/klout.json?key=#{@@api_key}&users=#{username}"
47
61
  return request(request_uri)
48
62
  end
49
63
 
50
- def profile(username)
51
- request_uri = "http://klout.com/api/twitter/1.1/profiledetail/#{@@api_key}/#{username}.json"
64
+ #User method: /show
65
+ def show(username)
66
+ #http://api.klout.com/1/users/show.[xml_or_json]?key=[your_api_key]&users=[usernames]
67
+ request_uri = "#{@@base_host}/#{@@api_version}/users/show.json?key=#{@@api_key}&users=#{username}"
68
+ return request(request_uri)
69
+ end
70
+
71
+ #User method: /topics
72
+ def topics(username)
73
+ #http://api.klout.com/1/users/topics.[xml_or_json]?key=[your_api_key]&users=[usernames]
74
+ request_uri = "#{@@base_host}/#{@@api_version}/users/topics.json?key=#{@@api_key}&users=#{username}"
75
+ return request(request_uri)
76
+ end
77
+
78
+ #User method: /stats
79
+ def stats(username)
80
+ #http://api.klout.com/1/users/stats.[xml_or_json]?key=[your_api_key]&users=[usernames]
81
+ request_uri = "#{@@base_host}/#{@@api_version}/users/stats.json?key=#{@@api_key}&users=#{username}"
82
+ return request(request_uri)
83
+ end
84
+
85
+ #User method: /history
86
+ def history(username,measure,start_date,end_date)
87
+ #http://api.klout.com/1/users/topics.[xml_or_json]?key=[your_api_key]&measure=[measure]&start_date=[start_date]&end_date=[end_date]&users=[usernames]
88
+ request_uri = "#{@@base_host}/#{@@api_version}/users/history.json?key=#{@@api_key}&measure=#{measure}&start_date=#{start_date}&end_date=#{end_date}&users=#{username}"
52
89
  return request(request_uri)
53
90
  end
54
91
 
92
+ #Relationship method: /influenced_by
93
+ def influenced_by(username)
94
+ #http://api.klout.com/1/soi/influenced_by.[xml_or_json]?key=[your_api_key]&users=[usernames]
95
+ request_uri = "#{@@base_host}/#{@@api_version}/soi/influenced_by.json?key=#{@@api_key}&users=#{username}"
96
+ return request(request_uri)
97
+ end
98
+
99
+ #Relationship method: /influencer_of
100
+ def influencer_of(username)
101
+ #http://api.klout.com/1/soi/influencer_of.[xml_or_json]?key=[your_api_key]&users=[usernames]
102
+ request_uri = "#{@@base_host}/#{@@api_version}/soi/influencer_of.json?key=#{@@api_key}&users=#{username}"
103
+ return request(request_uri)
104
+ end
105
+
106
+ #Topic method: /search
107
+ #Not supported here yet
108
+
109
+ #Topic method: /verify
110
+ #Not supported here yet
111
+
55
112
  def request(request_uri)
56
113
  url = URI.parse(request_uri)
57
114
  response = Net::HTTP.start(url.host, url.port) { |http|
@@ -70,10 +127,8 @@ class Klout
70
127
  end
71
128
  else
72
129
  response.error!
130
+ end
73
131
  end
74
132
  end
75
-
76
-
77
-
78
- end
133
+
79
134
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kloutbg
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
+ - 1
8
9
  - 0
9
- - 0
10
- version: 1.0.0
10
+ version: 1.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jason Torres
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: "0"
34
34
  type: :runtime
35
35
  version_requirements: *id001
36
- description: Kloutbg - Fork of Jason Torres and updated to recent Klout API
36
+ description: Kloutbg - Fork of Jason Torres and updated to recent Klout API. No testing.
37
37
  email: bwgilreath@gmail.com
38
38
  executables: []
39
39
 
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  version: "1.2"
89
89
  requirements: []
90
90
 
91
- rubyforge_project: klout
91
+ rubyforge_project: kloutbg
92
92
  rubygems_version: 1.3.7
93
93
  signing_key:
94
94
  specification_version: 3