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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e46fa1e2031e0a21b485923ed3fda5fda19bd8aa
4
- data.tar.gz: a86d96640cffe7dd39e12deeecdd95e24782328c
3
+ metadata.gz: fcda4dc4900cdc8d48f92be4937cce1f3bc39794
4
+ data.tar.gz: a17e05e6e75bd1f1285a48093375c842c935af54
5
5
  SHA512:
6
- metadata.gz: 4d29de7717153c21ed6794ac7a84737551971ec685671260efe567a2888d90ece22cf086fc53e5efa027eb5fbe9e2c9b6721411fd7e5a1fc0f8209de4880470f
7
- data.tar.gz: 19c290aacd7e335db56b0680c3b933c44f8e8d0cad78b243e3fcd392f287cd275ec1895d459909d3dca3d97acd1388574a8516f7d17da6e2ae1b7df59ceed314
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
@@ -1,3 +1,3 @@
1
1
  module ShareCounter
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: share_counter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Davide Santangelo