share_counter 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0f7a3224979ff4fa601cac348df52e0b7115f734
4
- data.tar.gz: 52dfeeafccc73c34d487f9a2d1f3428b053d3104
3
+ metadata.gz: 45fd928678903ce9c5d4bff5d6ec741a91fc5dfb
4
+ data.tar.gz: 51039ad9ccf8ba41a2b8f43bf5912e1d46bac7b7
5
5
  SHA512:
6
- metadata.gz: fa5a3d7337e166dc53a575c7faef5882e8c34668698996306f6ae4be690330d8571d87e79484ec18f94655f1af185103e157006e68616f48a02d5e4dda7d0b2b
7
- data.tar.gz: d2e4a6a859deecbe045150c3149a20a23a415500ce08fc5d371c18a36544a9e128687945074c61598effc6c26f254f23ca1b8743999f5c995e18a877845268b9
6
+ metadata.gz: bde0b084ecf1201a108cfc6635f9cd830ef9cd54223b1e7574f2588bc8eb2c0eec09adc0d44a43530741a4ef99bb57a7644aa3392b09b0f1ea066ef5ffeb5762
7
+ data.tar.gz: 454686d4b4ca7f30d62f4228a133bec3945ea649323f480cfa4aab4da1b77ad09480ffc3d7e3f9baf183aaba6b64ba9958a0c30cf5501f9f7821f1ea6a477f90
data/README.md CHANGED
@@ -16,7 +16,6 @@ Stumbleupon
16
16
 
17
17
  Pinterest
18
18
 
19
- SeoMoz (individually)
20
19
 
21
20
  ## Installation
22
21
 
@@ -43,13 +42,6 @@ share_counter = ShareCounter.all 'www.chorally.com'
43
42
 
44
43
  {:reddit=>0, :twitter=>47, :facebook=>{:commentsbox_count=>0, :click_count=>0, :total_count=>44, :comment_count=>12, :like_count=>19, :share_count=>13}, :linkedin=>58, :stumbleupon=>nil, :pinterest=>0}
45
44
  ```
46
- MozRank and PageAuthority
47
-
48
- ```ruby
49
- share_counter = ShareCounter.seomoz url, 'access_id', 'secret'
50
-
51
- {:mozrank=>5.797102554162212, :page_authority=>31.615971930077954, :domain_authority=>33.44}
52
- ```
53
45
 
54
46
 
55
47
  ## Development
@@ -60,5 +52,4 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
60
52
 
61
53
  ## Contributing
62
54
 
63
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/share_counter.
64
-
55
+ Bug reports and pull requests are welcome on GitHub at https://github.com/chorally/share_counter.
@@ -1,3 +1,3 @@
1
1
  module ShareCounter
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
data/lib/share_counter.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require "share_counter/version"
2
2
  require "rest-client"
3
3
  require "json"
4
- require "linkscape"
5
4
 
6
5
  module ShareCounter
7
6
  def self.twitter url
@@ -27,7 +26,7 @@ module ShareCounter
27
26
 
28
27
  def self.linkedin url
29
28
  html = make_request "https://www.linkedin.com/countserv/count/share", url: url, callback: "IN.Tags.Share.handleCount"
30
- return JSON.parse(html)['count']
29
+ return JSON.parse(html)['count']
31
30
  end
32
31
 
33
32
  def self.stumbleupon url
@@ -47,45 +46,19 @@ module ShareCounter
47
46
  return JSON.parse(html)['count']
48
47
  end
49
48
 
50
- def self.seomoz url, access_id, secret
51
- mozrank = 0
52
- page_authority = 0
53
- domain_authority = 0
54
-
55
- client = Linkscape::Client.new(accessID: access_id, secret: secret)
56
- response = client.urlMetrics(url, cols: :all)
57
-
58
- if response.response.code.to_i == 200
59
- mozrank = response.data['source'][:mozrank]
60
- page_authority = response.data['source'][:page_authority]
61
- domain_authority = response.data['source'][:domain_authority]
62
- return { mozrank: mozrank, page_authority: page_authority, domain_authority: domain_authority }
63
- end
64
-
65
- return { mozrank: mozrank, page_authority: page_authority, domain_authority: domain_authority }
66
- end
67
-
68
49
  def self.supported_networks
69
50
  %w(reddit twitter facebook linkedin stumbleupon pinterest)
70
51
  end
71
52
 
72
- def self.supported_major_networks
73
- %w(reddit twitter facebook linkedin)
74
- end
75
-
76
53
  def self.all url
77
54
  supported_networks.inject({}) { |r, c| r[c.to_sym] = ShareCounter.send(c, url); r }
78
55
  end
79
56
 
80
- def self.major url
81
- supported_major_networks.inject({}) { |r, c| r[c.to_sym] = ShareCounter.send(c, url); r }
82
- end
83
-
84
57
  def self.selected url, selections
85
58
  selections.map{|name| name.downcase}.select{|name| supported_networks.include? name.to_s}.inject({}) {
86
59
  |r, c| r[c.to_sym] = ShareCounter.send(c, url); r }
87
60
  end
88
-
61
+
89
62
  private
90
63
 
91
64
  def self.make_request *args
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
 
12
12
  spec.summary = %q{Check how many times a URL has been shared on social networks and aggregators}
13
13
  spec.description = %q{This gem makes it super easy to check how many times a page/URL has been shared on social networks and aggregators.}
14
- spec.homepage = "http://www.chorally.com"
14
+ spec.homepage = "https://github.com/chorally/share_counter"
15
15
 
16
16
  # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
17
17
  # delete this section to allow pushing this gem to any host.
@@ -32,5 +32,4 @@ Gem::Specification.new do |spec|
32
32
 
33
33
  spec.add_dependency "rest-client"
34
34
  spec.add_dependency "json"
35
- spec.add_dependency "linkscape"
36
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: share_counter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Davide Santangelo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-07-29 00:00:00.000000000 Z
11
+ date: 2015-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,20 +80,6 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: linkscape
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :runtime
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
83
  description: This gem makes it super easy to check how many times a page/URL has been
98
84
  shared on social networks and aggregators.
99
85
  email:
@@ -106,7 +92,6 @@ files:
106
92
  - ".rspec"
107
93
  - ".travis.yml"
108
94
  - Gemfile
109
- - LICENSE
110
95
  - README.md
111
96
  - Rakefile
112
97
  - bin/console
@@ -114,7 +99,7 @@ files:
114
99
  - lib/share_counter.rb
115
100
  - lib/share_counter/version.rb
116
101
  - share_counter.gemspec
117
- homepage: http://www.chorally.com
102
+ homepage: https://github.com/chorally/share_counter
118
103
  licenses: []
119
104
  metadata:
120
105
  allowed_push_host: https://rubygems.org
data/LICENSE DELETED
@@ -1,22 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2015 Chorally LTD
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
22
-