Class: RockyKlout

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/rocky-klout.rb

Overview

module RockyKlout

VERSION = '0.0.2'

end

Constant Summary collapse

VERSION =
'0.0.2'
@@base_uri =
"http://api.klout.com"
@@api_version =
"1"
@@api_key =
""

Instance Method Summary collapse

Constructor Details

#initialize(api_key) ⇒ RockyKlout

Returns a new instance of RockyKlout.



24
25
26
# File 'lib/rocky-klout.rb', line 24

def initialize(api_key)
  @@api_key = api_key
end

Instance Method Details

#api_keyObject



32
33
34
# File 'lib/rocky-klout.rb', line 32

def api_key
  @@api_key
end

#api_key=(api) ⇒ Object



28
29
30
# File 'lib/rocky-klout.rb', line 28

def api_key=(api)
  @@api_key = api
end

#relationship_influenced_by(usernames) ⇒ Object



64
65
66
67
# File 'lib/rocky-klout.rb', line 64

def relationship_influenced_by(usernames)
  request_uri = "/#{@@api_version}/soi/influenced_by.json?key=#{@@api_key}&users=" + usernames.collect{|name| CGI.escape(name)}.join(",")
  self.class.get(@@base_uri + request_uri)
end

#relationship_influencer_of(usernames) ⇒ Object



69
70
71
72
# File 'lib/rocky-klout.rb', line 69

def relationship_influencer_of(usernames)
  request_uri = "/#{@@api_version}/soi/influencer_of.json?key=#{@@api_key}&users=" + usernames.collect{|name| CGI.escape(name)}.join(",")
  self.class.get(@@base_uri + request_uri)
end

#score_klout(usernames) ⇒ Object



36
37
38
39
# File 'lib/rocky-klout.rb', line 36

def score_klout(usernames)
  request_uri = "/#{@@api_version}/klout.json?key=#{@@api_key}&users=" + usernames.collect{|name| CGI.escape(name)}.join(",")
  self.class.get(@@base_uri + request_uri)
end

#topic_search(topic) ⇒ Object



74
75
76
77
# File 'lib/rocky-klout.rb', line 74

def topic_search(topic)
  request_uri = "/#{@@api_version}/topics/search.json?key=#{@@api_key}&topic=" + CGI.escape(topic)
  self.class.get(@@base_uri + request_uri)
end

#topic_verify(topic) ⇒ Object



79
80
81
82
# File 'lib/rocky-klout.rb', line 79

def topic_verify(topic)
  request_uri = "/#{@@api_version}/topics/verify.json?key=#{@@api_key}&topic=" + CGI.escape(topic)
  self.class.get(@@base_uri + request_uri)
end

#user_history(usernames, measure, start_date, end_date) ⇒ Object



56
57
58
59
60
61
62
# File 'lib/rocky-klout.rb', line 56

def user_history(usernames, measure, start_date, end_date)
  request_uri = "/#{@@api_version}/users/show.json?key=#{@@api_key}&users=" + usernames.collect{|name| CGI.escape(name)}.join(",") +
    "&measure=" + CGI.escape(measure) +
    "&start_date=" + CGI.escape(start_date)
    "&end_date=" + CGI.escape(end_date)
  self.class.get(@@base_uri + request_uri)
end

#user_show(usernames) ⇒ Object



41
42
43
44
# File 'lib/rocky-klout.rb', line 41

def user_show(usernames)
  request_uri = "/#{@@api_version}/users/show.json?key=#{@@api_key}&users=" + usernames.collect{|name| CGI.escape(name)}.join(",")
  self.class.get(@@base_uri + request_uri)
end

#user_stats(usernames) ⇒ Object



51
52
53
54
# File 'lib/rocky-klout.rb', line 51

def user_stats(usernames)
  request_uri = "/#{@@api_version}/users/stats.json?key=#{@@api_key}&users=" + usernames.collect{|name| CGI.escape(name)}.join(",")
  self.class.get(@@base_uri + request_uri)
end

#user_topics(usernames) ⇒ Object



46
47
48
49
# File 'lib/rocky-klout.rb', line 46

def user_topics(usernames)
  request_uri = "/#{@@api_version}/users/topics.json?key=#{@@api_key}&users=" + usernames.collect{|name| CGI.escape(name)}.join(",")
  self.class.get(@@base_uri + request_uri)
end