linkscape 0.2.6
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.
- data/.gitignore +21 -0
- data/LICENSE +20 -0
- data/README.rdoc +228 -0
- data/Rakefile +53 -0
- data/VERSION +1 -0
- data/lib/hash-ext.rb +24 -0
- data/lib/linkscape.rb +17 -0
- data/lib/linkscape/client.rb +210 -0
- data/lib/linkscape/constants.rb +418 -0
- data/lib/linkscape/constants/anchor-metrics.rb +75 -0
- data/lib/linkscape/constants/link-metrics.rb +100 -0
- data/lib/linkscape/constants/url-metrics.rb +183 -0
- data/lib/linkscape/errors.rb +4 -0
- data/lib/linkscape/request.rb +80 -0
- data/lib/linkscape/response.rb +138 -0
- data/lib/linkscape/signer.rb +13 -0
- data/lib/string-ext.rb +7 -0
- data/linkscape.gemspec +60 -0
- data/rails/init.rb +1 -0
- data/test.rb +43 -0
- metadata +94 -0
@@ -0,0 +1,13 @@
|
|
1
|
+
module Linkscape
|
2
|
+
class Signer
|
3
|
+
|
4
|
+
def self.signParams params, keysToSign=[:accessID, :expiration], key = nil
|
5
|
+
params[:expiration] ||= Time.now.to_i + 60
|
6
|
+
stringToSign = keysToSign.collect{|k| params[k].to_s}.join("\n")
|
7
|
+
key ||= params[:secretKey]
|
8
|
+
signature = CGI::escape( Base64.encode64( HMAC::SHA1.digest( key, stringToSign ) ).chomp )
|
9
|
+
params[:signature] = signature
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
data/lib/string-ext.rb
ADDED
data/linkscape.gemspec
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{linkscape}
|
8
|
+
s.version = "0.2.6"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Marty Smyth", "Jeff Pollard"]
|
12
|
+
s.date = %q{2010-05-05}
|
13
|
+
s.description = %q{Provides an interface to SEOmoz's suite of APIs, including the free and site intelligence APIs.}
|
14
|
+
s.email = %q{api@seomoz.org}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".gitignore",
|
21
|
+
"LICENSE",
|
22
|
+
"README.rdoc",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"lib/hash-ext.rb",
|
26
|
+
"lib/linkscape.rb",
|
27
|
+
"lib/linkscape/client.rb",
|
28
|
+
"lib/linkscape/constants.rb",
|
29
|
+
"lib/linkscape/constants/anchor-metrics.rb",
|
30
|
+
"lib/linkscape/constants/link-metrics.rb",
|
31
|
+
"lib/linkscape/constants/url-metrics.rb",
|
32
|
+
"lib/linkscape/errors.rb",
|
33
|
+
"lib/linkscape/request.rb",
|
34
|
+
"lib/linkscape/response.rb",
|
35
|
+
"lib/linkscape/signer.rb",
|
36
|
+
"lib/string-ext.rb",
|
37
|
+
"linkscape.gemspec",
|
38
|
+
"rails/init.rb",
|
39
|
+
"test.rb"
|
40
|
+
]
|
41
|
+
s.homepage = %q{http://www.seomoz.org/api}
|
42
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
43
|
+
s.require_paths = ["lib"]
|
44
|
+
s.rubygems_version = %q{1.3.6}
|
45
|
+
s.summary = %q{Provides an interface to the SEOmoz API}
|
46
|
+
|
47
|
+
if s.respond_to? :specification_version then
|
48
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
49
|
+
s.specification_version = 3
|
50
|
+
|
51
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
52
|
+
s.add_runtime_dependency(%q<ruby-hmac>, [">= 0"])
|
53
|
+
else
|
54
|
+
s.add_dependency(%q<ruby-hmac>, [">= 0"])
|
55
|
+
end
|
56
|
+
else
|
57
|
+
s.add_dependency(%q<ruby-hmac>, [">= 0"])
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
data/rails/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'linkscape'
|
data/test.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'lib/linkscape'
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
if File.exists? 'seomoz.yml'
|
5
|
+
config = YAML.load_file('seomoz.yml')
|
6
|
+
elsif File.exists? ENV['HOME']+'/.seomoz.yml'
|
7
|
+
config = YAML.load_file(ENV['HOME']+'/.seomoz.yml')
|
8
|
+
else
|
9
|
+
print "Need a config file to read settings from"
|
10
|
+
exit
|
11
|
+
end
|
12
|
+
|
13
|
+
c = Linkscape::Client.new(:id => config["accessID"], :secret => config['secretKey'])
|
14
|
+
|
15
|
+
def do_request r
|
16
|
+
puts r.inspect
|
17
|
+
puts ''
|
18
|
+
puts r.response.body
|
19
|
+
puts ''
|
20
|
+
if(r.valid?)
|
21
|
+
data = r.data
|
22
|
+
puts data.inspect
|
23
|
+
puts data.to_s("")
|
24
|
+
else
|
25
|
+
puts "Response invalid"
|
26
|
+
end
|
27
|
+
puts "\n\n"
|
28
|
+
end
|
29
|
+
|
30
|
+
url = %q[http://www.seomoz.org/blog/21-tactics-to-increase-blog-traffic]
|
31
|
+
url_array = ["http://www.seomoz.org/blog/21-tactics-to-increase-blog-traffic", "http://www.seomoz.org/tools"]
|
32
|
+
|
33
|
+
do_request c.mozRank(url)
|
34
|
+
|
35
|
+
# do_request c.urlMetrics(url_array, :cols => :all)
|
36
|
+
|
37
|
+
do_request c.topLinks(url, :page, :urlcols => :all, :linkcols => :all, :limit => 3)
|
38
|
+
#
|
39
|
+
do_request c.allLinks(url, :page, :domain, :domains_linking_page, :urlcols => [:title, :url, :page_authority, :domain_authority], :linkcols => :all, :filters => :external, :limit => 3)
|
40
|
+
#
|
41
|
+
do_request c.topPages(url, :page, :cols => :all, :limit => 3, :limit => 3)
|
42
|
+
#
|
43
|
+
do_request c.anchorMetrics(url, :phrase, :page, :cols => :all, :scope => "page_to_domain", :filters => :external, :sort => :domains_linking_page, :limit => 3)
|
metadata
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: linkscape
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 2
|
8
|
+
- 6
|
9
|
+
version: 0.2.6
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Marty Smyth
|
13
|
+
- Jeff Pollard
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-05-05 00:00:00 -07:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: ruby-hmac
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
31
|
+
type: :runtime
|
32
|
+
version_requirements: *id001
|
33
|
+
description: Provides an interface to SEOmoz's suite of APIs, including the free and site intelligence APIs.
|
34
|
+
email: api@seomoz.org
|
35
|
+
executables: []
|
36
|
+
|
37
|
+
extensions: []
|
38
|
+
|
39
|
+
extra_rdoc_files:
|
40
|
+
- LICENSE
|
41
|
+
- README.rdoc
|
42
|
+
files:
|
43
|
+
- .gitignore
|
44
|
+
- LICENSE
|
45
|
+
- README.rdoc
|
46
|
+
- Rakefile
|
47
|
+
- VERSION
|
48
|
+
- lib/hash-ext.rb
|
49
|
+
- lib/linkscape.rb
|
50
|
+
- lib/linkscape/client.rb
|
51
|
+
- lib/linkscape/constants.rb
|
52
|
+
- lib/linkscape/constants/anchor-metrics.rb
|
53
|
+
- lib/linkscape/constants/link-metrics.rb
|
54
|
+
- lib/linkscape/constants/url-metrics.rb
|
55
|
+
- lib/linkscape/errors.rb
|
56
|
+
- lib/linkscape/request.rb
|
57
|
+
- lib/linkscape/response.rb
|
58
|
+
- lib/linkscape/signer.rb
|
59
|
+
- lib/string-ext.rb
|
60
|
+
- linkscape.gemspec
|
61
|
+
- rails/init.rb
|
62
|
+
- test.rb
|
63
|
+
has_rdoc: true
|
64
|
+
homepage: http://www.seomoz.org/api
|
65
|
+
licenses: []
|
66
|
+
|
67
|
+
post_install_message:
|
68
|
+
rdoc_options:
|
69
|
+
- --charset=UTF-8
|
70
|
+
require_paths:
|
71
|
+
- lib
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
segments:
|
77
|
+
- 0
|
78
|
+
version: "0"
|
79
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
segments:
|
84
|
+
- 0
|
85
|
+
version: "0"
|
86
|
+
requirements: []
|
87
|
+
|
88
|
+
rubyforge_project:
|
89
|
+
rubygems_version: 1.3.6
|
90
|
+
signing_key:
|
91
|
+
specification_version: 3
|
92
|
+
summary: Provides an interface to the SEOmoz API
|
93
|
+
test_files: []
|
94
|
+
|