eostrom-yahoo-se 1.2.0
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/LICENSE +19 -0
- data/README +34 -0
- data/Rakefile +75 -0
- data/lib/yahoo-se/exceptions.rb +19 -0
- data/lib/yahoo-se/inlinks.rb +37 -0
- data/lib/yahoo-se/pages.rb +37 -0
- data/lib/yahoo-se/paginator.rb +40 -0
- data/lib/yahoo-se/ping.rb +29 -0
- data/lib/yahoo-se/request.rb +46 -0
- data/lib/yahoo-se/response.rb +45 -0
- data/lib/yahoo-se/result.rb +24 -0
- data/lib/yahoo-se/update_notification.rb +30 -0
- data/lib/yahoo-se/version.rb +5 -0
- data/lib/yahoo-se.rb +17 -0
- data/spec/fixtures/empty_results.json +1 -0
- data/spec/fixtures/erbmicha.com_backlinks.json +1 -0
- data/spec/fixtures/erbmicha.com_pages.json +1 -0
- data/spec/fixtures/erbmicha.com_ping.json +1 -0
- data/spec/fixtures/exceed_error.json +1 -0
- data/spec/fixtures/one_result.json +1 -0
- data/spec/fixtures/rate_limit_exceeded.json +1 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +18 -0
- data/spec/yahoo-se/inlinks_spec.rb +46 -0
- data/spec/yahoo-se/pages_spec.rb +51 -0
- data/spec/yahoo-se/ping_spec.rb +17 -0
- data/spec/yahoo-se/request_spec.rb +52 -0
- data/spec/yahoo-se/response_spec.rb +46 -0
- data/spec/yahoo-se/result_spec.rb +20 -0
- data/spec/yahoo-se/update_notification_spec.rb +18 -0
- data/spec/yahoo-se-matchers.rb +14 -0
- data/spec/yahoo-se_spec.rb +19 -0
- metadata +87 -0
data/LICENSE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright (c) 2008-2008 Ruby Skills <info@rubyskills.com>
|
|
3
|
+
#
|
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
5
|
+
# this software and associated documentation files (the "Software"), to deal in the
|
|
6
|
+
# Software without restriction, including without limitation the rights to use,
|
|
7
|
+
# copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
8
|
+
# Software, and to permit persons to whom the Software is furnished to do so,
|
|
9
|
+
# subject to the following conditions:
|
|
10
|
+
#
|
|
11
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
# copies or substantial portions of the Software.
|
|
13
|
+
#
|
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
16
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
17
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
18
|
+
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
19
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
= Yahoo Site Explorer Gem
|
|
2
|
+
|
|
3
|
+
Yahoo Site Explorer API integration.
|
|
4
|
+
|
|
5
|
+
== Installation
|
|
6
|
+
|
|
7
|
+
gem install yahoo-se
|
|
8
|
+
|
|
9
|
+
== Usage
|
|
10
|
+
|
|
11
|
+
Yahoo::SE.application_id = "YOUR_YAHOO_APPLICATION_ID"
|
|
12
|
+
|
|
13
|
+
# Inlink Service
|
|
14
|
+
backlinks = Yahoo::SE.inlinks("http://rubyskills.com", :results => 100)
|
|
15
|
+
backlinks.results
|
|
16
|
+
backlinks.next
|
|
17
|
+
backlinks.results
|
|
18
|
+
|
|
19
|
+
# Page Service
|
|
20
|
+
page_data = Yahoo::SE.pages("http://rubyskills.com", :results => 100)
|
|
21
|
+
page_data.results
|
|
22
|
+
page_data.next.results
|
|
23
|
+
|
|
24
|
+
# Ping Service
|
|
25
|
+
ping = Yahoo::SE.ping("http://rubyskills.com")
|
|
26
|
+
ping.response
|
|
27
|
+
|
|
28
|
+
# Update Notification Service
|
|
29
|
+
update_notification = Yahoo::SE.update_notification("http://rubyskills.com")
|
|
30
|
+
update_notification.response
|
|
31
|
+
|
|
32
|
+
See Yahoo::SE for more info
|
|
33
|
+
|
|
34
|
+
see: http://developer.yahoo.com/search/siteexplorer for more details on the Yahoo API.
|
data/Rakefile
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
require 'rake'
|
|
2
|
+
require 'rake/clean'
|
|
3
|
+
require 'rake/gempackagetask'
|
|
4
|
+
require 'rake/rdoctask'
|
|
5
|
+
require 'rake/testtask'
|
|
6
|
+
require 'spec/rake/spectask'
|
|
7
|
+
|
|
8
|
+
require 'lib/yahoo-se/version'
|
|
9
|
+
|
|
10
|
+
NAME = "yahoo-se"
|
|
11
|
+
AUTHOR = "Lance Carlson"
|
|
12
|
+
EMAIL = "info@rubyskills.com"
|
|
13
|
+
HOMEPAGE = "http://www.rubyskills.com"
|
|
14
|
+
SUMMARY = "Yahoo! Site Explorer Gem"
|
|
15
|
+
DESCRIPTION = "Ruby gem for the Yahoo! Site Explorer API"
|
|
16
|
+
|
|
17
|
+
dist_dirs = [ "lib", "spec" ]
|
|
18
|
+
|
|
19
|
+
spec = Gem::Specification.new do |s|
|
|
20
|
+
s.name = NAME
|
|
21
|
+
s.version = Yahoo::SE::VERSION
|
|
22
|
+
s.platform = Gem::Platform::RUBY
|
|
23
|
+
s.summary = SUMMARY
|
|
24
|
+
s.description = DESCRIPTION
|
|
25
|
+
s.author = AUTHOR
|
|
26
|
+
s.email = EMAIL
|
|
27
|
+
s.homepage = HOMEPAGE
|
|
28
|
+
s.has_rdoc = true
|
|
29
|
+
|
|
30
|
+
s.add_dependency('rspec')
|
|
31
|
+
s.add_dependency('rake')
|
|
32
|
+
|
|
33
|
+
s.files = [ "Rakefile", "README" ]
|
|
34
|
+
dist_dirs.each do |dir|
|
|
35
|
+
s.files = s.files + Dir.glob("#{dir}/**/*")
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
Rake::GemPackageTask.new(spec) do |p|
|
|
40
|
+
p.gem_spec = spec
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
Rake::RDocTask.new do |rdoc|
|
|
44
|
+
rdoc.rdoc_dir = 'doc'
|
|
45
|
+
rdoc.title = 'Yahoo! Site Explorer'
|
|
46
|
+
rdoc.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object'
|
|
47
|
+
rdoc.options << '--charset' << 'utf-8'
|
|
48
|
+
rdoc.rdoc_files.include('README')
|
|
49
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
desc 'Run :package and install the resulting .gem'
|
|
53
|
+
task :install => :package do
|
|
54
|
+
sh %{sudo gem install pkg/#{NAME}-#{Yahoo::SE::VERSION} --no-rdoc --no-ri}
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
desc 'Run :clean and uninstall the .gem'
|
|
58
|
+
task :uninstall => [:clean] do
|
|
59
|
+
sh %{sudo gem uninstall #{NAME}}
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
desc "Run all specs"
|
|
63
|
+
Spec::Rake::SpecTask.new('spec') do |t|
|
|
64
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
|
65
|
+
t.spec_opts = ['--options', 'spec/spec.opts']
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
desc "Run all specs and generate an rcov report"
|
|
69
|
+
Spec::Rake::SpecTask.new('spec:rcov') do |t|
|
|
70
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
|
71
|
+
t.spec_opts = ['--options', 'spec/spec.opts']
|
|
72
|
+
t.rcov = true
|
|
73
|
+
t.rcov_dir = 'coverage'
|
|
74
|
+
t.rcov_opts = ['--exclude', 'gems', '--exclude', 'spec']
|
|
75
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module Yahoo
|
|
2
|
+
module SE
|
|
3
|
+
class ApplicationIDNotSet < RuntimeError; end
|
|
4
|
+
class ResponseError < RuntimeError
|
|
5
|
+
def initialize(errors)
|
|
6
|
+
case errors.class
|
|
7
|
+
when Hash
|
|
8
|
+
title = errors["Title"]
|
|
9
|
+
message = errors["Message"]
|
|
10
|
+
puts "#{title} : #{message}"
|
|
11
|
+
when String
|
|
12
|
+
puts errors
|
|
13
|
+
else
|
|
14
|
+
puts errors.to_s
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module Yahoo
|
|
2
|
+
module SE
|
|
3
|
+
# Shows the pages from other sites linking in to a page.
|
|
4
|
+
#
|
|
5
|
+
# backlinks = Yahoo::SE.inlinks("http://rubyskills.com", :results => 100)
|
|
6
|
+
#
|
|
7
|
+
# backlinks.results
|
|
8
|
+
#
|
|
9
|
+
# backlinks.next
|
|
10
|
+
def self.inlinks(domain, options={})
|
|
11
|
+
Yahoo::SE::Inlinks.new(domain, options)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
class Inlinks
|
|
15
|
+
include Yahoo::SE::Paginator
|
|
16
|
+
SERVICE_PATH = "#{Yahoo::SE::SERVICE_PATH}/inlinkData"
|
|
17
|
+
|
|
18
|
+
attr_reader :request
|
|
19
|
+
attr_accessor :options
|
|
20
|
+
|
|
21
|
+
def initialize(domain, options={})
|
|
22
|
+
@domain = domain
|
|
23
|
+
@options = options
|
|
24
|
+
@options[:query] = domain
|
|
25
|
+
@options[:results] = @options[:results] ||= 50
|
|
26
|
+
@options[:start] = @options[:start] ||= 1
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Displays the results for inlinks data
|
|
30
|
+
def results
|
|
31
|
+
raise ApplicationIDNotSet if Yahoo::SE.application_id.nil?
|
|
32
|
+
@request = Yahoo::SE::Request.new(Yahoo::SE::Inlinks::SERVICE_PATH, @options)
|
|
33
|
+
@results = @request.results
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module Yahoo
|
|
2
|
+
module SE
|
|
3
|
+
# Shows a list of all pages belonging to a domain in the Yahoo! index
|
|
4
|
+
#
|
|
5
|
+
# page_data = Yahoo::SE.pages("http://rubyskills.com", :results => 100)
|
|
6
|
+
#
|
|
7
|
+
# page_data.results
|
|
8
|
+
#
|
|
9
|
+
# page_data.next
|
|
10
|
+
def self.pages(domain, options={})
|
|
11
|
+
Yahoo::SE::Pages.new(domain, options)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
class Pages
|
|
15
|
+
include Yahoo::SE::Paginator
|
|
16
|
+
SERVICE_PATH = "#{Yahoo::SE::SERVICE_PATH}/pageData"
|
|
17
|
+
|
|
18
|
+
attr_reader :request
|
|
19
|
+
attr_accessor :options
|
|
20
|
+
|
|
21
|
+
def initialize(domain, options={})
|
|
22
|
+
@domain = domain
|
|
23
|
+
@options = options
|
|
24
|
+
@options[:query] = domain
|
|
25
|
+
@options[:results] = @options[:results] ||= 50
|
|
26
|
+
@options[:start] = @options[:start] ||= 1
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Displays the results for pages data
|
|
30
|
+
def results
|
|
31
|
+
raise ApplicationIDNotSet if Yahoo::SE.application_id.nil?
|
|
32
|
+
@request = Yahoo::SE::Request.new(Yahoo::SE::Pages::SERVICE_PATH, @options)
|
|
33
|
+
@results = @request.results
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
module Yahoo
|
|
2
|
+
module SE
|
|
3
|
+
module Paginator
|
|
4
|
+
include Enumerable
|
|
5
|
+
|
|
6
|
+
# The response object from the request
|
|
7
|
+
def response
|
|
8
|
+
raise "Must send a request before you can get a response. Run the results method first!" if @request.nil?
|
|
9
|
+
@response = @request.response
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Reset the start option to the next results
|
|
13
|
+
def next
|
|
14
|
+
@options[:start] = @options[:start] + @options[:results]
|
|
15
|
+
@options[:results] = total_results_available - @options[:start] if last?
|
|
16
|
+
results
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def total_results_available
|
|
20
|
+
@total_results_available ||= response.total_results_available
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def last?
|
|
24
|
+
(@options[:start] + @options[:results]) >= response.total_results_available
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def each
|
|
28
|
+
return unless block_given?
|
|
29
|
+
begin
|
|
30
|
+
yield @request.nil? ? results : self.next
|
|
31
|
+
end while !last?
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def method_missing(method, *args)
|
|
35
|
+
results
|
|
36
|
+
response.send(method, *args)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module Yahoo
|
|
2
|
+
module SE
|
|
3
|
+
# Allows you to notify Yahoo! of changes to your site. No appid required
|
|
4
|
+
#
|
|
5
|
+
# ping = Yahoo::SE.pages("http://rubyskills.com")
|
|
6
|
+
#
|
|
7
|
+
# ping.response
|
|
8
|
+
#
|
|
9
|
+
# sitemap: The URL of the page to be submitted, or the URL of a feed containing site data.
|
|
10
|
+
def self.ping(sitemap)
|
|
11
|
+
Yahoo::SE::Ping.new(sitemap)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
class Ping
|
|
15
|
+
SERVICE_PATH = "#{Yahoo::SE::SERVICE_PATH}/ping"
|
|
16
|
+
|
|
17
|
+
def initialize(sitemap)
|
|
18
|
+
@sitemap = sitemap
|
|
19
|
+
@options = {}
|
|
20
|
+
@options[:sitemap] = sitemap
|
|
21
|
+
response
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def response
|
|
25
|
+
Yahoo::SE::Request.new(Yahoo::SE::Ping::SERVICE_PATH, @options).response
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
require "open-uri"
|
|
2
|
+
require "json"
|
|
3
|
+
|
|
4
|
+
module Yahoo
|
|
5
|
+
module SE
|
|
6
|
+
class Request
|
|
7
|
+
|
|
8
|
+
# Converts a hash to a query string
|
|
9
|
+
def self.hash_to_query(hash)
|
|
10
|
+
hash.map {|key, value| "#{key}=#{value}"}.join("&")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def initialize(service_path, options)
|
|
14
|
+
@service_path = service_path
|
|
15
|
+
@options = options
|
|
16
|
+
@options[:appid] = Yahoo::SE.application_id
|
|
17
|
+
@options[:output] = "json"
|
|
18
|
+
@query_string = self.class.hash_to_query(@options)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# The API URL call
|
|
22
|
+
def path
|
|
23
|
+
"#{@service_path}?#{@query_string}"
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# The response object of the request
|
|
27
|
+
def response
|
|
28
|
+
@response ||= Yahoo::SE::Response.new(response_body)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# The response body of the request
|
|
32
|
+
def response_body
|
|
33
|
+
begin
|
|
34
|
+
@response_body = open(path,"User-Agent" => "Ruby/Yahoo Site Explorer Gem v#{Yahoo::SE::VERSION}").readlines.join
|
|
35
|
+
rescue OpenURI::HTTPError => @errors
|
|
36
|
+
raise ResponseError, @errors
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# The results from the response object
|
|
41
|
+
def results
|
|
42
|
+
response.results
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
module Yahoo
|
|
2
|
+
module SE
|
|
3
|
+
class Response
|
|
4
|
+
def initialize(response_body)
|
|
5
|
+
@body = response_body
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
# The number of URLs returned. This may be lower than the number of results requested if there were fewer total results available.
|
|
9
|
+
def total_results_returned
|
|
10
|
+
self.to_json["ResultSet"]["totalResultsReturned"].to_i
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# The number of URLs in the database that link to the domain or page.
|
|
14
|
+
def total_results_available
|
|
15
|
+
self.to_json["ResultSet"]["totalResultsAvailable"].to_i
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# The result objects returned from the request
|
|
19
|
+
def results
|
|
20
|
+
unless errors
|
|
21
|
+
if total_results_returned == 1
|
|
22
|
+
[Yahoo::SE::Result.new(self.to_json["ResultSet"]["Result"])]
|
|
23
|
+
elsif total_results_available == 0
|
|
24
|
+
[]
|
|
25
|
+
else
|
|
26
|
+
self.to_json["ResultSet"]["Result"].map do |result_hash|
|
|
27
|
+
Yahoo::SE::Result.new(result_hash)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def errors
|
|
34
|
+
@errors = self.to_json["Error"]
|
|
35
|
+
if @errors
|
|
36
|
+
raise ResponseError, @errors
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def to_json
|
|
41
|
+
@json ||= JSON.parse(@body)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module Yahoo
|
|
2
|
+
module SE
|
|
3
|
+
class Result
|
|
4
|
+
def initialize(hash)
|
|
5
|
+
@hash = hash
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
# The title of the linking web page.
|
|
9
|
+
def title
|
|
10
|
+
@hash["Title"]
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# The URL for the linking web page.
|
|
14
|
+
def url
|
|
15
|
+
@hash["Url"]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# The URL that should be used to link to the inlinking page. See URL linking for more information.
|
|
19
|
+
def click_url
|
|
20
|
+
@hash["ClickUrl"]
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
module Yahoo
|
|
2
|
+
module SE
|
|
3
|
+
# The Update Notification service allows you to notify Yahoo! when your site changes. You may notify us about a single page, or a set of pages that need attention.
|
|
4
|
+
#
|
|
5
|
+
# update_notification = Yahoo::SE.update_notification("http://rubyskills.com")
|
|
6
|
+
#
|
|
7
|
+
# page_data.response
|
|
8
|
+
#
|
|
9
|
+
# url: The URL of the page to be submitted, or the URL of a feed containing site data.
|
|
10
|
+
def self.update_notification(url)
|
|
11
|
+
Yahoo::SE::UpdateNotification.new(url)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
class UpdateNotification
|
|
15
|
+
SERVICE_PATH = "#{Yahoo::SE::SERVICE_PATH}/updateNotification"
|
|
16
|
+
|
|
17
|
+
def initialize(url)
|
|
18
|
+
@url = url
|
|
19
|
+
@options = {}
|
|
20
|
+
@options[:url] = url
|
|
21
|
+
response
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def response
|
|
25
|
+
raise ApplicationIDNotSet if Yahoo::SE.application_id.nil?
|
|
26
|
+
Yahoo::SE::Request.new(Yahoo::SE::UpdateNotification::SERVICE_PATH, @options).response
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
data/lib/yahoo-se.rb
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Yahoo
|
|
2
|
+
API_DOMAIN = "http://search.yahooapis.com"
|
|
3
|
+
|
|
4
|
+
module SE
|
|
5
|
+
VERSION = "V1"
|
|
6
|
+
SERVICE_PATH = "#{API_DOMAIN}/SiteExplorerService/#{VERSION}"
|
|
7
|
+
|
|
8
|
+
class << self
|
|
9
|
+
attr_accessor :application_id
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
%w(exceptions paginator inlinks pages request response result version ping update_notification).each do |file|
|
|
16
|
+
require File.join(File.dirname(__FILE__), "yahoo-se", file)
|
|
17
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"ResultSet":{"totalResultsAvailable":"0","firstResultPosition":"1","totalResultsReturned":"0","content":"\n "}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"ResultSet":{"totalResultsAvailable":"328","firstResultPosition":"1","totalResultsReturned":"100","Result":[{"Title":"Erbmicha","Url":"http:\/\/erbmicha.com\/","ClickUrl":"http:\/\/erbmicha.com\/"},{"Title":"The Knuckleball","Url":"http:\/\/erbmicha.com\/2008\/04\/19\/the-knuckleball\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/04\/19\/the-knuckleball\/"},{"Title":"Devin Hester vs. Grizzly","Url":"http:\/\/erbmicha.com\/2008\/03\/28\/devin-hester-vs-grizzly\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/03\/28\/devin-hester-vs-grizzly\/"},{"Title":"Snowball Fight","Url":"http:\/\/erbmicha.com\/2008\/05\/15\/snowball-fight\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/05\/15\/snowball-fight\/"},{"Title":"Run!","Url":"http:\/\/erbmicha.com\/2008\/07\/03\/run\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/07\/03\/run\/"},{"Title":"Medic!","Url":"http:\/\/erbmicha.com\/2008\/07\/15\/medic\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/07\/15\/medic\/"},{"Title":"Towel?","Url":"http:\/\/erbmicha.com\/2008\/05\/16\/towel\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/05\/16\/towel\/"},{"Title":"FedEx?","Url":"http:\/\/erbmicha.com\/2008\/04\/29\/fedex\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/04\/29\/fedex\/"},{"Title":"Sleepy","Url":"http:\/\/erbmicha.com\/2008\/05\/16\/sleepy\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/05\/16\/sleepy\/"},{"Title":"Cat Rave","Url":"http:\/\/erbmicha.com\/2008\/07\/09\/cat-rave\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/07\/09\/cat-rave\/"},{"Title":"Nice Shot!","Url":"http:\/\/erbmicha.com\/2008\/04\/23\/nice-shot\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/04\/23\/nice-shot\/"},{"Title":"Bath Time!","Url":"http:\/\/erbmicha.com\/2008\/04\/21\/bath-time\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/04\/21\/bath-time\/"},{"Title":"Duct Tape","Url":"http:\/\/erbmicha.com\/2008\/04\/17\/duct-tape\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/04\/17\/duct-tape\/"},{"Title":"Well Said","Url":"http:\/\/erbmicha.com\/2008\/06\/24\/well-said\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/06\/24\/well-said\/"},{"Title":"Film at 11","Url":"http:\/\/erbmicha.com\/2008\/07\/10\/film-at-11\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/07\/10\/film-at-11\/"},{"Title":"Wanna Race?","Url":"http:\/\/erbmicha.com\/2008\/05\/17\/wanna-race\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/05\/17\/wanna-race\/"},{"Title":"Ugliest Dog","Url":"http:\/\/erbmicha.com\/2008\/05\/14\/ugliest-dog\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/05\/14\/ugliest-dog\/"},{"Title":"Ladies Room","Url":"http:\/\/erbmicha.com\/2008\/04\/23\/ladies-room\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/04\/23\/ladies-room\/"},{"Title":"Sales Pitch","Url":"http:\/\/erbmicha.com\/2008\/07\/03\/sales-pitch\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/07\/03\/sales-pitch\/"},{"Title":"K9 Training","Url":"http:\/\/erbmicha.com\/2008\/05\/02\/k9-training\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/05\/02\/k9-training\/"},{"Title":"Snake Teeth","Url":"http:\/\/erbmicha.com\/2008\/04\/18\/snake-teeth\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/04\/18\/snake-teeth\/"},{"Title":"Helping Hand","Url":"http:\/\/erbmicha.com\/2008\/06\/30\/helping-hand\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/06\/30\/helping-hand\/"},{"Title":"Dancing Fool","Url":"http:\/\/erbmicha.com\/2008\/04\/10\/dancing-fool\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/04\/10\/dancing-fool\/"},{"Title":"Happy Birthday!","Url":"http:\/\/erbmicha.com\/2008\/07\/10\/happy-birthday\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/07\/10\/happy-birthday\/"},{"Title":"Hook em When Their Young","Url":"http:\/\/erbmicha.com\/2008\/05\/25\/hook-em-when-their-young\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/05\/25\/hook-em-when-their-young\/"},{"Title":"erbmicha.com","Url":"http:\/\/erbmicha.com\/feed\/","ClickUrl":"http:\/\/erbmicha.com\/feed\/"},{"Title":"About Me | erbmicha.com","Url":"http:\/\/erbmicha.com\/about-me\/","ClickUrl":"http:\/\/erbmicha.com\/about-me\/"},{"Title":"Comic Curse | erbmicha.com","Url":"http:\/\/erbmicha.com\/comic-curse\/","ClickUrl":"http:\/\/erbmicha.com\/comic-curse\/"},{"Title":"Wtf","Url":"http:\/\/erbmicha.com\/tag\/wtf\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/wtf\/"},{"Title":"Cats","Url":"http:\/\/erbmicha.com\/tag\/cats\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/cats\/"},{"Title":"Funny","Url":"http:\/\/erbmicha.com\/tag\/funny\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/funny\/"},{"Title":"Quote","Url":"http:\/\/erbmicha.com\/tag\/quote\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/quote\/"},{"Title":"Drew!!!","Url":"http:\/\/erbmicha.com\/2008\/03\/23\/drew\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/03\/23\/drew\/"},{"Title":"Dog","Url":"http:\/\/erbmicha.com\/tag\/dog\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/dog\/"},{"Title":"Dogs","Url":"http:\/\/erbmicha.com\/tag\/dogs\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/dogs\/"},{"Title":"Work","Url":"http:\/\/erbmicha.com\/tag\/work\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/work\/"},{"Title":"AJAX","Url":"http:\/\/erbmicha.com\/tag\/ajax\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/ajax\/"},{"Title":"Apple","Url":"http:\/\/erbmicha.com\/tag\/apple\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/apple\/"},{"Title":"General","Url":"http:\/\/erbmicha.com\/tag\/general\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/general\/"},{"Title":"Politics","Url":"http:\/\/erbmicha.com\/tag\/politics\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/politics\/"},{"Title":"Journler","Url":"http:\/\/erbmicha.com\/tag\/journler\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/journler\/"},{"Title":"Football","Url":"http:\/\/erbmicha.com\/tag\/football\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/football\/"},{"Title":"Tumblelog","Url":"http:\/\/erbmicha.com\/tag\/tumblelog\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/tumblelog\/"},{"Title":"Wordpress","Url":"http:\/\/erbmicha.com\/tag\/wordpress\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/wordpress\/"},{"Title":"Skateboard","Url":"http:\/\/erbmicha.com\/tag\/skateboard\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/skateboard\/"},{"Title":"George Carlin","Url":"http:\/\/erbmicha.com\/tag\/george-carlin\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/george-carlin\/"},{"Title":"Steve Ballmer is an Idiot","Url":"http:\/\/erbmicha.com\/blog\/2007\/12\/18\/steve-ballmer-is-an-idiot\/","ClickUrl":"http:\/\/erbmicha.com\/blog\/2007\/12\/18\/steve-ballmer-is-an-idiot\/"},{"Title":"Ice Cream","Url":"http:\/\/erbmicha.com\/2008\/08\/08\/ice-cream\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/08\/08\/ice-cream\/"},{"Title":"Foreshadowing","Url":"http:\/\/erbmicha.com\/2008\/10\/16\/foreshadowing\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/10\/16\/foreshadowing\/"},{"Title":"Hug a Developer","Url":"http:\/\/erbmicha.com\/2008\/08\/28\/hug-a-developer\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/08\/28\/hug-a-developer\/"},{"Title":"Progression of Blame","Url":"http:\/\/erbmicha.com\/2008\/09\/24\/progression-of-blame\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/09\/24\/progression-of-blame\/"},{"Title":"I think Apple's !@#$ NDA polic...","Url":"http:\/\/erbmicha.com\/2008\/09\/25\/i-think-apples-nda-polic\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/09\/25\/i-think-apples-nda-polic\/"},{"Title":"this is funny as hell NSFW!!! ...","Url":"http:\/\/erbmicha.com\/2008\/10\/08\/this-is-funny-as-hell-nsfw\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/10\/08\/this-is-funny-as-hell-nsfw\/"},{"Title":"can't wait for @peepcode XMPP ...","Url":"http:\/\/erbmicha.com\/2008\/10\/17\/cant-wait-for-peepcode-xmpp\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/10\/17\/cant-wait-for-peepcode-xmpp\/"},{"Title":"the REAL Windows Vista: http:\/...","Url":"http:\/\/erbmicha.com\/2008\/10\/08\/the-real-windows-vista-http\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/10\/08\/the-real-windows-vista-http\/"},{"Title":"if they say no 17\u2032\u2032 version of ...","Url":"http:\/\/erbmicha.com\/2008\/10\/14\/if-they-say-no-17-version-of\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/10\/14\/if-they-say-no-17-version-of\/"},{"Title":"who do you think would've been...","Url":"http:\/\/erbmicha.com\/2008\/10\/23\/who-do-you-think-wouldve-been\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/10\/23\/who-do-you-think-wouldve-been\/"},{"Title":"IMHO the greatest speech ever:...","Url":"http:\/\/erbmicha.com\/2008\/10\/24\/imho-the-greatest-speech-ever\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/10\/24\/imho-the-greatest-speech-ever\/"},{"Title":"Some People Are WAY Too Smart","Url":"http:\/\/erbmicha.com\/2008\/08\/14\/some-people-are-way-too-smart\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/08\/14\/some-people-are-way-too-smart\/"},{"Title":"we should treat these bailout ...","Url":"http:\/\/erbmicha.com\/2008\/10\/08\/we-should-treat-these-bailout\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/10\/08\/we-should-treat-these-bailout\/"},{"Title":"Wii snowboarding on a balance ...","Url":"http:\/\/erbmicha.com\/2008\/10\/08\/wii-snowboarding-on-a-balance\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/10\/08\/wii-snowboarding-on-a-balance\/"},{"Title":"Farewell Opus. Thanks for hang...","Url":"http:\/\/erbmicha.com\/2008\/10\/09\/farewell-opus-thanks-for-hang\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/10\/09\/farewell-opus-thanks-for-hang\/"},{"Title":"This is perhaps the most distu...","Url":"http:\/\/erbmicha.com\/2008\/09\/27\/this-is-perhaps-the-most-distu\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/09\/27\/this-is-perhaps-the-most-distu\/"},{"Title":"Google InQuotes is a neat idea...","Url":"http:\/\/erbmicha.com\/2008\/09\/25\/google-inquotes-is-a-neat-idea\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/09\/25\/google-inquotes-is-a-neat-idea\/"},{"Title":"cheap macbook pro's on amazon \" - Web Design Marketing Podcast & Blog","Url":"http:\/\/www.3point7designs.com\/blog\/2008\/10\/24\/cheap-macbook-pros-on-amazon\/","ClickUrl":"http:\/\/www.3point7designs.com\/blog\/2008\/10\/24\/cheap-macbook-pros-on-amazon\/"},{"Title":"Fun","Url":"http:\/\/erbmicha.com\/tag\/fun\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/fun\/"},{"Title":"Quality Check?","Url":"http:\/\/erbmicha.com\/2008\/04\/18\/quality-check\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/04\/18\/quality-check\/"},{"Title":"Doggie Paddle?","Url":"http:\/\/erbmicha.com\/2008\/05\/02\/doggie-paddle\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/05\/02\/doggie-paddle\/"},{"Title":"Ironic Isn't It?","Url":"http:\/\/erbmicha.com\/2008\/04\/18\/ironic-isnt-it\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/04\/18\/ironic-isnt-it\/"},{"Title":"General Patton","Url":"http:\/\/erbmicha.com\/2008\/04\/09\/general-patton\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/04\/09\/general-patton\/"},{"Title":"Bear-on-a-Wire","Url":"http:\/\/erbmicha.com\/2008\/04\/29\/bear-on-a-wire\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/04\/29\/bear-on-a-wire\/"},{"Title":"I love New York","Url":"http:\/\/erbmicha.com\/2008\/04\/11\/i-love-new-york\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/04\/11\/i-love-new-york\/"},{"Title":"Paper Prototype","Url":"http:\/\/erbmicha.com\/2008\/07\/03\/paper-prototype\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/07\/03\/paper-prototype\/"},{"Title":"Scottsdale Bars","Url":"http:\/\/erbmicha.com\/2008\/06\/30\/scottsdale-bars\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/06\/30\/scottsdale-bars\/"},{"Title":"Room with a View","Url":"http:\/\/erbmicha.com\/2008\/04\/18\/room-with-a-view\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/04\/18\/room-with-a-view\/"},{"Title":"I Love the World","Url":"http:\/\/erbmicha.com\/2008\/04\/19\/i-love-the-world\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/04\/19\/i-love-the-world\/"},{"Title":"Must Be New York","Url":"http:\/\/erbmicha.com\/2008\/04\/17\/must-be-new-york\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/04\/17\/must-be-new-york\/"},{"Title":"At Least He's Honest","Url":"http:\/\/erbmicha.com\/2008\/05\/24\/at-least-hes-honest\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/05\/24\/at-least-hes-honest\/"},{"Title":"Another Sales Pitch","Url":"http:\/\/erbmicha.com\/2008\/07\/09\/another-sales-pitch\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/07\/09\/another-sales-pitch\/"},{"Title":"RIP Professor Lorenz","Url":"http:\/\/erbmicha.com\/2008\/04\/20\/rip-professor-lorenz\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/04\/20\/rip-professor-lorenz\/"},{"Title":"Papa Speaks the Truth","Url":"http:\/\/erbmicha.com\/2008\/07\/09\/papa-speaks-the-truth\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/07\/09\/papa-speaks-the-truth\/"},{"Title":"Scented Text Messages","Url":"http:\/\/erbmicha.com\/2008\/05\/01\/scented-text-messages\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/05\/01\/scented-text-messages\/"},{"Title":"Where the Hell is Matt?","Url":"http:\/\/erbmicha.com\/2008\/06\/24\/where-the-hell-is-matt\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/06\/24\/where-the-hell-is-matt\/"},{"Title":"Must've Failed Catechism","Url":"http:\/\/erbmicha.com\/2008\/05\/17\/mustve-failed-catechism\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/05\/17\/mustve-failed-catechism\/"},{"Title":"What's More Than a Friend?","Url":"http:\/\/erbmicha.com\/2008\/05\/26\/whats-more-than-a-friend\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/05\/26\/whats-more-than-a-friend\/"},{"Title":"I thought it meant happy'...","Url":"http:\/\/erbmicha.com\/2008\/07\/03\/i-thought-it-meant-happy\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/07\/03\/i-thought-it-meant-happy\/"},{"Title":"Twistori","Url":"http:\/\/erbmicha.com\/2008\/04\/30\/twistori-is-very-very-cool\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/04\/30\/twistori-is-very-very-cool\/"},{"Title":"Weezer doing Radiohead Live","Url":"http:\/\/erbmicha.com\/2008\/06\/24\/weezer-doing-radiohead-live\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/06\/24\/weezer-doing-radiohead-live\/"},{"Title":"Little Girl channels Kansas","Url":"http:\/\/erbmicha.com\/2008\/04\/20\/little-girl-channels-kansas\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/04\/20\/little-girl-channels-kansas\/"},{"Title":"Do you have anything in Red?","Url":"http:\/\/erbmicha.com\/2008\/04\/30\/do-you-have-anything-in-red\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/04\/30\/do-you-have-anything-in-red\/"},{"Title":"Learn that from Nickelodeon?","Url":"http:\/\/erbmicha.com\/2008\/04\/08\/learn-that-from-nickelodeon\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/04\/08\/learn-that-from-nickelodeon\/"},{"Title":"It'll Make Sense When You're Older","Url":"http:\/\/erbmicha.com\/2008\/05\/24\/itll-make-sense-when-youre-older\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/05\/24\/itll-make-sense-when-youre-older\/"},{"Title":"Nazis, a Kitten and a Hand Grenade","Url":"http:\/\/erbmicha.com\/2008\/05\/16\/nazis-a-kitten-and-a-hand-grenade\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/05\/16\/nazis-a-kitten-and-a-hand-grenade\/"},{"Title":"Hungry?","Url":"http:\/\/erbmicha.com\/2008\/07\/15\/hungry\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/07\/15\/hungry\/"},{"Title":"Big Ass Cow","Url":"http:\/\/erbmicha.com\/2008\/05\/15\/big-ass-cow\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/05\/15\/big-ass-cow\/"},{"Title":"Erbmicha - Part 2","Url":"http:\/\/erbmicha.com\/page\/2\/","ClickUrl":"http:\/\/erbmicha.com\/page\/2\/"},{"Title":"Erbmicha - Part 3","Url":"http:\/\/erbmicha.com\/page\/3\/","ClickUrl":"http:\/\/erbmicha.com\/page\/3\/"},{"Title":"Web","Url":"http:\/\/erbmicha.com\/tag\/web\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/web\/"},{"Title":"MSU","Url":"http:\/\/erbmicha.com\/tag\/msu\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/msu\/"},{"Title":"Java","Url":"http:\/\/erbmicha.com\/tag\/java\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/java\/"}]}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"ResultSet":{"totalResultsAvailable":"425","firstResultPosition":"1","totalResultsReturned":"50","Result":[{"Title":"Erbmicha","Url":"http:\/\/erbmicha.com\/","ClickUrl":"http:\/\/erbmicha.com\/"},{"Title":"The Knuckleball","Url":"http:\/\/erbmicha.com\/2008\/04\/19\/the-knuckleball\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/04\/19\/the-knuckleball\/"},{"Title":"Devin Hester vs. Grizzly","Url":"http:\/\/erbmicha.com\/2008\/03\/28\/devin-hester-vs-grizzly\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/03\/28\/devin-hester-vs-grizzly\/"},{"Title":"Revision 7: \/trunk","Url":"http:\/\/svn.erbmicha.com\/comic_curse\/trunk\/","ClickUrl":"http:\/\/svn.erbmicha.com\/comic_curse\/trunk\/"},{"Title":"Snowball Fight","Url":"http:\/\/erbmicha.com\/2008\/05\/15\/snowball-fight\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/05\/15\/snowball-fight\/"},{"Title":"Run!","Url":"http:\/\/erbmicha.com\/2008\/07\/03\/run\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/07\/03\/run\/"},{"Title":"Medic!","Url":"http:\/\/erbmicha.com\/2008\/07\/15\/medic\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/07\/15\/medic\/"},{"Title":"Towel?","Url":"http:\/\/erbmicha.com\/2008\/05\/16\/towel\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/05\/16\/towel\/"},{"Title":"FedEx?","Url":"http:\/\/erbmicha.com\/2008\/04\/29\/fedex\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/04\/29\/fedex\/"},{"Title":"Sleepy","Url":"http:\/\/erbmicha.com\/2008\/05\/16\/sleepy\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/05\/16\/sleepy\/"},{"Title":"Cat Rave","Url":"http:\/\/erbmicha.com\/2008\/07\/09\/cat-rave\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/07\/09\/cat-rave\/"},{"Title":"Nice Shot!","Url":"http:\/\/erbmicha.com\/2008\/04\/23\/nice-shot\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/04\/23\/nice-shot\/"},{"Title":"Bath Time!","Url":"http:\/\/erbmicha.com\/2008\/04\/21\/bath-time\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/04\/21\/bath-time\/"},{"Title":"Duct Tape","Url":"http:\/\/erbmicha.com\/2008\/04\/17\/duct-tape\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/04\/17\/duct-tape\/"},{"Title":"Well Said","Url":"http:\/\/erbmicha.com\/2008\/06\/24\/well-said\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/06\/24\/well-said\/"},{"Title":"Film at 11","Url":"http:\/\/erbmicha.com\/2008\/07\/10\/film-at-11\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/07\/10\/film-at-11\/"},{"Title":"Wanna Race?","Url":"http:\/\/erbmicha.com\/2008\/05\/17\/wanna-race\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/05\/17\/wanna-race\/"},{"Title":"Ugliest Dog","Url":"http:\/\/erbmicha.com\/2008\/05\/14\/ugliest-dog\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/05\/14\/ugliest-dog\/"},{"Title":"Ladies Room","Url":"http:\/\/erbmicha.com\/2008\/04\/23\/ladies-room\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/04\/23\/ladies-room\/"},{"Title":"Sales Pitch","Url":"http:\/\/erbmicha.com\/2008\/07\/03\/sales-pitch\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/07\/03\/sales-pitch\/"},{"Title":"K9 Training","Url":"http:\/\/erbmicha.com\/2008\/05\/02\/k9-training\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/05\/02\/k9-training\/"},{"Title":"Snake Teeth","Url":"http:\/\/erbmicha.com\/2008\/04\/18\/snake-teeth\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/04\/18\/snake-teeth\/"},{"Title":"Helping Hand","Url":"http:\/\/erbmicha.com\/2008\/06\/30\/helping-hand\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/06\/30\/helping-hand\/"},{"Title":"Dancing Fool","Url":"http:\/\/erbmicha.com\/2008\/04\/10\/dancing-fool\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/04\/10\/dancing-fool\/"},{"Title":"Happy Birthday!","Url":"http:\/\/erbmicha.com\/2008\/07\/10\/happy-birthday\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/07\/10\/happy-birthday\/"},{"Title":"Hook em When Their Young","Url":"http:\/\/erbmicha.com\/2008\/05\/25\/hook-em-when-their-young\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/05\/25\/hook-em-when-their-young\/"},{"Title":"erbmicha.com","Url":"http:\/\/erbmicha.com\/feed\/","ClickUrl":"http:\/\/erbmicha.com\/feed\/"},{"Title":"About Me | erbmicha.com","Url":"http:\/\/erbmicha.com\/about-me\/","ClickUrl":"http:\/\/erbmicha.com\/about-me\/"},{"Title":"<b>erbmicha.com<\/b>\/xmlrpc.php","Url":"http:\/\/erbmicha.com\/xmlrpc.php","ClickUrl":"http:\/\/erbmicha.com\/xmlrpc.php"},{"Title":"Comic Curse | erbmicha.com","Url":"http:\/\/erbmicha.com\/comic-curse\/","ClickUrl":"http:\/\/erbmicha.com\/comic-curse\/"},{"Title":"Wtf","Url":"http:\/\/erbmicha.com\/tag\/wtf\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/wtf\/"},{"Title":"Cats","Url":"http:\/\/erbmicha.com\/tag\/cats\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/cats\/"},{"Title":"Funny","Url":"http:\/\/erbmicha.com\/tag\/funny\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/funny\/"},{"Title":"Quote","Url":"http:\/\/erbmicha.com\/tag\/quote\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/quote\/"},{"Title":"<b>erbmicha.com<\/b>\/wp-includes\/wlwmanifest.xml","Url":"http:\/\/erbmicha.com\/wp-includes\/wlwmanifest.xml","ClickUrl":"http:\/\/erbmicha.com\/wp-includes\/wlwmanifest.xml"},{"Title":"Revision 7: \/trunk\/lib","Url":"http:\/\/svn.erbmicha.com\/comic_curse\/trunk\/lib\/","ClickUrl":"http:\/\/svn.erbmicha.com\/comic_curse\/trunk\/lib\/"},{"Title":"svn.<b>erbmicha.com<\/b>\/comic_curse\/trunk\/init.rb","Url":"http:\/\/svn.erbmicha.com\/comic_curse\/trunk\/init.rb","ClickUrl":"http:\/\/svn.erbmicha.com\/comic_curse\/trunk\/init.rb"},{"Title":"Drew!!!","Url":"http:\/\/erbmicha.com\/2008\/03\/23\/drew\/","ClickUrl":"http:\/\/erbmicha.com\/2008\/03\/23\/drew\/"},{"Title":"Dog","Url":"http:\/\/erbmicha.com\/tag\/dog\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/dog\/"},{"Title":"Dogs","Url":"http:\/\/erbmicha.com\/tag\/dogs\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/dogs\/"},{"Title":"Work","Url":"http:\/\/erbmicha.com\/tag\/work\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/work\/"},{"Title":"AJAX","Url":"http:\/\/erbmicha.com\/tag\/ajax\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/ajax\/"},{"Title":"Apple","Url":"http:\/\/erbmicha.com\/tag\/apple\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/apple\/"},{"Title":"General","Url":"http:\/\/erbmicha.com\/tag\/general\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/general\/"},{"Title":"Politics","Url":"http:\/\/erbmicha.com\/tag\/politics\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/politics\/"},{"Title":"Journler","Url":"http:\/\/erbmicha.com\/tag\/journler\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/journler\/"},{"Title":"Football","Url":"http:\/\/erbmicha.com\/tag\/football\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/football\/"},{"Title":"Tumblelog","Url":"http:\/\/erbmicha.com\/tag\/tumblelog\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/tumblelog\/"},{"Title":"Wordpress","Url":"http:\/\/erbmicha.com\/tag\/wordpress\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/wordpress\/"},{"Title":"Skateboard","Url":"http:\/\/erbmicha.com\/tag\/skateboard\/","ClickUrl":"http:\/\/erbmicha.com\/tag\/skateboard\/"}]}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"Success":{"Message":"Update notification has successfully submitted."}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"Error":{"Title":"The following errors were detected:","Message":["invalid value: request exceeds position 1000"]}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"ResultSet":{"totalResultsAvailable":"8","firstResultPosition":"1","totalResultsReturned":"1","Result":{"Title":"Barefoot Coffee Roasters - Barefoot Coffee Roasters","Url":"http:\/\/barefootcoffeeroasters.com\/","ClickUrl":"http:\/\/barefootcoffeeroasters.com\/"}}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"Error":{"Title":"The following errors were detected:","Message":["limit exceeded"]}}
|
data/spec/spec.opts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--color
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Ensure that only the source is getting tested and not the installed gem
|
|
2
|
+
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
|
3
|
+
|
|
4
|
+
RAILS_ENV = "test"
|
|
5
|
+
|
|
6
|
+
require "rubygems"
|
|
7
|
+
require "test/unit"
|
|
8
|
+
require "spec"
|
|
9
|
+
require File.join(File.dirname(__FILE__), "..", "lib", "yahoo-se")
|
|
10
|
+
require File.join(File.dirname(__FILE__), "yahoo-se-matchers")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
Spec::Runner.configure do |config|
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def fixture(path)
|
|
17
|
+
open(File.expand_path(File.join(File.dirname(__FILE__), "fixtures", path))).readlines.join
|
|
18
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "spec_helper")
|
|
2
|
+
|
|
3
|
+
describe Yahoo::SE::Inlinks do
|
|
4
|
+
before do
|
|
5
|
+
@result1 = mock(Yahoo::SE::Result)
|
|
6
|
+
@response = mock(Yahoo::SE::Response, :total_results_available => 120)
|
|
7
|
+
@request = mock(Yahoo::SE::Request, :results => [@result1], :response => @response, :next => [@result1])
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
describe "Class" do
|
|
11
|
+
it "should list all of the results for a given page request" do
|
|
12
|
+
Yahoo::SE.application_id = "123"
|
|
13
|
+
inlinks = Yahoo::SE.inlinks("http://erbmicha.com")
|
|
14
|
+
all_inlinks = inlinks.collect
|
|
15
|
+
all_inlinks.length.should > 0
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it "should have the service path for the inlinks service" do
|
|
20
|
+
Yahoo::SE::Inlinks::SERVICE_PATH.should == "http://search.yahooapis.com/SiteExplorerService/V1/inlinkData"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it "should return 100 inlink results" do
|
|
24
|
+
Yahoo::SE.application_id = "123"
|
|
25
|
+
Yahoo::SE::Request.should_receive(:new).with("http://search.yahooapis.com/SiteExplorerService/V1/inlinkData", {:results=>100, :query=>"http://rubyskills.com", :start => 1}).and_return(@request)
|
|
26
|
+
Yahoo::SE.inlinks("http://rubyskills.com", :results => 100).results
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it "should return the next 75 inlink results" do
|
|
30
|
+
Yahoo::SE.application_id = "123"
|
|
31
|
+
Yahoo::SE::Request.should_receive(:new).with("http://search.yahooapis.com/SiteExplorerService/V1/inlinkData", {:results=>75, :query=>"http://rubyskills.com", :start => 1}).and_return(@request)
|
|
32
|
+
inlinks = Yahoo::SE.inlinks("http://rubyskills.com", :results => 75)
|
|
33
|
+
inlinks.results
|
|
34
|
+
Yahoo::SE::Request.should_receive(:new).with("http://search.yahooapis.com/SiteExplorerService/V1/inlinkData", {:results=>44, :query=>"http://rubyskills.com", :start => 76}).and_return(@request)
|
|
35
|
+
inlinks.next.should == [@result1]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it "should yield many result pages" do
|
|
39
|
+
Yahoo::SE.application_id = "123"
|
|
40
|
+
Yahoo::SE::Request.should_receive(:new).twice.and_return(@request)
|
|
41
|
+
inlinks = Yahoo::SE.inlinks("http://rubyskills.com", :results => 110)
|
|
42
|
+
iterations = 0;
|
|
43
|
+
inlinks.each{iterations+=1}
|
|
44
|
+
iterations.should == 2
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "spec_helper")
|
|
2
|
+
|
|
3
|
+
describe Yahoo::SE::Pages do
|
|
4
|
+
before do
|
|
5
|
+
@result1 = mock(Yahoo::SE::Result)
|
|
6
|
+
@response = mock(Yahoo::SE::Response, :total_results_available => 120)
|
|
7
|
+
@request = mock(Yahoo::SE::Request, :results => [@result1], :response => @response)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
describe "Class" do
|
|
11
|
+
it "should list all of the results for a given page request" do
|
|
12
|
+
pages = Yahoo::SE.pages("http://erbmicha.com")
|
|
13
|
+
all_pages = pages.collect
|
|
14
|
+
all_pages.length.should > 0
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "should list all of the results for a given page request" do
|
|
18
|
+
pages = Yahoo::SE.pages("http://rubyskills.com/contact")
|
|
19
|
+
all_pages = pages.collect
|
|
20
|
+
all_pages.length.should > 0
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "should have the service path for the pages service" do
|
|
25
|
+
Yahoo::SE::Pages::SERVICE_PATH.should == "http://search.yahooapis.com/SiteExplorerService/V1/pageData"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it "should return 50 page results" do
|
|
29
|
+
Yahoo::SE.application_id = "123"
|
|
30
|
+
Yahoo::SE::Request.should_receive(:new).with("http://search.yahooapis.com/SiteExplorerService/V1/pageData", {:query=>"erbmicha.com", :results => 50, :start => 1}).and_return(@request)
|
|
31
|
+
Yahoo::SE.pages("erbmicha.com").results
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it "should return the next 75 inlink results" do
|
|
35
|
+
Yahoo::SE.application_id = "123"
|
|
36
|
+
Yahoo::SE::Request.should_receive(:new).with("http://search.yahooapis.com/SiteExplorerService/V1/pageData", {:results=>75, :query=>"http://rubyskills.com", :start => 1}).and_return(@request)
|
|
37
|
+
pages = Yahoo::SE.pages("http://rubyskills.com", :results => 75)
|
|
38
|
+
pages.results
|
|
39
|
+
pages.last?.should be_false
|
|
40
|
+
Yahoo::SE::Request.should_receive(:new).with("http://search.yahooapis.com/SiteExplorerService/V1/pageData", {:results=>44, :query=>"http://rubyskills.com", :start => 76}).and_return(@request)
|
|
41
|
+
pages.next.should == [@result1]
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it "should return the total results from the response" do
|
|
45
|
+
Yahoo::SE.application_id = "123"
|
|
46
|
+
Yahoo::SE::Request.should_receive(:new).with("http://search.yahooapis.com/SiteExplorerService/V1/pageData", {:results=>100, :start=>1, :query=>"http://rubyskills.com"}).and_return(@request)
|
|
47
|
+
pages = Yahoo::SE.pages("http://rubyskills.com", :results => 100)
|
|
48
|
+
pages.results
|
|
49
|
+
pages.total_results_available.should == 120
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "spec_helper")
|
|
2
|
+
|
|
3
|
+
describe Yahoo::SE::Ping do
|
|
4
|
+
before do
|
|
5
|
+
@response = mock(Yahoo::SE::Response)
|
|
6
|
+
@request = mock(Yahoo::SE::Request, :response => @response)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it "should have the service path for the ping service" do
|
|
10
|
+
Yahoo::SE::Ping::SERVICE_PATH.should == "http://search.yahooapis.com/SiteExplorerService/V1/ping"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it "should return a successful JSON message" do
|
|
14
|
+
Yahoo::SE::Request.should_receive(:new).with("http://search.yahooapis.com/SiteExplorerService/V1/ping", {:sitemap=>"erbmicha.com"}).and_return(@request)
|
|
15
|
+
Yahoo::SE.ping("erbmicha.com")
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "spec_helper")
|
|
2
|
+
|
|
3
|
+
describe Yahoo::SE::Request do
|
|
4
|
+
describe "hash_to_query" do
|
|
5
|
+
it "should convert a hash to a query string" do
|
|
6
|
+
Yahoo::SE::Request.hash_to_query(:appid => "123", :query => "http://erbmicha.com", :results => 100).should be_serialized_as("appid=123&query=http://erbmicha.com&results=100")
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
describe "instances" do
|
|
11
|
+
before do
|
|
12
|
+
Yahoo::SE.application_id = "123"
|
|
13
|
+
Yahoo::SE::Request.stub!(:hash_to_query).and_return("appid=123&query=http://erbmicha.com&output=json")
|
|
14
|
+
@result = mock(Yahoo::SE::Result)
|
|
15
|
+
@il_request = Yahoo::SE::Request.new(Yahoo::SE::Inlinks::SERVICE_PATH, :query => "http://erbmicha.com")
|
|
16
|
+
@pages_request = Yahoo::SE::Request.new(Yahoo::SE::Pages::SERVICE_PATH, :query => "http://erbmicha.com")
|
|
17
|
+
@ping_request = Yahoo::SE::Request.new(Yahoo::SE::Ping::SERVICE_PATH, :sitemap => "http://erbmicha.com")
|
|
18
|
+
@update_notification_request = Yahoo::SE::Request.new(Yahoo::SE::UpdateNotification::SERVICE_PATH, :url => "http://erbmicha.com")
|
|
19
|
+
@json_bl_file = mock(File)
|
|
20
|
+
@json_bl_file.stub!(:readlines).and_return(@json_bl_file)
|
|
21
|
+
@json_bl_file.stub!(:join).and_return(fixture("erbmicha.com_backlinks.json"))
|
|
22
|
+
@json_pages_file = mock(File)
|
|
23
|
+
@json_pages_file.stub!(:readlines).and_return(@json_pages_file)
|
|
24
|
+
@json_pages_file.stub!(:join).and_return(fixture("erbmicha.com_pages.json"))
|
|
25
|
+
@json_ping_file = mock(File)
|
|
26
|
+
@json_ping_file.stub!(:readlines).and_return(@json_ping_file)
|
|
27
|
+
@json_ping_file.stub!(:join).and_return(fixture("erbmicha.com_ping.json"))
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it "should form a valid request to inlink data" do
|
|
31
|
+
Yahoo::SE::Result.should_receive(:new).exactly(100).times.and_return(@result)
|
|
32
|
+
@il_request.should_receive("open").with("http://search.yahooapis.com/SiteExplorerService/V1/inlinkData?appid=123&query=http://erbmicha.com&output=json", {"User-Agent"=>"Ruby/Yahoo Site Explorer Gem vV1"}).and_return(@json_bl_file)
|
|
33
|
+
@il_request.results.size.should == 100
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it "should form a valid request to page data" do
|
|
37
|
+
Yahoo::SE::Result.should_receive(:new).exactly(50).times.and_return(@result)
|
|
38
|
+
@pages_request.should_receive("open").with("http://search.yahooapis.com/SiteExplorerService/V1/pageData?appid=123&query=http://erbmicha.com&output=json", {"User-Agent"=>"Ruby/Yahoo Site Explorer Gem vV1"}).and_return(@json_pages_file)
|
|
39
|
+
@pages_request.results.size.should == 50
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it "should form a valid request to ping a site" do
|
|
43
|
+
@ping_request.should_receive("open").with("http://search.yahooapis.com/SiteExplorerService/V1/ping?appid=123&query=http://erbmicha.com&output=json", {"User-Agent"=>"Ruby/Yahoo Site Explorer Gem vV1"}).and_return(@json_ping_file)
|
|
44
|
+
@ping_request.response
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
it "should form a valid request to the update notification service" do
|
|
48
|
+
@update_notification_request.should_receive("open").with("http://search.yahooapis.com/SiteExplorerService/V1/updateNotification?appid=123&query=http://erbmicha.com&output=json", {"User-Agent"=>"Ruby/Yahoo Site Explorer Gem vV1"}).and_return(@json_ping_file)
|
|
49
|
+
@update_notification_request.response
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "spec_helper")
|
|
2
|
+
|
|
3
|
+
describe Yahoo::SE::Response do
|
|
4
|
+
before do
|
|
5
|
+
@response = Yahoo::SE::Response.new(fixture("erbmicha.com_backlinks.json"))
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
it "should list 100 result objects" do
|
|
9
|
+
@response.results.size.should equal(100)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
it "should show the total results return from the request" do
|
|
13
|
+
@response.total_results_returned.should == 100
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it "should show the total results found from Yahoo!" do
|
|
17
|
+
@response.total_results_available.should == 328
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
describe "with no results" do
|
|
21
|
+
before do
|
|
22
|
+
@response = Yahoo::SE::Response.new(fixture("empty_results.json"))
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it "should list 0 result objects" do
|
|
26
|
+
@response.results.size.should == 0
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
describe "with one result" do
|
|
31
|
+
before do
|
|
32
|
+
@response = Yahoo::SE::Response.new(fixture("one_result.json"))
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it "should list 1 result object" do
|
|
36
|
+
@response.results.size.should == 1
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
describe "Errors" do
|
|
41
|
+
it "should raise an exception if the response is a exceed error" do
|
|
42
|
+
@response = Yahoo::SE::Response.new(fixture("exceed_error.json"))
|
|
43
|
+
lambda { @response.results }.should raise_error(Yahoo::SE::ResponseError)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "spec_helper")
|
|
2
|
+
|
|
3
|
+
describe Yahoo::SE::Result do
|
|
4
|
+
before do
|
|
5
|
+
@result = Yahoo::SE::Result.new({"Title" => "The Knuckleball", "Url" => "http://erbmicha.com/2008/04/19/the-knuckleball/","ClickUrl"=>"http://erbmicha.com/2008/04/19/the-knuckleball/"})
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
it "should have a title" do
|
|
9
|
+
@result.title.should == "The Knuckleball"
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
it "should have a url" do
|
|
13
|
+
@result.url.should == "http://erbmicha.com/2008/04/19/the-knuckleball/"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it "should have a click url" do
|
|
17
|
+
@result.click_url.should == "http://erbmicha.com/2008/04/19/the-knuckleball/"
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "spec_helper")
|
|
2
|
+
|
|
3
|
+
describe Yahoo::SE::UpdateNotification do
|
|
4
|
+
before do
|
|
5
|
+
@response = mock(Yahoo::SE::Response)
|
|
6
|
+
@request = mock(Yahoo::SE::Request, :response => @response)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it "should have the service path for the updateNotification service" do
|
|
10
|
+
Yahoo::SE::UpdateNotification::SERVICE_PATH.should == "http://search.yahooapis.com/SiteExplorerService/V1/updateNotification"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it "should return a successful JSON message" do
|
|
14
|
+
Yahoo::SE.application_id = "123"
|
|
15
|
+
Yahoo::SE::Request.should_receive(:new).with("http://search.yahooapis.com/SiteExplorerService/V1/updateNotification", {:url=>"erbmicha.com"}).and_return(@request)
|
|
16
|
+
Yahoo::SE.update_notification("erbmicha.com")
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Spec::Matchers.define :be_serialized_as do |string|
|
|
2
|
+
match do |query|
|
|
3
|
+
str2hash(query) == str2hash(string)
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
def str2hash(str)
|
|
7
|
+
hash = {}
|
|
8
|
+
str.split('&').each do |param|
|
|
9
|
+
key,value = param.split('=')
|
|
10
|
+
hash[key] = value
|
|
11
|
+
end
|
|
12
|
+
return hash
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__), "spec_helper")
|
|
2
|
+
|
|
3
|
+
describe Yahoo::SE do
|
|
4
|
+
it "should have an application id accessor" do
|
|
5
|
+
Yahoo::SE.application_id = "something"
|
|
6
|
+
Yahoo::SE.application_id.should == "something"
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it "should have a path to the service api" do
|
|
10
|
+
Yahoo::SE::SERVICE_PATH.should == "http://search.yahooapis.com/SiteExplorerService/V1"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# it "should return the results after a ResponseError was raised" do
|
|
14
|
+
# Yahoo::SE.application_id = "123"
|
|
15
|
+
# @url = "http://vielmetti.typepad.com/vacuum"
|
|
16
|
+
# @results = Yahoo::SE.all(::Yahoo::SE.pages(@url, :results => 100))
|
|
17
|
+
# @results.size.should > 0
|
|
18
|
+
# end
|
|
19
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: eostrom-yahoo-se
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.2.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Lance Carlson
|
|
8
|
+
- Michael Erb
|
|
9
|
+
- Alex Pooley
|
|
10
|
+
- Erik Ostrom
|
|
11
|
+
autorequire:
|
|
12
|
+
bindir: bin
|
|
13
|
+
cert_chain: []
|
|
14
|
+
|
|
15
|
+
date: 2009-06-09 00:00:00 -07:00
|
|
16
|
+
default_executable:
|
|
17
|
+
dependencies: []
|
|
18
|
+
|
|
19
|
+
description:
|
|
20
|
+
email: info@rubyskills.com
|
|
21
|
+
executables: []
|
|
22
|
+
|
|
23
|
+
extensions: []
|
|
24
|
+
|
|
25
|
+
extra_rdoc_files: []
|
|
26
|
+
|
|
27
|
+
files:
|
|
28
|
+
- LICENSE
|
|
29
|
+
- Rakefile
|
|
30
|
+
- README
|
|
31
|
+
- lib/yahoo-se.rb
|
|
32
|
+
- lib/yahoo-se/exceptions.rb
|
|
33
|
+
- lib/yahoo-se/inlinks.rb
|
|
34
|
+
- lib/yahoo-se/paginator.rb
|
|
35
|
+
- lib/yahoo-se/pages.rb
|
|
36
|
+
- lib/yahoo-se/ping.rb
|
|
37
|
+
- lib/yahoo-se/request.rb
|
|
38
|
+
- lib/yahoo-se/response.rb
|
|
39
|
+
- lib/yahoo-se/result.rb
|
|
40
|
+
- lib/yahoo-se/update_notification.rb
|
|
41
|
+
- lib/yahoo-se/version.rb
|
|
42
|
+
- spec/fixtures/empty_results.json
|
|
43
|
+
- spec/fixtures/erbmicha.com_backlinks.json
|
|
44
|
+
- spec/fixtures/erbmicha.com_pages.json
|
|
45
|
+
- spec/fixtures/erbmicha.com_ping.json
|
|
46
|
+
- spec/fixtures/exceed_error.json
|
|
47
|
+
- spec/fixtures/one_result.json
|
|
48
|
+
- spec/fixtures/rate_limit_exceeded.json
|
|
49
|
+
- spec/spec.opts
|
|
50
|
+
- spec/spec_helper.rb
|
|
51
|
+
- spec/yahoo-se/inlinks_spec.rb
|
|
52
|
+
- spec/yahoo-se/pages_spec.rb
|
|
53
|
+
- spec/yahoo-se/ping_spec.rb
|
|
54
|
+
- spec/yahoo-se/request_spec.rb
|
|
55
|
+
- spec/yahoo-se/response_spec.rb
|
|
56
|
+
- spec/yahoo-se/result_spec.rb
|
|
57
|
+
- spec/yahoo-se/update_notification_spec.rb
|
|
58
|
+
- spec/yahoo-se-matchers.rb
|
|
59
|
+
- spec/yahoo-se_spec.rb
|
|
60
|
+
has_rdoc: true
|
|
61
|
+
homepage: http://www.rubyskills.com
|
|
62
|
+
post_install_message:
|
|
63
|
+
rdoc_options: []
|
|
64
|
+
|
|
65
|
+
require_paths:
|
|
66
|
+
- lib
|
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
68
|
+
requirements:
|
|
69
|
+
- - ">="
|
|
70
|
+
- !ruby/object:Gem::Version
|
|
71
|
+
version: "0"
|
|
72
|
+
version:
|
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
|
+
requirements:
|
|
75
|
+
- - ">="
|
|
76
|
+
- !ruby/object:Gem::Version
|
|
77
|
+
version: "0"
|
|
78
|
+
version:
|
|
79
|
+
requirements: []
|
|
80
|
+
|
|
81
|
+
rubyforge_project:
|
|
82
|
+
rubygems_version: 1.2.0
|
|
83
|
+
signing_key:
|
|
84
|
+
specification_version: 2
|
|
85
|
+
summary: Ruby gem for Yahoo! Site Explorer
|
|
86
|
+
test_files: []
|
|
87
|
+
|