Skip to content

Commit

Permalink
Tentative support for "status" call
Browse files Browse the repository at this point in the history
  • Loading branch information
hbryce1 committed Aug 31, 2010
1 parent 60f4d15 commit ecccf5d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 16 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.6
0.2.7
6 changes: 6 additions & 0 deletions lib/linkscape/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ def topPages(*args)
Linkscape::Request.run(@options.merge(options))
end

def status(*args)
options = Hash === args.last ? args.pop.symbolize_keys : {}
options[:api] = 'status'
Linkscape::Request.run(@options.merge(options))
end


def anchorMetrics(*args)
options = Hash === args.last ? args.pop.symbolize_keys : {}
Expand Down
23 changes: 13 additions & 10 deletions lib/linkscape/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,20 @@ def self.run(options)
end

def initialize(options)

case options[:url]
when String
new_vals = {:url => CGI::escape(options[:url].sub(/^https?:\/\//, '')) }
when Array
@body = options[:url].collect{ |u| u.sub(/^https?:\/\//, '') }
new_vals = {:url => ""}
else
raise "URL most be a String or an Array"

new_vals = {}
if options[:url]
case options[:url]
when String
new_vals = {:url => CGI::escape(options[:url].sub(/^https?:\/\//, '')) }
when Array
@body = options[:url].collect{ |u| u.sub(/^https?:\/\//, '') }
new_vals = {:url => ""}
else
raise "URL most be a String or an Array"
end
end

@requestURL = URL_TEMPLATE.template(signRequest(options.merge(new_vals)))
@requestURL += "&" + options[:query].collect{|k,v| "#{CGI::escape(k.to_s)}=#{CGI::escape(v.to_s)}"}.join('&') if options[:query] && Hash === options[:query]
@requestURL += "&" + options[:query] if options[:query] && String === options[:query]
Expand Down
10 changes: 5 additions & 5 deletions linkscape.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

Gem::Specification.new do |s|
s.name = %q{linkscape}
s.version = "0.2.6"
s.version = "0.2.7"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Marty Smyth", "Jeff Pollard"]
s.date = %q{2010-05-05}
s.date = %q{2010-08-31}
s.description = %q{Provides an interface to SEOmoz's suite of APIs, including the free and site intelligence APIs.}
s.email = %q{[email protected]}
s.extra_rdoc_files = [
Expand Down Expand Up @@ -38,17 +38,17 @@ Gem::Specification.new do |s|
"rails/init.rb",
"test.rb"
]
s.homepage = %q{http://www.seomoz.org/api}
s.homepage = %q{http://github.com/seomoz/linkscape-gem}
s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.6}
s.rubygems_version = %q{1.3.7}
s.summary = %q{Provides an interface to the SEOmoz API}

if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3

if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<ruby-hmac>, [">= 0"])
else
s.add_dependency(%q<ruby-hmac>, [">= 0"])
Expand Down

0 comments on commit ecccf5d

Please sign in to comment.