share_counter 0.2.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3d45d986a6f52fd77cf7549751a9a7ae524bb001
4
- data.tar.gz: 3c8e129c07d506f856a3f9ca5d709633e47b851a
3
+ metadata.gz: bf6bb8670d21adebb8ef85a4e0af6846687a6a7d
4
+ data.tar.gz: 665e96f318fea7838a538207120ed73df0a15c8b
5
5
  SHA512:
6
- metadata.gz: 71ba886081239ca49a6a450898d637f9933adb95ce1f19416af9adaf27b5ad3277cc7bf3f63b76212fe12ef9013dbf1c295cd32b82fb892b3ce0c61698185fd3
7
- data.tar.gz: bbbcfc6acab0b8989ec75609a160faa8ab30f63df4106ac0ef28d5d1b2479235e23b06023612e3c1d662446847ba8fd710b71503891fa7274ec5d6f1f739275d
6
+ metadata.gz: a2c39b4f752ab0ce825970c23f99774d622cd1d88d19b2ff3e3e83e21a75b7f48dffda596f9911185ab20e58748c9e73dbf82d5663862dcfd8bd4cb79f62fc27
7
+ data.tar.gz: 44a54f1942757a795cbb28b2f0be12ebacb111d8809715d6493cf3b18268de3176a92adc1e9b205157ce0e48b0a11a4ec1ffdb0f35a80d871a26b28bd4ecdcc9
@@ -1,3 +1,3 @@
1
1
  module ShareCounter
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
data/lib/share_counter.rb CHANGED
@@ -43,9 +43,21 @@ module ShareCounter
43
43
  end
44
44
 
45
45
  def self.seomoz url, access_id, secret
46
+ mozrank = 0
47
+ page_authority = 0
48
+ domain_authority = 0
49
+
46
50
  client = Linkscape::Client.new(accessID: access_id, secret: secret)
47
51
  response = client.urlMetrics(url, cols: :all)
48
- { mozrank: response.data['source'][:mozrank], page_authority: response.data['source'][:page_authority], domain_authority: response.data['source'][:domain_authority]}
52
+
53
+ if response.response.code.to_i == 200
54
+ mozrank = response.data['source'][:mozrank]
55
+ page_authority = response.data['source'][:page_authority]
56
+ domain_authority = response.data['source'][:domain_authority]
57
+ return { mozrank: mozrank, page_authority: page_authority, domain_authority: domain_authority }
58
+ end
59
+
60
+ return { mozrank: mozrank, page_authority: page_authority, domain_authority: domain_authority }
49
61
  end
50
62
 
51
63
  def self.supported_networks
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.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Davide Santangelo