share_counter 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/share_counter.rb +7 -1
- data/lib/share_counter/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fcda4dc4900cdc8d48f92be4937cce1f3bc39794
|
4
|
+
data.tar.gz: a17e05e6e75bd1f1285a48093375c842c935af54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdd26525435bc921f28075e28a2431719cb638f3ee42657076fb775dcadb6d71b3e572ad2ee2fd0f7385a3d58cad89a74c55fe34fea8dcb425880253c1a6ca5e
|
7
|
+
data.tar.gz: dd9cedaec522e8ab8a6f62c26feb63228fe63386824da7e251647604253abddd617928da59b01f96c34f25b71c8f954abdb79be627060fa95e85916da1ba8a41
|
data/lib/share_counter.rb
CHANGED
@@ -44,7 +44,7 @@ module ShareCounter
|
|
44
44
|
|
45
45
|
def self.seomoz url, access_id, secret
|
46
46
|
client = Linkscape::Client.new(accessID: access_id, secret: secret)
|
47
|
-
response = client.urlMetrics(url, cols: :all)
|
47
|
+
response = client.urlMetrics(get_host_without_www(url), cols: :all)
|
48
48
|
{ mozrank: response.data['source'][:mozrank], page_authority: response.data['source'][:page_authority] }
|
49
49
|
end
|
50
50
|
|
@@ -63,6 +63,12 @@ module ShareCounter
|
|
63
63
|
|
64
64
|
private
|
65
65
|
|
66
|
+
# URL always gets parsed twice
|
67
|
+
def self.get_host_without_www(url)
|
68
|
+
url = "http://#{url}" if URI.parse(url).scheme.nil?
|
69
|
+
host = URI.parse(url).host.downcase
|
70
|
+
end
|
71
|
+
|
66
72
|
def self.make_request *args
|
67
73
|
result = nil
|
68
74
|
attempts = 1
|