klout 3.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- = Klout {<img src="http://travis-ci.org/terra-firma/klout.png" />}[http://travis-ci.org/terra-firma/klout] {<img src="https://gemnasium.com/terra-firma/klout.png" alt="Dependency Status" />}[https://gemnasium.com/terra-firma/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::Identity.new(klout_id)
22
+ user = Klout::User.new(klout_id.id)
23
23
  user.details
24
24
  user.score
25
25
  user.score.scoreDelta.dayChange
@@ -10,6 +10,7 @@ $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
10
10
  require 'klout/version'
11
11
  require 'klout/identity'
12
12
  require 'klout/user'
13
+ require 'klout/twuser'
13
14
 
14
15
  module Klout
15
16
  class << self
@@ -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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Klout
2
- VERSION = "3.0.1" unless defined?(Klout::VERSION)
2
+ VERSION = "3.0.2" unless defined?(Klout::VERSION)
3
3
  end
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.1
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: 2012-08-02 00:00:00.000000000 Z
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: &70162762270340 !ruby/object:Gem::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: *70162762270340
24
+ version_requirements: *70245143257080
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: httparty
27
- requirement: &70162762692260 !ruby/object:Gem::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: *70162762692260
35
+ version_requirements: *70245143256660
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: json
38
- requirement: &70162762691840 !ruby/object:Gem::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: *70162762691840
46
+ version_requirements: *70245143256240
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: fakeweb
49
- requirement: &70162762691420 !ruby/object:Gem::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: *70162762691420
57
+ version_requirements: *70245143255820
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: guard-rspec
60
- requirement: &70162762691000 !ruby/object:Gem::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: *70162762691000
68
+ version_requirements: *70245143255400
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
- requirement: &70162762690580 !ruby/object:Gem::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: *70162762690580
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