lib/share_counter.rb in share_counter-0.1.3 vs lib/share_counter.rb in share_counter-0.1.4
- old
+ new
@@ -43,11 +43,11 @@
end
def self.seomoz url, access_id, secret
client = Linkscape::Client.new(accessID: access_id, secret: secret)
response = client.urlMetrics(get_host_without_www(url), cols: :all)
- { mozrank: response.data['source'][:mozrank], page_authority: response.data['source'][:page_authority] }
+ { mozrank: response.data['source'][:mozrank], page_authority: response.data['source'][:page_authority], domain_authority: response.data['source'][:domain_authority]}
end
def self.supported_networks
%w(reddit twitter facebook linkedin stumbleupon pinterest)
end
@@ -60,15 +60,9 @@
selections.map{|name| name.downcase}.select{|name| supported_networks.include? name.to_s}.inject({}) {
|r, c| r[c.to_sym] = ShareCounter.send(c, url); r }
end
private
-
- # URL always gets parsed twice
- def self.get_host_without_www(url)
- url = "http://#{url}" if URI.parse(url).scheme.nil?
- host = URI.parse(url).host.downcase
- end
def self.make_request *args
result = nil
attempts = 1
url = args.shift