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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3dd8ac1d67e7a93c168a558e7c9e2d1f150b4dbf
4
- data.tar.gz: c8b2f8e338d86fb78ff45a7d7a1ab154bff6eff6
3
+ metadata.gz: 6cb3aea4a728089ad12ad133d1774e361cd6a34f
4
+ data.tar.gz: 57ea826f436d66b5d530ed9dd871b829188d9f90
5
5
  SHA512:
6
- metadata.gz: 5c97c0a26e4a8a1608aab25ba5dff8b645b5cac18546b3d1fa1cf00c6a904a57f089c31d0290ca42013fb86440dc4cc55d91bf9752f3520fa67ba1088866d205
7
- data.tar.gz: e795908b67879304d6ec815ce23db6aea27898b5f7dc20f612684e8cb3440658306ad88128703b89cebd13dcbcdec318659f4323a6e3e1ada84bd428d2c33eb2
6
+ metadata.gz: 6171f2beaa8722b1744e69fb3718633d598a0e8bbc9ec377d742f8daa7fe449749fdc5c12c04a6891041b0e52fdabda87246633758171d811306b417a8a1835c
7
+ data.tar.gz: a146b7194c6833eb5dc0350afbbf325ccb1334129d5b2025f5f461e6f1a7c276658a64154aa02e2638995fab5d829f8e327f69ac931eff7a20d5029276f3f9e7
@@ -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>
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
4
+ </project>
5
+
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-2.1.3" project-jdk-type="RUBY_SDK" />
4
+ </project>
5
+
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/skore.iml" filepath="$PROJECT_DIR$/.idea/skore.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
9
+
@@ -0,0 +1,5 @@
1
+ <component name="DependencyValidationManager">
2
+ <state>
3
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
4
+ </state>
5
+ </component>
@@ -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
+
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="" />
5
+ </component>
6
+ </project>
7
+
@@ -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
- user = Skore::KloutSkore.new(API_KEY, TWITTER_USERNAME)
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
- user = Skore::Kred.new(APP_ID, APP_KEY, TWITTER_USERNAME)
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
- user = Skore::PeerIndex.new(API_KEY, TWITTER_USERNAME)
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 )
@@ -1,4 +1,5 @@
1
- require "skore/version"
2
- require "skore/klout"
3
- require "skore/kred"
4
- require "skore/peerindex"
1
+ require 'skore/version'
2
+ require 'skore/klout'
3
+ require 'skore/kred'
4
+ require 'skore/peerindex'
5
+ require 'skore/skore_util'
@@ -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
- class KloutSkore
3
+ module Skore
4
+ class KloutSkore
6
5
 
7
- ##
8
- # Include module and clases from Klout
9
- include Klout
6
+ # Include module and clases from Klout
7
+ include Klout
10
8
 
11
- attr_accessor :user
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
- # Get score for user
26
- def score(round=false)
27
- if !@error
28
- if round then @user.score.score.round else @user.score.score end
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
- end
32
+ end
36
33
  end
@@ -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
- class Kred
5
+ class Kred
7
6
 
8
- ##
9
- # Include httparty module from http querys
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
- attr_accessor :data
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
- # Get score from Kred api
28
- def score
29
- if @data
30
- result = JSON.parse(@data.body)
31
- result["data"][0]["influence"]
32
- else
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
- end
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
@@ -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 "https://api.peerindex.com/1/actor/topic"
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, username)
19
- begin
20
- @data = self.class.get("?twitter_screen_name=#{username}&api_key=#{api_key}", :verify => false)
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
- if @data
30
- result = JSON.parse(@data.body)
31
- result["peerindex"]
32
- else
33
- -1
34
- end
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
@@ -1,3 +1,3 @@
1
1
  module Skore
2
- VERSION = "0.0.3"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -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 = "skore"
7
+ spec.name = 'skore'
8
8
  spec.version = Skore::VERSION
9
- spec.authors = ["Angel Botto"]
10
- spec.email = ["angelbotto@gmail.com"]
11
- spec.summary = "Analize social score from users."
12
- spec.description = "Analize social score from users"
13
- spec.homepage = "http://kreattiewe.com/gem/skore"
14
- spec.post_install_message = "Thanks for instaling!!"
15
- spec.license = "MIT"
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 = ["lib"]
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.3
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-09-17 00:00:00.000000000 Z
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
- description: Analize social score from users
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.2.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: []