klout-rb 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE +20 -0
- data/README.md +57 -0
- data/Rakefile +8 -0
- data/klout-rb.gemspec +30 -0
- data/lib/klout/client.rb +135 -0
- data/lib/klout/version.rb +4 -0
- data/lib/klout-rb.rb +1 -0
- data/lib/klout.rb +5 -0
- data/spec/fixtures/klout.json +9 -0
- data/spec/fixtures/no_users.json +7 -0
- data/spec/fixtures/soi_influenced_by.json +18 -0
- data/spec/fixtures/soi_influencer_of.json +22 -0
- data/spec/fixtures/users_show.json +23 -0
- data/spec/fixtures/users_topics.json +15 -0
- data/spec/klout_spec.rb +134 -0
- data/spec/spec_helper.rb +24 -0
- metadata +137 -0
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Damian Caruso
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
Klout [![Build Status](https://secure.travis-ci.org/cdamian/klout-rb.png)](http://travis-ci.org/cdamian/klout-rb)
|
2
|
+
=====
|
3
|
+
Ruby wrapper for the Klout REST API
|
4
|
+
|
5
|
+
Installation
|
6
|
+
------------
|
7
|
+
|
8
|
+
Klout is available through [Rubygems](http://rubygems.org/gems/klout-rb) and can be installed via:
|
9
|
+
|
10
|
+
gem install klout-rb
|
11
|
+
|
12
|
+
Usage
|
13
|
+
-----
|
14
|
+
|
15
|
+
#### Configure API key
|
16
|
+
|
17
|
+
Klout::Client.configure do |config|
|
18
|
+
config.api_key = "<YOUR_API_KEY>"
|
19
|
+
end
|
20
|
+
|
21
|
+
#### Get users klout score
|
22
|
+
|
23
|
+
Klout::Client.score("ladygaga", "davidguetta").map do |user|
|
24
|
+
"#{user.twitter_screen_name}: #{user.kscore}"
|
25
|
+
end
|
26
|
+
|
27
|
+
#### Get users klout profile
|
28
|
+
|
29
|
+
Klout::Client.score("ladygaga", "davidguetta").map do |user|
|
30
|
+
"#{user.twitter_screen_name}: #{user.score.true_reach}"
|
31
|
+
end
|
32
|
+
|
33
|
+
#### Get users topics
|
34
|
+
|
35
|
+
Klout::Client.topics("ladygaga", "davidguetta").map do |user|
|
36
|
+
"#{user.twitter_screen_name}: #{user.topics.join(',')}"
|
37
|
+
end
|
38
|
+
|
39
|
+
#### Get users influencers
|
40
|
+
|
41
|
+
Klout::Client.influenced_by("ladygaga", "davidguetta").map do |user|
|
42
|
+
"#{user.twitter_screen_name}: #{user.influencers.map { |i| i.twitter_screen_name }.join(',')}"
|
43
|
+
end
|
44
|
+
|
45
|
+
#### Get users influencees
|
46
|
+
|
47
|
+
Klout::Client.influencer_of("ladygaga", "davidguetta").map do |user|
|
48
|
+
"#{user.twitter_screen_name}: #{user.influencees.map { |i| i.twitter_screen_name }.join(',')}"
|
49
|
+
end
|
50
|
+
|
51
|
+
Performance
|
52
|
+
-----------
|
53
|
+
|
54
|
+
Klout-rb uses [multi_json](https://github.com/intridea/multi_json) for parsing JSON responses and [HTTPI](https://github.com/rubiii/httpi) for making HTTP requests.
|
55
|
+
|
56
|
+
You can use [yajl](https://github.com/brianmario/yajl-ruby) and [httpclient](https://github.com/nahi/httpclient) for better performance.
|
57
|
+
|
data/Rakefile
ADDED
data/klout-rb.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "klout/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "klout-rb"
|
7
|
+
s.version = Klout::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Damian Caruso"]
|
10
|
+
s.email = ["damian.caruso@gmail.com"]
|
11
|
+
s.homepage = "http://github.com/cdamian/klout-rb"
|
12
|
+
s.summary = %q{Ruby wrapper for the Klout REST API}
|
13
|
+
s.description = %q{Ruby wrapper for the Klout REST API}
|
14
|
+
|
15
|
+
s.rubyforge_project = "klout-rb"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
|
22
|
+
s.add_dependency "hashie", "~> 1.2.0"
|
23
|
+
s.add_dependency "httpi", "~> 0.9.5"
|
24
|
+
s.add_dependency "multi_json", "~> 1.0.3"
|
25
|
+
|
26
|
+
s.add_development_dependency "rake", "~> 0.9.2.2"
|
27
|
+
s.add_development_dependency "rspec", "~> 2.7.0"
|
28
|
+
s.add_development_dependency "webmock", "~> 1.7.7"
|
29
|
+
end
|
30
|
+
|
data/lib/klout/client.rb
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
require 'forwardable'
|
2
|
+
require 'hashie/mash'
|
3
|
+
require 'httpi'
|
4
|
+
require 'multi_json'
|
5
|
+
require 'rack/utils'
|
6
|
+
require 'singleton'
|
7
|
+
|
8
|
+
module Klout
|
9
|
+
class Error < StandardError; end
|
10
|
+
class Error::Forbidden < Klout::Error; end
|
11
|
+
class Error::InternalServerError < Klout::Error; end
|
12
|
+
class Error::ServiceUnavailable < Klout::Error; end
|
13
|
+
|
14
|
+
# Public: Class with the necessary methods for performing all Klout API operations.
|
15
|
+
# All API methods are instance methods but can be called on the Client class.
|
16
|
+
class Client
|
17
|
+
include Singleton
|
18
|
+
extend SingleForwardable
|
19
|
+
|
20
|
+
# Public: Gets/Sets the Klout API key.
|
21
|
+
attr_accessor :api_key
|
22
|
+
|
23
|
+
# Public: Gets/Sets an optional Proxy host to use.
|
24
|
+
attr_accessor :proxy
|
25
|
+
|
26
|
+
# Internal: Delegates api methods to the Klout::Client instance.
|
27
|
+
def_delegators :instance, :score, :profile, :topics, :influenced_by, :influencer_of
|
28
|
+
|
29
|
+
# Public: Configure Klout Client options.
|
30
|
+
#
|
31
|
+
# Yields the Klout::Client instance.
|
32
|
+
#
|
33
|
+
# Returns nothing.
|
34
|
+
def self.configure
|
35
|
+
yield instance if block_given?
|
36
|
+
end
|
37
|
+
|
38
|
+
# Public: Klout REST API endpoint
|
39
|
+
#
|
40
|
+
# Returns the Klout REST API endpoint
|
41
|
+
def self.endpoint
|
42
|
+
'http://api.klout.com'
|
43
|
+
end
|
44
|
+
|
45
|
+
# Public: Retrieve Klout score for the given usernames.
|
46
|
+
#
|
47
|
+
# usernames - The username or Array of usernames to look for.
|
48
|
+
#
|
49
|
+
# Returns an Array of user klout score objects.
|
50
|
+
def score(usernames)
|
51
|
+
get("/1/klout.json", :users => [usernames].flatten).users
|
52
|
+
end
|
53
|
+
|
54
|
+
# Public: Retrieve users Klout profile for the given usernames.
|
55
|
+
#
|
56
|
+
# usernames - The username or Array of usernames to look for.
|
57
|
+
#
|
58
|
+
# Returns an Array of user klout profile objects.
|
59
|
+
def profile(usernames)
|
60
|
+
get("/1/users/show.json", :users => [usernames].flatten).users
|
61
|
+
end
|
62
|
+
|
63
|
+
# Public: Retrieve users topics for the given usernames.
|
64
|
+
#
|
65
|
+
# usernames - The username or Array of usernames to look for.
|
66
|
+
#
|
67
|
+
# Returns an Array of user klout topics objects.
|
68
|
+
def topics(usernames)
|
69
|
+
get("/1/users/topics.json", :users => [usernames].flatten).users
|
70
|
+
end
|
71
|
+
|
72
|
+
# Public: Retrieve users influencers for the given usernames.
|
73
|
+
#
|
74
|
+
# usernames - The username or Array of usernames to look for.
|
75
|
+
#
|
76
|
+
# Returns an Array of klout users with their corresponding influencers.
|
77
|
+
def influenced_by(usernames)
|
78
|
+
get("/1/soi/influenced_by.json", :users => [usernames].flatten).users
|
79
|
+
end
|
80
|
+
|
81
|
+
# Public: Retrieve users influencees for the given usernames.
|
82
|
+
#
|
83
|
+
# usernames - The username or Array of usernames to look for.
|
84
|
+
#
|
85
|
+
# Returns an Array of klout users with their corresponding influencees.
|
86
|
+
def influencer_of(usernames)
|
87
|
+
get("/1/soi/influencer_of.json", :users => [usernames].flatten).users
|
88
|
+
end
|
89
|
+
|
90
|
+
private
|
91
|
+
# Internal: Executes a GET HTTP request.
|
92
|
+
#
|
93
|
+
# path - The path to make the request again.
|
94
|
+
# params - A Hash with the optionals http params.
|
95
|
+
#
|
96
|
+
# Returns a response object.
|
97
|
+
def get(path, params = {})
|
98
|
+
request = HTTPI::Request.new(build_url(path, params))
|
99
|
+
request.proxy = proxy unless proxy.nil?
|
100
|
+
parse_response(HTTPI.get(request))
|
101
|
+
end
|
102
|
+
|
103
|
+
# Internal: Parses the HTTP response.
|
104
|
+
#
|
105
|
+
# Returns a Mash of the JSON parsed hash.
|
106
|
+
# Raises Klout::Error::Forbidden if Klout api key is not valid.
|
107
|
+
# Raises Klout::Error::InternalServerError if there is a server error in Klout.
|
108
|
+
# Raises Klout::Error::ServiceUnavailable if Klout endpoint is unavailable.
|
109
|
+
def parse_response(response)
|
110
|
+
case response.code.to_i
|
111
|
+
when 403
|
112
|
+
raise Klout::Error::Forbidden.new
|
113
|
+
when 500
|
114
|
+
raise Klout::Error::InternalServerError.new
|
115
|
+
when 503
|
116
|
+
raise Klout::Error::ServiceUnavailable.new
|
117
|
+
end
|
118
|
+
body = ::MultiJson.decode(response.body)
|
119
|
+
raise Klout::Error.new(body['body']['error']) if body.has_key?('body') && body['body'].has_key?('error')
|
120
|
+
Hashie::Mash.new(body)
|
121
|
+
end
|
122
|
+
|
123
|
+
# Internal: Builds the request url.
|
124
|
+
#
|
125
|
+
# path - The path to make the request again.
|
126
|
+
# params - A Hash with the optionals http params.
|
127
|
+
#
|
128
|
+
# Returns a string url.
|
129
|
+
def build_url(path, params = {})
|
130
|
+
"#{self.class.endpoint}#{path}?#{Rack::Utils.build_query(params.merge(:key => api_key.to_s))}"
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
HTTPI.log = false
|
135
|
+
end
|
data/lib/klout-rb.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require ::File.expand_path('klout', File.dirname(__FILE__))
|
data/lib/klout.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
{
|
2
|
+
"status": 200,
|
3
|
+
"users": [
|
4
|
+
{
|
5
|
+
"twitter_screen_name": "damiancaruso",
|
6
|
+
"influencers": [
|
7
|
+
{
|
8
|
+
"twitter_screen_name": "foursquare",
|
9
|
+
"kscore": 95.71
|
10
|
+
},
|
11
|
+
{
|
12
|
+
"twitter_screen_name": "rubyconfar",
|
13
|
+
"kscore": 49.93
|
14
|
+
}
|
15
|
+
]
|
16
|
+
}
|
17
|
+
]
|
18
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
{
|
2
|
+
"status": 200,
|
3
|
+
"users": [
|
4
|
+
{
|
5
|
+
"twitter_screen_name": "damiancaruso",
|
6
|
+
"influencees": [
|
7
|
+
{
|
8
|
+
"twitter_screen_name": "manolo22",
|
9
|
+
"kscore": 12.03
|
10
|
+
},
|
11
|
+
{
|
12
|
+
"twitter_screen_name": "gorrete",
|
13
|
+
"kscore": 19.12
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"twitter_screen_name": "jackiechan",
|
17
|
+
"kscore": 20.7
|
18
|
+
}
|
19
|
+
]
|
20
|
+
}
|
21
|
+
]
|
22
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
{
|
2
|
+
"status": 200,
|
3
|
+
"users": [
|
4
|
+
{
|
5
|
+
"twitter_id": "90718004",
|
6
|
+
"twitter_screen_name": "damiancaruso",
|
7
|
+
"score": {
|
8
|
+
"kscore": 10.86,
|
9
|
+
"slope": -0.32,
|
10
|
+
"description": "",
|
11
|
+
"kclass_id": 1,
|
12
|
+
"kclass": "Observer",
|
13
|
+
"kclass_description": "You don't share very much, but you follow the social web more than you let on. You may just enjoy observing more than sharing or you're checking this stuff out before jumping in full-force.",
|
14
|
+
"kscore_description": "",
|
15
|
+
"network_score": 11.25,
|
16
|
+
"amplification_score": 2,
|
17
|
+
"true_reach": 3,
|
18
|
+
"delta_1day": -0.07,
|
19
|
+
"delta_5day": -0.34
|
20
|
+
}
|
21
|
+
}
|
22
|
+
]
|
23
|
+
}
|
data/spec/klout_spec.rb
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Klout::Client do
|
4
|
+
before do
|
5
|
+
@query = {:key => ""}
|
6
|
+
end
|
7
|
+
|
8
|
+
describe "errors" do
|
9
|
+
context "no users found" do
|
10
|
+
before do
|
11
|
+
stub_get("/1/klout.json").with(:query => @query.merge({:users => "damiancaruso"})).
|
12
|
+
to_return(:body => fixture("no_users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should raise an error if users are not found" do
|
16
|
+
expect { Klout::Client.score("damiancaruso") }.to raise_error(Klout::Error, "No users")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context "invalid key" do
|
21
|
+
before do
|
22
|
+
stub_get("/1/klout.json").with(:query => @query.merge({:users => "damiancaruso"})).
|
23
|
+
to_return(:status => 403, :body => "<h1> 403 Developer Inactive </h1>", :headers => {:content_type => "application/xml; charset=utf-8"})
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should raise an error if the key is invalid" do
|
27
|
+
expect { Klout::Client.score("damiancaruso") }.to raise_error(Klout::Error::Forbidden)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context "internal server error" do
|
32
|
+
before do
|
33
|
+
stub_get("/1/klout.json").with(:query => @query.merge({:users => "damiancaruso"})).
|
34
|
+
to_return(:status => 500)
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should raise an error if there is a server error in klout" do
|
38
|
+
expect { Klout::Client.score("damiancaruso") }.to raise_error(Klout::Error::InternalServerError)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context "service unavailable" do
|
43
|
+
before do
|
44
|
+
stub_get("/1/klout.json").with(:query => @query.merge({:users => "damiancaruso"})).
|
45
|
+
to_return(:status => 503)
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should raise an error if the service is unavailable" do
|
49
|
+
expect { Klout::Client.score("damiancaruso") }.to raise_error(Klout::Error::ServiceUnavailable)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe ".score" do
|
55
|
+
before do
|
56
|
+
stub_get("/1/klout.json").with(:query => @query.merge({:users => "damiancaruso"})).
|
57
|
+
to_return(:body => fixture("klout.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should get a the klout score object for the given users" do
|
61
|
+
users = Klout::Client.score("damiancaruso")
|
62
|
+
users.first.twitter_screen_name.should_not be_nil
|
63
|
+
users.first.kscore.should be_kind_of(Numeric)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe ".profile" do
|
68
|
+
before do
|
69
|
+
stub_get("/1/users/show.json").with(:query => @query.merge({:users => "damiancaruso"})).
|
70
|
+
to_return(:body => fixture("users_show.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should get a the klout user object for the given users" do
|
74
|
+
users = Klout::Client.profile("damiancaruso")
|
75
|
+
users.first.twitter_id.should_not be_nil
|
76
|
+
users.first.twitter_screen_name.should_not be_nil
|
77
|
+
users.first.score.kscore.should be_kind_of(Numeric)
|
78
|
+
users.first.score.slope.should be_kind_of(Numeric)
|
79
|
+
users.first.score.description.should_not be_nil
|
80
|
+
users.first.score.kclass_id.should be_kind_of(Numeric)
|
81
|
+
users.first.score.kclass.should_not be_nil
|
82
|
+
users.first.score.kclass_description.should_not be_nil
|
83
|
+
users.first.score.kscore_description.should_not be_nil
|
84
|
+
users.first.score.network_score.should be_kind_of(Numeric)
|
85
|
+
users.first.score.amplification_score.should be_kind_of(Numeric)
|
86
|
+
users.first.score.true_reach.should be_kind_of(Numeric)
|
87
|
+
users.first.score.delta_1day.should be_kind_of(Numeric)
|
88
|
+
users.first.score.delta_5day.should be_kind_of(Numeric)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
describe ".topics" do
|
93
|
+
before do
|
94
|
+
stub_get("/1/users/topics.json").with(:query => @query.merge({:users => "damiancaruso"})).
|
95
|
+
to_return(:body => fixture("users_topics.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should get a the klout topic object for the given users" do
|
99
|
+
users = Klout::Client.topics("damiancaruso")
|
100
|
+
users.first.twitter_screen_name.should_not be_nil
|
101
|
+
users.first.topics.should be_kind_of(Array)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
describe ".influenced_by" do
|
106
|
+
before do
|
107
|
+
stub_get("/1/soi/influenced_by.json").with(:query => @query.merge({:users => "damiancaruso"})).
|
108
|
+
to_return(:body => fixture("soi_influenced_by.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
109
|
+
end
|
110
|
+
|
111
|
+
it "should get a the klout score object for the given users's influencers" do
|
112
|
+
users = Klout::Client.influenced_by("damiancaruso")
|
113
|
+
users.first.twitter_screen_name.should_not be_nil
|
114
|
+
users.first.influencers.should be_kind_of(Array)
|
115
|
+
users.first.influencers.first.twitter_screen_name.should_not be_nil
|
116
|
+
users.first.influencers.first.kscore.should be_kind_of(Numeric)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
describe ".influencer_of" do
|
121
|
+
before do
|
122
|
+
stub_get("/1/soi/influencer_of.json").with(:query => @query.merge({:users => "damiancaruso"})).
|
123
|
+
to_return(:body => fixture("soi_influencer_of.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
124
|
+
end
|
125
|
+
|
126
|
+
it "should get a the klout score object for the given users's influenceers" do
|
127
|
+
users = Klout::Client.influencer_of("damiancaruso")
|
128
|
+
users.first.twitter_screen_name.should_not be_nil
|
129
|
+
users.first.influencees.should be_kind_of(Array)
|
130
|
+
users.first.influencees.first.twitter_screen_name.should_not be_nil
|
131
|
+
users.first.influencees.first.kscore.should be_kind_of(Numeric)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'klout'
|
2
|
+
require 'rspec'
|
3
|
+
require "webmock/rspec"
|
4
|
+
|
5
|
+
# Requires supporting files with custom matchers and macros, etc,
|
6
|
+
# in ./support/ and its subdirectories.
|
7
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
8
|
+
|
9
|
+
RSpec.configure do |config|
|
10
|
+
config.include WebMock::API
|
11
|
+
config.mock_with :rspec
|
12
|
+
end
|
13
|
+
|
14
|
+
def stub_get(path)
|
15
|
+
stub_request(:get, Klout::Client.endpoint + path)
|
16
|
+
end
|
17
|
+
|
18
|
+
def fixture_path
|
19
|
+
File.expand_path("../fixtures", __FILE__)
|
20
|
+
end
|
21
|
+
|
22
|
+
def fixture(file)
|
23
|
+
File.new(fixture_path + '/' + file)
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: klout-rb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Damian Caruso
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-11-17 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: hashie
|
16
|
+
requirement: &73583900 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.2.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *73583900
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: httpi
|
27
|
+
requirement: &73583560 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.9.5
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *73583560
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: multi_json
|
38
|
+
requirement: &73583260 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.0.3
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *73583260
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rake
|
49
|
+
requirement: &73582970 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.9.2.2
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *73582970
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rspec
|
60
|
+
requirement: &73582710 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ~>
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 2.7.0
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *73582710
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: webmock
|
71
|
+
requirement: &73582450 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ~>
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 1.7.7
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *73582450
|
80
|
+
description: Ruby wrapper for the Klout REST API
|
81
|
+
email:
|
82
|
+
- damian.caruso@gmail.com
|
83
|
+
executables: []
|
84
|
+
extensions: []
|
85
|
+
extra_rdoc_files: []
|
86
|
+
files:
|
87
|
+
- .gitignore
|
88
|
+
- .rspec
|
89
|
+
- .travis.yml
|
90
|
+
- Gemfile
|
91
|
+
- LICENSE
|
92
|
+
- README.md
|
93
|
+
- Rakefile
|
94
|
+
- klout-rb.gemspec
|
95
|
+
- lib/klout-rb.rb
|
96
|
+
- lib/klout.rb
|
97
|
+
- lib/klout/client.rb
|
98
|
+
- lib/klout/version.rb
|
99
|
+
- spec/fixtures/klout.json
|
100
|
+
- spec/fixtures/no_users.json
|
101
|
+
- spec/fixtures/soi_influenced_by.json
|
102
|
+
- spec/fixtures/soi_influencer_of.json
|
103
|
+
- spec/fixtures/users_show.json
|
104
|
+
- spec/fixtures/users_topics.json
|
105
|
+
- spec/klout_spec.rb
|
106
|
+
- spec/spec_helper.rb
|
107
|
+
homepage: http://github.com/cdamian/klout-rb
|
108
|
+
licenses: []
|
109
|
+
post_install_message:
|
110
|
+
rdoc_options: []
|
111
|
+
require_paths:
|
112
|
+
- lib
|
113
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
114
|
+
none: false
|
115
|
+
requirements:
|
116
|
+
- - ! '>='
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
segments:
|
120
|
+
- 0
|
121
|
+
hash: 947582353
|
122
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
|
+
none: false
|
124
|
+
requirements:
|
125
|
+
- - ! '>='
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '0'
|
128
|
+
segments:
|
129
|
+
- 0
|
130
|
+
hash: 947582353
|
131
|
+
requirements: []
|
132
|
+
rubyforge_project: klout-rb
|
133
|
+
rubygems_version: 1.8.10
|
134
|
+
signing_key:
|
135
|
+
specification_version: 3
|
136
|
+
summary: Ruby wrapper for the Klout REST API
|
137
|
+
test_files: []
|