kloutbg 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/Rakefile +1 -1
  2. data/klout.gemspec +1 -1
  3. data/lib/klout.rb +15 -70
  4. metadata +3 -3
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require 'httparty'
4
4
  require 'fileutils'
5
5
  require './lib/klout'
6
6
 
7
- Echoe.new 'kloutbg', '1.2.0' do |p|
7
+ Echoe.new 'kloutbg', '1.2.1' do |p|
8
8
  p.author = 'Brad Gilreath'
9
9
  p.email = 'bwgilreath@gmail.com'
10
10
  p.url = 'http://github.com/bgilreath/klout'
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{kloutbg}
5
- s.version = "1.2.0"
5
+ s.version = "1.2.1"
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", "Eddy Parris"]
@@ -5,33 +5,19 @@ require 'httparty'
5
5
  $:.unshift(File.dirname(__FILE__)) unless
6
6
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
7
7
 
8
- =begin rdoc
9
-
10
- Klout measures influence on topics across the social web to find the people the world listens to
11
-
12
- See http://klout.com for more information about their service
13
-
14
- Usage:
15
-
16
- Klout.api_key = ""
17
- Klout.score('jasontorres')
18
-
19
- =end
20
-
21
-
22
8
  class Kloutbg
23
9
  include HTTParty
24
- VERSION = '1.2.0'
10
+ VERSION = '1.2.1'
25
11
  class << self
26
-
12
+
27
13
  @@base_host = "http://api.klout.com"
28
14
  @@api_version = "1"
29
15
  @@api_key = ""
30
-
16
+
31
17
  def initialize(api_key)
32
18
  @@api_key = api_key
33
19
  end
34
-
20
+
35
21
  def base_host=(host)
36
22
  @@base_host = host
37
23
  end
@@ -39,110 +25,69 @@ class Kloutbg
39
25
  def api_key=(api)
40
26
  @@api_key = api
41
27
  end
42
-
28
+
43
29
  def base_key
44
30
  @@base_host
45
31
  end
46
-
32
+
47
33
  def api_key
48
34
  @@api_key
49
35
  end
50
36
 
51
- #Legacy Method :Score
52
- #def score(username)
53
- #request_uri = "#{@@base_host}/api/twitter/1/klout/#{@@api_key}/#{username}.json"
54
- # request_uri = "#{@@base_host}/#{@@api_version}/klout.json?key=#{@@api_key}&users=#{username}"
55
- # return request(request_uri)
56
- #end
57
-
58
- #Legacy Method :Profile
59
- #def profile(username)
60
- #request_uri = "http://api.klout.com/api/twitter/1.1/profiledetail/#{@@api_key}/#{username}.json"
61
- #return request(request_uri)
62
- #end
63
-
64
37
  #Score method: /klout
65
38
  def klout(username)
66
39
  #request_uri = "http://klout.com/api/twitter/1/klout/#{@@api_key}/#{username}.json"
67
40
  request_uri = "/#{@@api_version}/klout.json?key=#{@@api_key}&users=#{username}"
68
41
  self.class.get(@@base_host + request_uri)
69
- #return request(request_uri)
70
42
  end
71
-
43
+
72
44
  #User method: /show
73
45
  def show(username)
74
46
  #http://api.klout.com/1/users/show.[xml_or_json]?key=[your_api_key]&users=[usernames]
75
47
  request_uri = "/#{@@api_version}/users/show.json?key=#{@@api_key}&users=#{username}"
76
48
  self.class.get(@@base_host + request_uri)
77
- #return request(request_uri)
78
49
  end
79
-
50
+
80
51
  #User method: /topics
81
52
  def topics(username)
82
53
  #http://api.klout.com/1/users/topics.[xml_or_json]?key=[your_api_key]&users=[usernames]
83
54
  request_uri = "/#{@@api_version}/users/topics.json?key=#{@@api_key}&users=#{username}"
84
55
  self.class.get(@@base_host + request_uri)
85
- #return request(request_uri)
86
56
  end
87
-
57
+
88
58
  #User method: /stats
89
59
  def stats(username)
90
60
  #http://api.klout.com/1/users/stats.[xml_or_json]?key=[your_api_key]&users=[usernames]
91
61
  request_uri = "/#{@@api_version}/users/stats.json?key=#{@@api_key}&users=#{username}"
92
62
  self.class.get(@@base_host + request_uri)
93
- #return request(request_uri)
94
63
  end
95
-
64
+
96
65
  #User method: /history
97
66
  def history(username,measure,start_date,end_date)
98
67
  #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]
99
68
  request_uri = "/#{@@api_version}/users/history.json?key=#{@@api_key}&measure=#{measure}&start_date=#{start_date}&end_date=#{end_date}&users=#{username}"
100
69
  self.class.get(@@base_host + request_uri)
101
- #return request(request_uri)
102
70
  end
103
-
71
+
104
72
  #Relationship method: /influenced_by
105
73
  def influenced_by(username)
106
74
  #http://api.klout.com/1/soi/influenced_by.[xml_or_json]?key=[your_api_key]&users=[usernames]
107
75
  request_uri = "/#{@@api_version}/soi/influenced_by.json?key=#{@@api_key}&users=#{username}"
108
76
  self.class.get(@@base_host + request_uri)
109
- #return request(request_uri)
110
77
  end
111
-
78
+
112
79
  #Relationship method: /influencer_of
113
80
  def influencer_of(username)
114
81
  #http://api.klout.com/1/soi/influencer_of.[xml_or_json]?key=[your_api_key]&users=[usernames]
115
82
  request_uri = "/#{@@api_version}/soi/influencer_of.json?key=#{@@api_key}&users=#{username}"
116
83
  self.class.get(@@base_host + request_uri)
117
- #return request(request_uri)
118
84
  end
119
-
85
+
120
86
  #Topic method: /search
121
87
  #Not supported here yet
122
-
88
+
123
89
  #Topic method: /verify
124
90
  #Not supported here yet
125
-
126
- #def request(request_uri)
127
- # url = URI.parse(request_uri)
128
- # response = Net::HTTP.start(url.host, url.port) { |http|
129
- # http.get(url.path)
130
- # }
131
-
132
- # case response
133
- # when Net::HTTPSuccess
134
- # if response.body
135
- # begin
136
- # JSON.parse(response.body)
137
- # rescue Exception => e
138
- # puts e.backtrace
139
- # false
140
- # end
141
- # end
142
- #else
143
- # response.error!
144
- # end
145
- #end
146
- #end
147
91
 
92
+ end
148
93
  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: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
- - 0
10
- version: 1.2.0
9
+ - 1
10
+ version: 1.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jason Torres