Class: Kloutbg
Constant Summary collapse
- VERSION =
'1.2.2'
- @@base_host =
"http://api.klout.com"
- @@api_version =
"1"
- @@api_key =
""
Instance Method Summary collapse
- #api_key ⇒ Object
- #api_key=(api) ⇒ Object
- #base_host=(host) ⇒ Object
- #base_key ⇒ Object
-
#history(username, measure, start_date, end_date) ⇒ Object
User method: /history.
-
#influenced_by(username) ⇒ Object
Relationship method: /influenced_by.
-
#influencer_of(username) ⇒ Object
Relationship method: /influencer_of.
-
#initialize(api_key) ⇒ Kloutbg
constructor
A new instance of Kloutbg.
-
#klout(username) ⇒ Object
Score method: /klout.
-
#show(username) ⇒ Object
User method: /show.
-
#stats(username) ⇒ Object
User method: /stats.
-
#topics(username) ⇒ Object
User method: /topics.
Constructor Details
#initialize(api_key) ⇒ Kloutbg
Returns a new instance of Kloutbg.
16 17 18 |
# File 'lib/klout.rb', line 16 def initialize(api_key) @@api_key = api_key end |
Instance Method Details
#api_key ⇒ Object
32 33 34 |
# File 'lib/klout.rb', line 32 def api_key @@api_key end |
#api_key=(api) ⇒ Object
24 25 26 |
# File 'lib/klout.rb', line 24 def api_key=(api) @@api_key = api end |
#base_host=(host) ⇒ Object
20 21 22 |
# File 'lib/klout.rb', line 20 def base_host=(host) @@base_host = host end |
#base_key ⇒ Object
28 29 30 |
# File 'lib/klout.rb', line 28 def base_key @@base_host end |
#history(username, measure, start_date, end_date) ⇒ Object
User method: /history
65 66 67 68 69 |
# File 'lib/klout.rb', line 65 def history(username,measure,start_date,end_date) #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] request_uri = "/#{@@api_version}/users/history.json?key=#{@@api_key}&measure=#{measure}&start_date=#{start_date}&end_date=#{end_date}&users=#{username}" self.class.get(@@base_host + request_uri) end |
#influenced_by(username) ⇒ Object
Relationship method: /influenced_by
72 73 74 75 76 |
# File 'lib/klout.rb', line 72 def influenced_by(username) #http://api.klout.com/1/soi/influenced_by.[xml_or_json]?key=[your_api_key]&users=[usernames] request_uri = "/#{@@api_version}/soi/influenced_by.json?key=#{@@api_key}&users=#{username}" self.class.get(@@base_host + request_uri) end |
#influencer_of(username) ⇒ Object
Relationship method: /influencer_of
79 80 81 82 83 |
# File 'lib/klout.rb', line 79 def influencer_of(username) #http://api.klout.com/1/soi/influencer_of.[xml_or_json]?key=[your_api_key]&users=[usernames] request_uri = "/#{@@api_version}/soi/influencer_of.json?key=#{@@api_key}&users=#{username}" self.class.get(@@base_host + request_uri) end |
#klout(username) ⇒ Object
Score method: /klout
37 38 39 40 41 |
# File 'lib/klout.rb', line 37 def klout(username) #request_uri = "http://klout.com/api/twitter/1/klout/#{@@api_key}/#{username}.json" request_uri = "/#{@@api_version}/klout.json?key=#{@@api_key}&users=#{username}" self.class.get(@@base_host + request_uri) end |
#show(username) ⇒ Object
User method: /show
44 45 46 47 48 |
# File 'lib/klout.rb', line 44 def show(username) #http://api.klout.com/1/users/show.[xml_or_json]?key=[your_api_key]&users=[usernames] request_uri = "/#{@@api_version}/users/show.json?key=#{@@api_key}&users=#{username}" self.class.get(@@base_host + request_uri) end |
#stats(username) ⇒ Object
User method: /stats
58 59 60 61 62 |
# File 'lib/klout.rb', line 58 def stats(username) #http://api.klout.com/1/users/stats.[xml_or_json]?key=[your_api_key]&users=[usernames] request_uri = "/#{@@api_version}/users/stats.json?key=#{@@api_key}&users=#{username}" self.class.get(@@base_host + request_uri) end |
#topics(username) ⇒ Object
User method: /topics
51 52 53 54 55 |
# File 'lib/klout.rb', line 51 def topics(username) #http://api.klout.com/1/users/topics.[xml_or_json]?key=[your_api_key]&users=[usernames] request_uri = "/#{@@api_version}/users/topics.json?key=#{@@api_key}&users=#{username}" self.class.get(@@base_host + request_uri) end |