skore 0.0.3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.idea/.rakeTasks +7 -0
- data/.idea/encodings.xml +5 -0
- data/.idea/misc.xml +5 -0
- data/.idea/modules.xml +9 -0
- data/.idea/scopes/scope_settings.xml +5 -0
- data/.idea/skore.iml +21 -0
- data/.idea/vcs.xml +7 -0
- data/.idea/workspace.xml +50 -0
- data/README.md +8 -7
- data/lib/skore.rb +5 -4
- data/lib/skore/klout.rb +25 -28
- data/lib/skore/kred.rb +25 -28
- data/lib/skore/peerindex.rb +12 -18
- data/lib/skore/skore_util.rb +25 -0
- data/lib/skore/version.rb +1 -1
- data/skore.gemspec +14 -13
- metadata +44 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6cb3aea4a728089ad12ad133d1774e361cd6a34f
|
4
|
+
data.tar.gz: 57ea826f436d66b5d530ed9dd871b829188d9f90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6171f2beaa8722b1744e69fb3718633d598a0e8bbc9ec377d742f8daa7fe449749fdc5c12c04a6891041b0e52fdabda87246633758171d811306b417a8a1835c
|
7
|
+
data.tar.gz: a146b7194c6833eb5dc0350afbbf325ccb1334129d5b2025f5f461e6f1a7c276658a64154aa02e2638995fab5d829f8e327f69ac931eff7a20d5029276f3f9e7
|
data/.idea/.rakeTasks
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<Settings><!--This file was automatically generated by Ruby plugin.
|
3
|
+
You are allowed to:
|
4
|
+
1. Remove rake task
|
5
|
+
2. Add existing rake tasks
|
6
|
+
To add existing rake tasks automatically delete this file and reload the project.
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build skore-0.1.0.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Build and install skore-0.1.0.gem into system gems" fullCmd="install" taksId="install" /><RakeTask description="Create tag v0.1.0 and build and push skore-0.1.0.gem to Rubygems" fullCmd="release" taksId="release" /></RakeGroup></Settings>
|
data/.idea/encodings.xml
ADDED
data/.idea/misc.xml
ADDED
data/.idea/modules.xml
ADDED
data/.idea/skore.iml
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="CompassSettings">
|
4
|
+
<option name="compassSupportEnabled" value="true" />
|
5
|
+
</component>
|
6
|
+
<component name="FacetManager">
|
7
|
+
<facet type="gem" name="Ruby Gem">
|
8
|
+
<configuration>
|
9
|
+
<option name="GEM_APP_ROOT_PATH" value="$MODULE_DIR$" />
|
10
|
+
<option name="GEM_APP_TEST_PATH" value="" />
|
11
|
+
<option name="GEM_APP_LIB_PATH" value="$MODULE_DIR$/lib" />
|
12
|
+
</configuration>
|
13
|
+
</facet>
|
14
|
+
</component>
|
15
|
+
<component name="NewModuleRootManager">
|
16
|
+
<content url="file://$MODULE_DIR$" />
|
17
|
+
<orderEntry type="inheritedJdk" />
|
18
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
19
|
+
</component>
|
20
|
+
</module>
|
21
|
+
|
data/.idea/vcs.xml
ADDED
data/.idea/workspace.xml
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ChangeListManager">
|
4
|
+
<option name="TRACKING_ENABLED" value="true" />
|
5
|
+
<option name="SHOW_DIALOG" value="false" />
|
6
|
+
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
7
|
+
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
8
|
+
<option name="LAST_RESOLUTION" value="IGNORE" />
|
9
|
+
</component>
|
10
|
+
<component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
|
11
|
+
<component name="CreatePatchCommitExecutor">
|
12
|
+
<option name="PATCH_PATH" value="" />
|
13
|
+
</component>
|
14
|
+
<component name="DaemonCodeAnalyzer">
|
15
|
+
<disable_hints />
|
16
|
+
</component>
|
17
|
+
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
18
|
+
<OptionsSetting value="true" id="Add" />
|
19
|
+
<OptionsSetting value="true" id="Remove" />
|
20
|
+
<OptionsSetting value="true" id="Checkout" />
|
21
|
+
<OptionsSetting value="true" id="Update" />
|
22
|
+
<OptionsSetting value="true" id="Status" />
|
23
|
+
<OptionsSetting value="true" id="Edit" />
|
24
|
+
<ConfirmationsSetting value="0" id="Add" />
|
25
|
+
<ConfirmationsSetting value="0" id="Remove" />
|
26
|
+
</component>
|
27
|
+
<component name="ProjectReloadState">
|
28
|
+
<option name="STATE" value="0" />
|
29
|
+
</component>
|
30
|
+
<component name="RunManager">
|
31
|
+
<list size="0" />
|
32
|
+
</component>
|
33
|
+
<component name="ShelveChangesManager" show_recycled="false" />
|
34
|
+
<component name="TaskManager">
|
35
|
+
<task active="true" id="Default" summary="Default task" />
|
36
|
+
<servers />
|
37
|
+
</component>
|
38
|
+
<component name="VcsContentAnnotationSettings">
|
39
|
+
<option name="myLimit" value="2678400000" />
|
40
|
+
</component>
|
41
|
+
<component name="VcsManagerConfiguration">
|
42
|
+
<option name="myTodoPanelSettings">
|
43
|
+
<TodoPanelSettings />
|
44
|
+
</option>
|
45
|
+
</component>
|
46
|
+
<component name="XDebuggerManager">
|
47
|
+
<breakpoint-manager />
|
48
|
+
</component>
|
49
|
+
</project>
|
50
|
+
|
data/README.md
CHANGED
@@ -26,27 +26,28 @@ return float number like 55.394093
|
|
26
26
|
|
27
27
|
if you want to round the score simply add true method to ```score```
|
28
28
|
|
29
|
-
|
30
|
-
puts user.score true
|
31
|
-
|
29
|
+
score = Skore::KloutSkore.new(@klout_api_key).score(username, true)
|
32
30
|
|
33
31
|
return 55
|
34
32
|
|
35
33
|
### Get Kred Score
|
36
34
|
|
37
|
-
|
38
|
-
puts user.score
|
35
|
+
score = Skore::Kred.new(@kred_app_id, @kred_app_key).score(social_network.to_sym, username)
|
39
36
|
|
40
37
|
return number like 777
|
41
38
|
|
42
39
|
|
43
40
|
### Get PeerIndex Score
|
44
41
|
|
45
|
-
|
46
|
-
puts user.score
|
42
|
+
score = Skore::PeerIndex.new(@peerindex_api_key).score(username)
|
47
43
|
|
48
44
|
return number like 30
|
49
45
|
|
46
|
+
### Or get it for all(Only twitter)
|
47
|
+
|
48
|
+
scores = Skore::SkoreUtil.new({klout_api_key: '', peerindex_api_key: '', kred_app_id: '', kred_app_key: ''}).score('twitter', 'mrkaspa')
|
49
|
+
scores = Skore::SkoreUtil.new({klout_api_key: ''}).score('instagram', 'mrkaspa')
|
50
|
+
|
50
51
|
## Contributing
|
51
52
|
|
52
53
|
1. Fork it ( https://github.com/kreattiewe/skore/fork )
|
data/lib/skore.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
1
|
+
require 'skore/version'
|
2
|
+
require 'skore/klout'
|
3
|
+
require 'skore/kred'
|
4
|
+
require 'skore/peerindex'
|
5
|
+
require 'skore/skore_util'
|
data/lib/skore/klout.rb
CHANGED
@@ -1,36 +1,33 @@
|
|
1
1
|
require 'klout'
|
2
|
-
##
|
3
2
|
# This module analize and extract score from social analizer http://klout.com
|
4
|
-
module Skore
|
5
|
-
|
3
|
+
module Skore
|
4
|
+
class KloutSkore
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
include Klout
|
6
|
+
# Include module and clases from Klout
|
7
|
+
include Klout
|
10
8
|
|
11
|
-
|
12
|
-
##
|
13
|
-
# Initialize Base and almacenate user information
|
14
|
-
def initialize(api_key, username)
|
15
|
-
begin
|
16
|
-
Klout.api_key = api_key
|
17
|
-
identity = Identity.find_by_screen_name(username)
|
18
|
-
@user = User.new(identity.id)
|
19
|
-
rescue
|
20
|
-
@error = true
|
21
|
-
end
|
22
|
-
end
|
9
|
+
attr_accessor :user
|
23
10
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
else
|
30
|
-
-1
|
31
|
-
end
|
32
|
-
end
|
11
|
+
# Initialize Base and almacenate user information
|
12
|
+
def initialize(api_key)
|
13
|
+
raise ArgumentError, 'api_key is required' if api_key == nil || api_key.empty?
|
14
|
+
Klout.api_key = api_key
|
15
|
+
end
|
33
16
|
|
17
|
+
# Get score for user
|
18
|
+
def score(username, round=false)
|
19
|
+
begin
|
20
|
+
identity = Identity.find_by_screen_name(username)
|
21
|
+
@user = User.new(identity.id)
|
22
|
+
if round
|
23
|
+
@user.score.score.round
|
24
|
+
else
|
25
|
+
@user.score.score
|
26
|
+
end
|
27
|
+
rescue
|
28
|
+
nil
|
29
|
+
end
|
30
|
+
end
|
34
31
|
|
35
|
-
|
32
|
+
end
|
36
33
|
end
|
data/lib/skore/kred.rb
CHANGED
@@ -1,38 +1,35 @@
|
|
1
1
|
require 'httparty'
|
2
2
|
|
3
|
-
##
|
4
3
|
# This module analize and extract score from social analizer http://kred.com
|
5
4
|
module Skore
|
6
|
-
|
5
|
+
class Kred
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
include HTTParty
|
11
|
-
base_uri "http://api.kred.com/kredscore"
|
12
|
-
default_timeout 1
|
7
|
+
# Include httparty module from http querys
|
8
|
+
include HTTParty
|
13
9
|
|
14
|
-
|
10
|
+
base_uri 'http://api.kred.com/kredscore'
|
11
|
+
default_timeout 1
|
15
12
|
|
16
|
-
|
17
|
-
# Initialize and load data from kred api
|
18
|
-
def initialize(app_id, app_key, username)
|
19
|
-
begin
|
20
|
-
@data = self.class.get("?term=#{username}&source=twitter&app_id=#{app_id}&app_key=#{app_key}", :verify => false)
|
21
|
-
rescue Timeout::Error
|
22
|
-
@data = false
|
23
|
-
end
|
24
|
-
end
|
13
|
+
attr_accessor :data
|
25
14
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
-1
|
34
|
-
end
|
35
|
-
end
|
15
|
+
# Initialize and load data from kred api
|
16
|
+
def initialize(app_id, app_key)
|
17
|
+
raise ArgumentError, 'app_id is required' if app_id == nil || app_id.empty?
|
18
|
+
raise ArgumentError, 'api_key is required' if app_key == nil || app_key.empty?
|
19
|
+
@app_id = app_id
|
20
|
+
@app_key = app_key
|
21
|
+
end
|
36
22
|
|
37
|
-
|
23
|
+
# Get score from Kred api
|
24
|
+
def score(social_network, username)
|
25
|
+
begin
|
26
|
+
@data = self.class.get("?term=#{username}&source=#{social_network}&app_id=#{@app_id}&app_key=#{@app_key}", verify: false)
|
27
|
+
result = @data ? JSON.parse(@data.body) : nil
|
28
|
+
result['data'][0]['influence'] if result && result['data']
|
29
|
+
rescue Timeout::Error
|
30
|
+
nil
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
38
35
|
end
|
data/lib/skore/peerindex.rb
CHANGED
@@ -1,37 +1,31 @@
|
|
1
1
|
require 'httparty'
|
2
2
|
|
3
|
-
##
|
4
3
|
# This module analize and extract score from social analizer http://kred.com
|
5
4
|
module Skore
|
6
5
|
class PeerIndex
|
7
6
|
|
8
|
-
##
|
9
7
|
# Include httparty module from http querys
|
10
8
|
include HTTParty
|
11
|
-
base_uri
|
9
|
+
base_uri 'https://api.peerindex.com/1/actor/topic'
|
12
10
|
default_timeout 1
|
13
11
|
|
14
12
|
attr_accessor :data
|
15
13
|
|
16
|
-
##
|
17
14
|
# Initialize and load data from kred api
|
18
|
-
def initialize(api_key
|
19
|
-
|
20
|
-
|
21
|
-
rescue Timeout::Error
|
22
|
-
@data = false
|
23
|
-
end
|
15
|
+
def initialize(api_key)
|
16
|
+
raise ArgumentError, 'api_key is required' if api_key == nil || api_key.empty?
|
17
|
+
@api_key = api_key
|
24
18
|
end
|
25
19
|
|
26
|
-
##
|
27
20
|
# Get core from peerindex api
|
28
|
-
def score
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
21
|
+
def score(username)
|
22
|
+
begin
|
23
|
+
@data = self.class.get("?twitter_screen_name=#{username}&api_key=#{@api_key}", verify: false)
|
24
|
+
result = @data ? JSON.parse(@data.body) : nil
|
25
|
+
result['peerindex'] if result
|
26
|
+
rescue Timeout::Error
|
27
|
+
nil
|
28
|
+
end
|
35
29
|
end
|
36
30
|
|
37
31
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Skore
|
2
|
+
class SkoreUtil
|
3
|
+
|
4
|
+
def initialize(options = {})
|
5
|
+
@klout_api_key = options[:klout_api_key]
|
6
|
+
@peerindex_api_key = options[:peerindex_api_key]
|
7
|
+
@kred_app_id = options[:kred_app_id]
|
8
|
+
@kred_app_key = options[:kred_app_key]
|
9
|
+
end
|
10
|
+
|
11
|
+
def score(social_network, username)
|
12
|
+
result = {}
|
13
|
+
case social_network.to_sym
|
14
|
+
when :twitter then
|
15
|
+
result[:klout] = Skore::KloutSkore.new(@klout_api_key).score(username, true)
|
16
|
+
result[:peerindex] = Skore::PeerIndex.new(@peerindex_api_key).score(username)
|
17
|
+
result[:kred] = Skore::Kred.new(@kred_app_id, @kred_app_key).score(social_network.to_sym, username)
|
18
|
+
else
|
19
|
+
result[:klout] = Skore::KloutSkore.new(@klout_api_key).score(username, true)
|
20
|
+
end
|
21
|
+
result
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
data/lib/skore/version.rb
CHANGED
data/skore.gemspec
CHANGED
@@ -4,24 +4,25 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'skore/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'skore'
|
8
8
|
spec.version = Skore::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email =
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
13
|
-
spec.homepage =
|
14
|
-
spec.post_install_message =
|
15
|
-
spec.license =
|
9
|
+
spec.authors = ['Angel Botto', 'Michel Perez']
|
10
|
+
spec.email = %w(angelbotto@gmail.com michel.ingesoft@gmail.com)
|
11
|
+
spec.summary = 'Analize social score from users in Klout, Kred and PeerIndex'
|
12
|
+
spec.description = 'Analize social score from users in Klout, Kred and PeerIndex'
|
13
|
+
spec.homepage = 'http://kreattiewe.com/gem/skore'
|
14
|
+
spec.post_install_message = 'Thanks for instaling!!'
|
15
|
+
spec.license = 'MIT'
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0")
|
18
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
-
spec.require_paths = [
|
21
|
-
|
22
|
-
spec.add_development_dependency "bundler", "~> 1.6"
|
23
|
-
spec.add_development_dependency "rspec", "~> 3.1.0"
|
24
|
-
spec.add_development_dependency "rake"
|
20
|
+
spec.require_paths = ['lib']
|
25
21
|
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
23
|
+
spec.add_development_dependency 'rspec', '~> 3.1.0'
|
24
|
+
spec.add_development_dependency 'rake'
|
25
|
+
spec.add_runtime_dependency 'klout'
|
26
|
+
spec.add_runtime_dependency 'httparty'
|
26
27
|
|
27
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Angel Botto
|
8
|
+
- Michel Perez
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2014-
|
12
|
+
date: 2014-11-10 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
@@ -52,14 +53,51 @@ dependencies:
|
|
52
53
|
- - '>='
|
53
54
|
- !ruby/object:Gem::Version
|
54
55
|
version: '0'
|
55
|
-
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: klout
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: httparty
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
description: Analize social score from users in Klout, Kred and PeerIndex
|
56
85
|
email:
|
57
86
|
- angelbotto@gmail.com
|
87
|
+
- michel.ingesoft@gmail.com
|
58
88
|
executables: []
|
59
89
|
extensions: []
|
60
90
|
extra_rdoc_files: []
|
61
91
|
files:
|
62
92
|
- .gitignore
|
93
|
+
- .idea/.rakeTasks
|
94
|
+
- .idea/encodings.xml
|
95
|
+
- .idea/misc.xml
|
96
|
+
- .idea/modules.xml
|
97
|
+
- .idea/scopes/scope_settings.xml
|
98
|
+
- .idea/skore.iml
|
99
|
+
- .idea/vcs.xml
|
100
|
+
- .idea/workspace.xml
|
63
101
|
- Gemfile
|
64
102
|
- LICENSE.txt
|
65
103
|
- README.md
|
@@ -68,6 +106,7 @@ files:
|
|
68
106
|
- lib/skore/klout.rb
|
69
107
|
- lib/skore/kred.rb
|
70
108
|
- lib/skore/peerindex.rb
|
109
|
+
- lib/skore/skore_util.rb
|
71
110
|
- lib/skore/version.rb
|
72
111
|
- skore.gemspec
|
73
112
|
homepage: http://kreattiewe.com/gem/skore
|
@@ -90,8 +129,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
129
|
version: '0'
|
91
130
|
requirements: []
|
92
131
|
rubyforge_project:
|
93
|
-
rubygems_version: 2.
|
132
|
+
rubygems_version: 2.0.14
|
94
133
|
signing_key:
|
95
134
|
specification_version: 4
|
96
|
-
summary: Analize social score from users
|
135
|
+
summary: Analize social score from users in Klout, Kred and PeerIndex
|
97
136
|
test_files: []
|