scouter 0.0.1
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 +7 -0
- data/.gitignore +16 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +56 -0
- data/Rakefile +7 -0
- data/bin/scouter +26 -0
- data/lib/scouter/base/connection.rb +12 -0
- data/lib/scouter/base/object.rb +78 -0
- data/lib/scouter/base/version.rb +3 -0
- data/lib/scouter/buffer.rb +49 -0
- data/lib/scouter/facebook.rb +31 -0
- data/lib/scouter/feedly.rb +39 -0
- data/lib/scouter/google_plus.rb +83 -0
- data/lib/scouter/hatena_bookmark.rb +31 -0
- data/lib/scouter/linkedin.rb +38 -0
- data/lib/scouter/pinterest.rb +38 -0
- data/lib/scouter/pocket.rb +55 -0
- data/lib/scouter/twitter.rb +38 -0
- data/lib/scouter.rb +62 -0
- data/scouter.gemspec +29 -0
- data/spec/fixtures/scouter/buffer_google.json +2 -0
- data/spec/fixtures/scouter/buffer_yahoo.json +2 -0
- data/spec/fixtures/scouter/facebook_yahoo.json +15 -0
- data/spec/fixtures/scouter/facebook_yahoo_google.json +26 -0
- data/spec/fixtures/scouter/feedly_morizyun_feed.json +2 -0
- data/spec/fixtures/scouter/feedly_morizyun_hp.json +1 -0
- data/spec/fixtures/scouter/feedly_yahoo_news.json +2 -0
- data/spec/fixtures/scouter/hatenabookmark_yahoo.json +2 -0
- data/spec/fixtures/scouter/hatenabookmark_yahoo_google.json +2 -0
- data/spec/fixtures/scouter/linkedin_google.json +2 -0
- data/spec/fixtures/scouter/linkedin_yahoo.json +2 -0
- data/spec/fixtures/scouter/pinterest_google.json +2 -0
- data/spec/fixtures/scouter/pinterest_yahoo.json +2 -0
- data/spec/fixtures/scouter/pocket_google.html +30 -0
- data/spec/fixtures/scouter/pocket_morizyun_feed.html +30 -0
- data/spec/fixtures/scouter/pocket_morizyun_hp.html +30 -0
- data/spec/fixtures/scouter/pocket_yahoo.html +30 -0
- data/spec/fixtures/scouter/twitter_google.json +2 -0
- data/spec/fixtures/scouter/twitter_yahoo.json +2 -0
- data/spec/scouter/buffer_spec.rb +28 -0
- data/spec/scouter/facebook_spec.rb +36 -0
- data/spec/scouter/feedly_spec.rb +37 -0
- data/spec/scouter/google_plus_spec.rb +27 -0
- data/spec/scouter/hatena_bookmark_spec.rb +27 -0
- data/spec/scouter/linkedin_spec.rb +26 -0
- data/spec/scouter/pinterest_spec.rb +26 -0
- data/spec/scouter/pocket_spec.rb +26 -0
- data/spec/scouter/twitter_spec.rb +26 -0
- data/spec/scouter_spec.rb +82 -0
- data/spec/spec_helper.rb +72 -0
- metadata +225 -0
data/lib/scouter.rb
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
# coding:utf-8
|
2
|
+
# Standard Library
|
3
|
+
require 'cgi'
|
4
|
+
require 'open-uri'
|
5
|
+
require 'json'
|
6
|
+
require 'hashie/mash'
|
7
|
+
|
8
|
+
# Scouter Class/Module
|
9
|
+
require 'scouter/base/version'
|
10
|
+
require 'scouter/base/object'
|
11
|
+
require 'scouter/buffer'
|
12
|
+
require 'scouter/facebook'
|
13
|
+
require 'scouter/feedly'
|
14
|
+
require 'scouter/google_plus'
|
15
|
+
require 'scouter/hatena_bookmark'
|
16
|
+
require 'scouter/linkedin'
|
17
|
+
require 'scouter/pinterest'
|
18
|
+
require 'scouter/pocket'
|
19
|
+
require 'scouter/twitter'
|
20
|
+
|
21
|
+
module Scouter
|
22
|
+
WAIT_SEC = 1
|
23
|
+
ONE_TIME_URL_MAX = 20
|
24
|
+
|
25
|
+
SERVICES = [ Scouter::Buffer,
|
26
|
+
Scouter::Facebook,
|
27
|
+
Scouter::Feedly,
|
28
|
+
Scouter::GooglePlus,
|
29
|
+
Scouter::HatenaBookmark,
|
30
|
+
Scouter::Linkedin,
|
31
|
+
Scouter::Pinterest,
|
32
|
+
Scouter::Pocket,
|
33
|
+
Scouter::Twitter ]
|
34
|
+
|
35
|
+
# get Social Count By Buffer/Facebook/Feedly/GooglePlus/HatenaBookmark/Linkedin/Pinterest/Pocket/Twitter
|
36
|
+
# @param [String or Array] urls
|
37
|
+
def self.get_count(urls, services = SERVICES)
|
38
|
+
results, errors = [], {}
|
39
|
+
|
40
|
+
services.each do |service|
|
41
|
+
result, error = service.get_count(urls)
|
42
|
+
errors[service.service_name] = error && next unless error.empty?
|
43
|
+
results << result
|
44
|
+
end
|
45
|
+
|
46
|
+
results_hash = results_merged_hash(results)
|
47
|
+
return [results_hash, errors]
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def self.results_merged_hash(results)
|
53
|
+
results_hash = {}
|
54
|
+
results.each do |item|
|
55
|
+
item.each do |url, hash|
|
56
|
+
results_hash[url] = (results_hash[url] || {}).merge(hash)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
Hashie::Mash.new(results_hash)
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
data/scouter.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'scouter/base/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'scouter'
|
8
|
+
spec.version = Scouter::VERSION
|
9
|
+
spec.authors = ['morizyun']
|
10
|
+
spec.email = ['merii.ken@gmail.com']
|
11
|
+
spec.summary = %q{get share count in Buffer/Facebook/Feedly/GooglePlus/HatenaBookmark/Linkedin/Pinterest/Pocket/Twitter}
|
12
|
+
spec.description = %q{get share count in Buffer/Facebook/Feedly/GooglePlus/HatenaBookmark/Linkedin/Pinterest/Pocket/Twitter}
|
13
|
+
spec.homepage = 'https://github.com/morizyun/scouter'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.required_ruby_version = '>= 1.9.3'
|
22
|
+
spec.add_dependency 'hashie'
|
23
|
+
spec.add_dependency 'thor'
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
25
|
+
spec.add_development_dependency 'rake'
|
26
|
+
spec.add_development_dependency 'pry'
|
27
|
+
spec.add_development_dependency 'fakeweb'
|
28
|
+
spec.add_development_dependency 'rspec'
|
29
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
{
|
2
|
+
"data": [
|
3
|
+
{
|
4
|
+
"url": "http://www.yahoo.co.jp/",
|
5
|
+
"normalized_url": "http://www.yahoo.co.jp/",
|
6
|
+
"share_count": 58367,
|
7
|
+
"like_count": 88446,
|
8
|
+
"comment_count": 18845,
|
9
|
+
"total_count": 165658,
|
10
|
+
"commentsbox_count": 33,
|
11
|
+
"comments_fbid": 400186308976,
|
12
|
+
"click_count": 5
|
13
|
+
}
|
14
|
+
]
|
15
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
{
|
2
|
+
"data": [
|
3
|
+
{
|
4
|
+
"url": "http://www.google.com/",
|
5
|
+
"normalized_url": "http://www.google.com/",
|
6
|
+
"share_count": 6599040,
|
7
|
+
"like_count": 1550962,
|
8
|
+
"comment_count": 1808001,
|
9
|
+
"total_count": 9958003,
|
10
|
+
"commentsbox_count": 929,
|
11
|
+
"comments_fbid": 396269740024,
|
12
|
+
"click_count": 265614
|
13
|
+
},
|
14
|
+
{
|
15
|
+
"url": "http://www.yahoo.co.jp/",
|
16
|
+
"normalized_url": "http://www.yahoo.co.jp/",
|
17
|
+
"share_count": 58367,
|
18
|
+
"like_count": 88446,
|
19
|
+
"comment_count": 18845,
|
20
|
+
"total_count": 165658,
|
21
|
+
"commentsbox_count": 33,
|
22
|
+
"comments_fbid": 400186308976,
|
23
|
+
"click_count": 5
|
24
|
+
}
|
25
|
+
]
|
26
|
+
}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
|
2
|
+
{"id":"feed/http://feeds.feedburner.com/rubyrails","feedId":"feed/http://feeds.feedburner.com/rubyrails","language":"ja","subscribers":699,"title":"酒と泪とRubyとRailsと","velocity":1.2,"topics":["ruby","it","tech","programming","プログラミング"],"website":"http://morizyun.github.io/","description":"Railsアプリで簡単に自分で作った404/500エラーページを表示させる手順です。404/500エラーページもユーザビリティの面やコンバージョンの面で非常に重要ですよね! あるRailsアプリでルーティング系のエラーはルートにリダイレクトするようにしていたのですが、SEO的にはNGだと知りました …","contentType":"article","partial":false,"iconUrl":"http://storage.googleapis.com/site-assets/nVYw0wl0ErFFolk8q67vNTT0CjjBX5ZzF6h7DiV487E_sicon-148390e20c6","visualUrl":"http://storage.googleapis.com/site-assets/nVYw0wl0ErFFolk8q67vNTT0CjjBX5ZzF6h7DiV487E_svisual"}
|
@@ -0,0 +1 @@
|
|
1
|
+
[]
|
@@ -0,0 +1,2 @@
|
|
1
|
+
|
2
|
+
{"id":"feed/http://rss.dailynews.yahoo.co.jp/fc/rss.xml","feedId":"feed/http://rss.dailynews.yahoo.co.jp/fc/rss.xml","language":"ja","subscribers":4370,"title":"Yahoo!ニュース・トピックス - トップ","velocity":715.2,"topics":["news","ニュース","yahoo"],"website":"http://news.yahoo.co.jp/","description":"Yahoo! JAPANのニュース・トピックスで取り上げている最新の見出しを提供しています。","contentType":"article","partial":true,"iconUrl":"http://storage.googleapis.com/site-assets/77SstB99G_bAswvFv8rV1-60WkgCWiDra34ZDXCcdi0_sicon-14834fde21a","visualUrl":"http://storage.googleapis.com/site-assets/77SstB99G_bAswvFv8rV1-60WkgCWiDra34ZDXCcdi0_svisual"}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<link rel="stylesheet" type="text/css" href="https://d7x5nblzs94me.cloudfront.net/v1/c/button.css?v=6" />
|
5
|
+
<script type="text/javascript" src="https://d7x5nblzs94me.cloudfront.net/v1/j/shared.js?v=2"></script>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
|
9
|
+
<div class="widget vertical pocket left">
|
10
|
+
<a id="btn">
|
11
|
+
<!--
|
12
|
+
Please do not scrape this for the Pocket count.
|
13
|
+
It is not relible for you to use and will likely change.
|
14
|
+
Contact us at api@getpocket.com for an official API.
|
15
|
+
Thanks!
|
16
|
+
-->
|
17
|
+
<span><em id="cnt">164929</em><i></i><u></u></span>
|
18
|
+
<b></b>
|
19
|
+
</a>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<script type="text/javascript">
|
23
|
+
var POCKET_DOMAIN = 'getpocket.com';
|
24
|
+
var iLi = false;
|
25
|
+
|
26
|
+
var btnData = {"mode":"viapocketbutton","ct":"a17dc9c5ffb9fe2efdf153989436f31fd689ab85","ctn":"f3b1c476c30b70091c17e73e43a422d7d069de0d","label":"pocket","count":"vertical","src":"http:\/\/www.google.com\/","url":"http:\/\/www.google.com\/"};
|
27
|
+
</script>
|
28
|
+
<script type="text/javascript" src="https://d7x5nblzs94me.cloudfront.net/v1/j/button.js?v=5"></script>
|
29
|
+
</body>
|
30
|
+
</html>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<link rel="stylesheet" type="text/css" href="https://d7x5nblzs94me.cloudfront.net/v1/c/button.css?v=6" />
|
5
|
+
<script type="text/javascript" src="https://d7x5nblzs94me.cloudfront.net/v1/j/shared.js?v=2"></script>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
|
9
|
+
<div class="widget vertical pocket left">
|
10
|
+
<a id="btn">
|
11
|
+
<!--
|
12
|
+
Please do not scrape this for the Pocket count.
|
13
|
+
It is not relible for you to use and will likely change.
|
14
|
+
Contact us at api@getpocket.com for an official API.
|
15
|
+
Thanks!
|
16
|
+
-->
|
17
|
+
<span><em id="cnt">0</em><i></i><u></u></span>
|
18
|
+
<b></b>
|
19
|
+
</a>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<script type="text/javascript">
|
23
|
+
var POCKET_DOMAIN = 'getpocket.com';
|
24
|
+
var iLi = false;
|
25
|
+
|
26
|
+
var btnData = {"mode":"viapocketbutton","ct":"df051b121571d045824d92441eeeb01d0152a945","ctn":"d01a3b7fdbc701780354f58192f22f58bbda7df1","label":"pocket","count":"vertical","src":"http:\/\/feeds.feedburner.com\/rubyrails","url":"http:\/\/feeds.feedburner.com\/rubyrails"};
|
27
|
+
</script>
|
28
|
+
<script type="text/javascript" src="https://d7x5nblzs94me.cloudfront.net/v1/j/button.js?v=5"></script>
|
29
|
+
</body>
|
30
|
+
</html>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<link rel="stylesheet" type="text/css" href="https://d7x5nblzs94me.cloudfront.net/v1/c/button.css?v=6" />
|
5
|
+
<script type="text/javascript" src="https://d7x5nblzs94me.cloudfront.net/v1/j/shared.js?v=2"></script>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
|
9
|
+
<div class="widget vertical pocket left">
|
10
|
+
<a id="btn">
|
11
|
+
<!--
|
12
|
+
Please do not scrape this for the Pocket count.
|
13
|
+
It is not relible for you to use and will likely change.
|
14
|
+
Contact us at api@getpocket.com for an official API.
|
15
|
+
Thanks!
|
16
|
+
-->
|
17
|
+
<span><em id="cnt">39</em><i></i><u></u></span>
|
18
|
+
<b></b>
|
19
|
+
</a>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<script type="text/javascript">
|
23
|
+
var POCKET_DOMAIN = 'getpocket.com';
|
24
|
+
var iLi = false;
|
25
|
+
|
26
|
+
var btnData = {"mode":"viapocketbutton","ct":"636227860fa96aa911d5220cef281b48598eb59a","ctn":"957829ff5d92cee21e99de7e0372257539c41699","label":"pocket","count":"vertical","src":"http:\/\/morizyun.github.io","url":"http:\/\/morizyun.github.io"};
|
27
|
+
</script>
|
28
|
+
<script type="text/javascript" src="https://d7x5nblzs94me.cloudfront.net/v1/j/button.js?v=5"></script>
|
29
|
+
</body>
|
30
|
+
</html>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<link rel="stylesheet" type="text/css" href="https://d7x5nblzs94me.cloudfront.net/v1/c/button.css?v=6" />
|
5
|
+
<script type="text/javascript" src="https://d7x5nblzs94me.cloudfront.net/v1/j/shared.js?v=2"></script>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
|
9
|
+
<div class="widget vertical pocket left">
|
10
|
+
<a id="btn">
|
11
|
+
<!--
|
12
|
+
Please do not scrape this for the Pocket count.
|
13
|
+
It is not relible for you to use and will likely change.
|
14
|
+
Contact us at api@getpocket.com for an official API.
|
15
|
+
Thanks!
|
16
|
+
-->
|
17
|
+
<span><em id="cnt">22840</em><i></i><u></u></span>
|
18
|
+
<b></b>
|
19
|
+
</a>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<script type="text/javascript">
|
23
|
+
var POCKET_DOMAIN = 'getpocket.com';
|
24
|
+
var iLi = false;
|
25
|
+
|
26
|
+
var btnData = {"mode":"viapocketbutton","ct":"59c2bdfd4801de0f06875e7cebd2a7957067ad64","ctn":"2264ccd664d5d10fdd016490530fbf79752c73e4","label":"pocket","count":"vertical","src":"http:\/\/www.yahoo.co.jp\/","url":"http:\/\/www.yahoo.co.jp\/"};
|
27
|
+
</script>
|
28
|
+
<script type="text/javascript" src="https://d7x5nblzs94me.cloudfront.net/v1/j/button.js?v=5"></script>
|
29
|
+
</body>
|
30
|
+
</html>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Scouter::Buffer do
|
4
|
+
describe '#get_count' do
|
5
|
+
let!(:yahoo) { 'http://www.yahoo.co.jp/' }
|
6
|
+
let!(:google) { 'http://www.google.com/' }
|
7
|
+
|
8
|
+
context 'when url parameter is String' do
|
9
|
+
context 'when url is feed url' do
|
10
|
+
it 'return 129 shares' do
|
11
|
+
results, errors = Scouter::Buffer.get_count(yahoo)
|
12
|
+
expect(errors).to be_empty
|
13
|
+
expect(results[yahoo].buffer).to be == 129
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'when url parameter is Array' do
|
19
|
+
it 'yahoo has over 129 shares and google 4635 shares' do
|
20
|
+
results, errors = Scouter::Buffer.get_count([yahoo, google])
|
21
|
+
expect(errors).to be_empty
|
22
|
+
expect(results[yahoo].buffer).to be == 129
|
23
|
+
expect(results[google].buffer).to be == 4635
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Scouter::Facebook do
|
4
|
+
describe '#get_count' do
|
5
|
+
let!(:yahoo) { 'http://www.yahoo.co.jp/' }
|
6
|
+
let!(:google) { 'http://www.google.com/' }
|
7
|
+
|
8
|
+
context 'when url parameter is String' do
|
9
|
+
context 'when exist url' do
|
10
|
+
it 'yahoo has over 160000 like' do
|
11
|
+
results, errors = Scouter::Facebook.get_count(yahoo)
|
12
|
+
expect(errors).to be_empty
|
13
|
+
expect(results[yahoo].facebook).to be >= 160000
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context 'when raise parse errors' do
|
18
|
+
it 'returns error' do
|
19
|
+
allow(Scouter::Facebook).to receive(:parse_response).and_raise(StandardError)
|
20
|
+
_, errors = Scouter::Facebook.get_count(yahoo)
|
21
|
+
expect(errors).not_to be_empty
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'when url parameter is Array' do
|
27
|
+
it 'yahoo has over 160000 like and google has over 9900000 like' do
|
28
|
+
results, errors = Scouter::Facebook.get_count([yahoo, google])
|
29
|
+
expect(errors).to be_empty
|
30
|
+
expect(results[yahoo].facebook).to be >= 160000
|
31
|
+
expect(results[google].facebook).to be >= 9900000
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Scouter::Feedly do
|
4
|
+
describe '#get_count' do
|
5
|
+
let!(:morizyun_hp) { 'http://morizyun.github.io' }
|
6
|
+
let!(:morizyun_feed){ 'http://feeds.feedburner.com/rubyrails' }
|
7
|
+
let!(:yahoo_news) { 'http://rss.dailynews.yahoo.co.jp/fc/rss.xml' }
|
8
|
+
|
9
|
+
context 'when url parameter is String' do
|
10
|
+
context 'when url is feed url' do
|
11
|
+
it 'return 699 subscriber' do
|
12
|
+
results, errors = Scouter::Feedly.get_count(morizyun_feed)
|
13
|
+
expect(errors).to be_empty
|
14
|
+
expect(results[morizyun_feed].feedly).to be >= 699
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'when url is website url' do
|
19
|
+
it 'return nil' do
|
20
|
+
results, errors = Scouter::Feedly.get_count(morizyun_hp)
|
21
|
+
expect(errors).to be_empty
|
22
|
+
expect(results[morizyun_hp]).to be_nil
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'when url parameter is Array' do
|
28
|
+
it 'morizyun.github.io has over 699 subscriber and google has over 4369 subscriber' do
|
29
|
+
results, errors = Scouter::Feedly.get_count([morizyun_feed, yahoo_news])
|
30
|
+
expect(errors).to be_empty
|
31
|
+
expect(results[morizyun_feed].feedly).to be >= 699
|
32
|
+
expect(results[yahoo_news].feedly).to be >= 4369
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Scouter::GooglePlus do
|
4
|
+
describe '#get_count' do
|
5
|
+
let!(:yahoo) { 'http://www.yahoo.co.jp/' }
|
6
|
+
let!(:google) { 'http://www.google.com/' }
|
7
|
+
|
8
|
+
context 'when url parameter is String' do
|
9
|
+
it 'yahoo has over 130000 count' do
|
10
|
+
results, errors = Scouter::GooglePlus.get_count(yahoo)
|
11
|
+
expect(errors).to be_empty
|
12
|
+
expect(results[yahoo].googleplus).to be >= 130000
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context 'when url parameter is Array' do
|
18
|
+
it 'yahoo has over 130000 count and google has over 9100000 count' do
|
19
|
+
results, errors = Scouter::GooglePlus.get_count([google, yahoo])
|
20
|
+
expect(errors).to be_empty
|
21
|
+
expect(results[yahoo].googleplus).to be >= 130000
|
22
|
+
expect(results[google].googleplus).to be >= 9100000
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Scouter::HatenaBookmark do
|
4
|
+
describe '#get_count' do
|
5
|
+
let!(:yahoo) { 'http://www.yahoo.co.jp/' }
|
6
|
+
let!(:google) { 'http://www.google.com/' }
|
7
|
+
|
8
|
+
context 'when url parameter is String' do
|
9
|
+
it 'yahoo has over 13000 bookmarks' do
|
10
|
+
results, errors = Scouter::HatenaBookmark.get_count(yahoo)
|
11
|
+
expect(errors).to be_empty
|
12
|
+
expect(results[yahoo].hatenabookmark).to be >= 13000
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context 'when url parameter is Array' do
|
18
|
+
it 'yahoo has over 13000 bookmarks and google has over 450 bookmarks' do
|
19
|
+
results, errors = Scouter::HatenaBookmark.get_count([google, yahoo])
|
20
|
+
expect(errors).to be_empty
|
21
|
+
expect(results[yahoo].hatenabookmark).to be >= 13000
|
22
|
+
expect(results[google].hatenabookmark).to be >= 450
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Scouter::Linkedin do
|
4
|
+
describe '#get_count' do
|
5
|
+
let!(:yahoo) { 'http://www.yahoo.co.jp/' }
|
6
|
+
let!(:google) { 'http://www.google.com/' }
|
7
|
+
|
8
|
+
context 'when url parameter is String' do
|
9
|
+
it 'yahoo has over 216 count' do
|
10
|
+
results, errors = Scouter::Linkedin.get_count(yahoo)
|
11
|
+
expect(errors).to be_empty
|
12
|
+
expect(results[yahoo].linkedin).to be >= 216
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'when url parameter is Array' do
|
17
|
+
it 'yahoo has over 216 count and google has over 1003 count' do
|
18
|
+
results, errors = Scouter::Linkedin.get_count([google, yahoo])
|
19
|
+
expect(errors).to be_empty
|
20
|
+
expect(results[yahoo].linkedin).to be >= 216
|
21
|
+
expect(results[google].linkedin).to be >= 1003
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Scouter::Pinterest do
|
4
|
+
describe '#get_count' do
|
5
|
+
let!(:yahoo) { 'http://www.yahoo.co.jp/' }
|
6
|
+
let!(:google) { 'http://www.google.com/' }
|
7
|
+
|
8
|
+
context 'when url parameter is String' do
|
9
|
+
it 'yahoo has over 141 pins' do
|
10
|
+
results, errors = Scouter::Pinterest.get_count(yahoo)
|
11
|
+
expect(errors).to be_empty
|
12
|
+
expect(results[yahoo].pinterest).to be >= 141
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'when url parameter is Array' do
|
17
|
+
it 'yahoo has over 141 pins and google has over 912822 pins' do
|
18
|
+
results, errors = Scouter::Pinterest.get_count([google, yahoo])
|
19
|
+
expect(errors).to be_empty
|
20
|
+
expect(results[yahoo].pinterest).to be >= 141
|
21
|
+
expect(results[google].pinterest).to be >= 912822
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Scouter::Pocket do
|
4
|
+
describe '#get_count' do
|
5
|
+
let!(:yahoo) { 'http://www.yahoo.co.jp/' }
|
6
|
+
let!(:google) { 'http://www.google.com/' }
|
7
|
+
|
8
|
+
context 'when url parameter is String' do
|
9
|
+
it 'yahoo has over 22000 like' do
|
10
|
+
results, errors = Scouter::Pocket.get_count(yahoo)
|
11
|
+
expect(errors).to be_empty
|
12
|
+
expect(results[yahoo].pocket).to be >= 22000
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'when url parameter is Array' do
|
17
|
+
it 'yahoo has over 22000 count and google has over 160000 count' do
|
18
|
+
results, errors = Scouter::Pocket.get_count([google, yahoo])
|
19
|
+
expect(errors).to be_empty
|
20
|
+
expect(results[yahoo].pocket).to be >= 22000
|
21
|
+
expect(results[google].pocket).to be >= 160000
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Scouter::Twitter do
|
4
|
+
describe '#get_count' do
|
5
|
+
let!(:yahoo) { 'http://www.yahoo.co.jp/' }
|
6
|
+
let!(:google) { 'http://www.google.com/' }
|
7
|
+
|
8
|
+
context 'when url parameter is String' do
|
9
|
+
it 'yahoo has over 135000 tweet' do
|
10
|
+
results, errors = Scouter::Twitter.get_count(yahoo)
|
11
|
+
expect(errors).to be_empty
|
12
|
+
expect(results[yahoo].twitter).to be >= 135000
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'when url parameter is Array' do
|
17
|
+
it 'yahoo has over 135000 tweet and google has over 21920000 tweet' do
|
18
|
+
results, errors = Scouter::Twitter.get_count([google, yahoo])
|
19
|
+
expect(errors).to be_empty
|
20
|
+
expect(results[yahoo].twitter).to be >= 135000
|
21
|
+
expect(results[google].twitter).to be >= 21920000
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|