klout 3.0.1 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -2
- data/lib/klout.rb +1 -0
- data/lib/klout/identity.rb +10 -0
- data/lib/klout/twuser.rb +44 -0
- data/lib/klout/version.rb +1 -1
- metadata +15 -14
data/README.rdoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
= Klout
|
1
|
+
= Klout
|
2
2
|
|
3
3
|
Klout is a Ruby gem that provides a wrapper for interacting with the {Klout API}[http://klout.com/s/developers/v2]. <i>Note: this gem only supports {version 2}[http://klout.com/s/developers/v2] of the Klout API. Use the {V1 branch}[https://github.com/terra-firma/klout/tree/v1] if you need legacy support.</i>
|
4
4
|
|
@@ -19,7 +19,7 @@ Please refer to the {Klout API Documentation}[http://klout.com/s/developers/v2]
|
|
19
19
|
Klout.api_key = ENV['KLOUT_API_KEY']
|
20
20
|
klout_id = Klout::Identity.find_by_screen_name('screen_name')
|
21
21
|
|
22
|
-
user = Klout::
|
22
|
+
user = Klout::User.new(klout_id.id)
|
23
23
|
user.details
|
24
24
|
user.score
|
25
25
|
user.score.scoreDelta.dayChange
|
data/lib/klout.rb
CHANGED
data/lib/klout/identity.rb
CHANGED
@@ -19,6 +19,16 @@ module Klout
|
|
19
19
|
response = Klout.get "/identity.json/klout/#{klout_id}/tw", :query => {key: Klout.api_key}
|
20
20
|
Hashie::Mash.new(response)
|
21
21
|
end
|
22
|
+
|
23
|
+
def find_by_facebook_id(third_party_id)
|
24
|
+
response = Klout.get "/identity.json/fb/#{third_party_id}", :query => {key: Klout.api_key}
|
25
|
+
Hashie::Mash.new(response)
|
26
|
+
end
|
27
|
+
|
28
|
+
def find_by_google_plus_id(google_plus_id)
|
29
|
+
response = Klout.get "/identity.json/gp/#{google_plus_id}", :query => {key: Klout.api_key}
|
30
|
+
Hashie::Mash.new(response)
|
31
|
+
end
|
22
32
|
end
|
23
33
|
end
|
24
34
|
end
|
data/lib/klout/twuser.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'klout'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module Klout
|
5
|
+
# Represents a user
|
6
|
+
class TwUser
|
7
|
+
attr_reader :twitter_id
|
8
|
+
|
9
|
+
def initialize(twitter_id)
|
10
|
+
@twitter_id = twitter_id
|
11
|
+
end
|
12
|
+
|
13
|
+
def details
|
14
|
+
response = get
|
15
|
+
Hashie::Mash.new(response)
|
16
|
+
end
|
17
|
+
|
18
|
+
def score
|
19
|
+
response = get "score"
|
20
|
+
Hashie::Mash.new(response)
|
21
|
+
end
|
22
|
+
|
23
|
+
def topics
|
24
|
+
response = get "topics"
|
25
|
+
response.parsed_response
|
26
|
+
end
|
27
|
+
|
28
|
+
def influence
|
29
|
+
response = get "influence"
|
30
|
+
Hashie::Mash.new(response)
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def get(action = nil)
|
36
|
+
Klout.get uri_for(action), :query => {key: Klout.api_key}
|
37
|
+
end
|
38
|
+
|
39
|
+
def uri_for(action = nil)
|
40
|
+
action = "/#{action}" if action
|
41
|
+
"/tw-user.json/#{twitter_id}#{action}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/lib/klout/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: klout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-06-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hashie
|
16
|
-
requirement: &
|
16
|
+
requirement: &70245143257080 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70245143257080
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: httparty
|
27
|
-
requirement: &
|
27
|
+
requirement: &70245143256660 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70245143256660
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: json
|
38
|
-
requirement: &
|
38
|
+
requirement: &70245143256240 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70245143256240
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: fakeweb
|
49
|
-
requirement: &
|
49
|
+
requirement: &70245143255820 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70245143255820
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: guard-rspec
|
60
|
-
requirement: &
|
60
|
+
requirement: &70245143255400 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70245143255400
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
|
-
requirement: &
|
71
|
+
requirement: &70245143254980 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70245143254980
|
80
80
|
description: Implements the complete functionality of the Klout REST API (v2+).
|
81
81
|
email:
|
82
82
|
- brian@tatem.ae
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- klout.gemspec
|
96
96
|
- lib/klout.rb
|
97
97
|
- lib/klout/identity.rb
|
98
|
+
- lib/klout/twuser.rb
|
98
99
|
- lib/klout/user.rb
|
99
100
|
- lib/klout/version.rb
|
100
101
|
- rails/init.rb
|