yahoo-se 1.0.4

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/README ADDED
@@ -0,0 +1,36 @@
1
+ = Yahoo Site Explorer Gem
2
+
3
+ Yahoo Site Explorer API integration.
4
+
5
+ == Installation
6
+
7
+ gem sources -a http://gems.github.com
8
+
9
+ gem install yahoo-se
10
+
11
+ == Usage
12
+
13
+ Yahoo::SE.application_id = "YOUR_YAHOO_APPLICATION_ID"
14
+
15
+ # Inlink Service
16
+ backlinks = Yahoo::SE.inlinks("http://rubyskills.com", :results => 100)
17
+ backlinks.results
18
+ backlinks.next
19
+ backlinks.results
20
+
21
+ # Page Service
22
+ page_data = Yahoo::SE.pages("http://rubyskills.com", :results => 100)
23
+ page_data.results
24
+ page_data.next.results
25
+
26
+ # Ping Service
27
+ ping = Yahoo::SE.ping("http://rubyskills.com")
28
+ ping.response
29
+
30
+ # Update Notification Service
31
+ update_notification = Yahoo::SE.update_notification("http://rubyskills.com")
32
+ update_notification.response
33
+
34
+ See Yahoo::SE for more info
35
+
36
+ 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
data/lib/yahoo-se.rb ADDED
@@ -0,0 +1,31 @@
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
+
11
+ def all(obj)
12
+ obj.options[:start] = 1
13
+ obj.options[:results] = 100
14
+
15
+ # First page of results
16
+ results = obj.results
17
+
18
+ # The rest of the page results
19
+ (obj.total_results_available/100).ceil.times do |i|
20
+ results += obj.next
21
+ end
22
+ results
23
+ end
24
+ end
25
+ end
26
+ end
27
+
28
+
29
+ %w(exceptions paginator inlinks pages request response result version ping update_notification).each do |file|
30
+ require File.join(File.dirname(__FILE__), "yahoo-se", file)
31
+ end
@@ -0,0 +1,5 @@
1
+ module Yahoo
2
+ module SE
3
+ class ApplicationIDNotSet < RuntimeError; end
4
+ end
5
+ 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,31 @@
1
+ module Yahoo
2
+ module SE
3
+ module Paginator
4
+ # The response object from the request
5
+ def response
6
+ raise "Must send a request before you can get a response. Run the results method first!" if @request.nil?
7
+ @response = @request.response
8
+ end
9
+
10
+ # Reset the start option to the next results
11
+ def next
12
+ @options[:start] = @options[:start] + @options[:results]
13
+ @options[:results] = total_results_available - @options[:start] if last?
14
+ results
15
+ end
16
+
17
+ def total_results_available
18
+ @total_results_available = @total_results_available ||= response.total_results_available
19
+ end
20
+
21
+ def last?
22
+ (@options[:start] + @options[:results]) >= response.total_results_available
23
+ end
24
+
25
+ def method_missing(method, *args)
26
+ results
27
+ response.send(method, *args)
28
+ end
29
+ end
30
+ end
31
+ 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,42 @@
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 = @response ||= Yahoo::SE::Response.new(response_body)
29
+ end
30
+
31
+ # The response body of the request
32
+ def response_body
33
+ open(path).readlines.join
34
+ end
35
+
36
+ # The results from the response object
37
+ def results
38
+ response.results
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,34 @@
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
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
+ begin
21
+ self.to_json["ResultSet"]["Result"].map do |result_hash|
22
+ Yahoo::SE::Result.new(result_hash)
23
+ end
24
+ rescue
25
+ []
26
+ end
27
+ end
28
+
29
+ def to_json
30
+ @json = @json ||= JSON.parse(@body)
31
+ end
32
+ end
33
+ end
34
+ 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
@@ -0,0 +1,5 @@
1
+ module Yahoo
2
+ module SE
3
+ VERSION = "1.0.4" unless defined?(Yahoo::SE::VERSION)
4
+ end
5
+ end
@@ -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 &amp; 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."}}
data/spec/spec.opts ADDED
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,17 @@
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
+
11
+
12
+ Spec::Runner.configure do |config|
13
+ end
14
+
15
+ def fixture(path)
16
+ open(File.expand_path(File.join(File.dirname(__FILE__), "fixtures", path))).readlines.join
17
+ end
@@ -0,0 +1,37 @@
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)
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
+ results = Yahoo::SE.all(inlinks)
15
+ results.length.should == 232
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
+ end
@@ -0,0 +1,45 @@
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
+ results = Yahoo::SE.all(pages)
14
+ results.length.should == 303
15
+ end
16
+ end
17
+
18
+ it "should have the service path for the pages service" do
19
+ Yahoo::SE::Pages::SERVICE_PATH.should == "http://search.yahooapis.com/SiteExplorerService/V1/pageData"
20
+ end
21
+
22
+ it "should return 50 page results" do
23
+ Yahoo::SE.application_id = "123"
24
+ Yahoo::SE::Request.should_receive(:new).with("http://search.yahooapis.com/SiteExplorerService/V1/pageData", {:query=>"erbmicha.com", :results => 50, :start => 1}).and_return(@request)
25
+ Yahoo::SE.pages("erbmicha.com").results
26
+ end
27
+
28
+ it "should return the next 75 inlink results" do
29
+ Yahoo::SE.application_id = "123"
30
+ 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)
31
+ pages = Yahoo::SE.pages("http://rubyskills.com", :results => 75)
32
+ pages.results
33
+ pages.last?.should be_false
34
+ 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)
35
+ pages.next.should == [@result1]
36
+ end
37
+
38
+ it "should return the total results from the response" do
39
+ Yahoo::SE.application_id = "123"
40
+ 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)
41
+ pages = Yahoo::SE.pages("http://rubyskills.com", :results => 100)
42
+ pages.results
43
+ pages.total_results_available.should == 120
44
+ end
45
+ 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,51 @@
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 == "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
+ @result = mock(Yahoo::SE::Result)
14
+ @il_request = Yahoo::SE::Request.new(Yahoo::SE::Inlinks::SERVICE_PATH, :query => "http://erbmicha.com")
15
+ @pages_request = Yahoo::SE::Request.new(Yahoo::SE::Pages::SERVICE_PATH, :query => "http://erbmicha.com")
16
+ @ping_request = Yahoo::SE::Request.new(Yahoo::SE::Ping::SERVICE_PATH, :sitemap => "http://erbmicha.com")
17
+ @update_notification_request = Yahoo::SE::Request.new(Yahoo::SE::UpdateNotification::SERVICE_PATH, :url => "http://erbmicha.com")
18
+ @json_bl_file = mock(File)
19
+ @json_bl_file.stub!(:readlines).and_return(@json_bl_file)
20
+ @json_bl_file.stub!(:join).and_return(fixture("erbmicha.com_backlinks.json"))
21
+ @json_pages_file = mock(File)
22
+ @json_pages_file.stub!(:readlines).and_return(@json_pages_file)
23
+ @json_pages_file.stub!(:join).and_return(fixture("erbmicha.com_pages.json"))
24
+ @json_ping_file = mock(File)
25
+ @json_ping_file.stub!(:readlines).and_return(@json_ping_file)
26
+ @json_ping_file.stub!(:join).and_return(fixture("erbmicha.com_ping.json"))
27
+ end
28
+
29
+ it "should form a valid request to inlink data" do
30
+ Yahoo::SE::Result.should_receive(:new).exactly(100).times.and_return(@result)
31
+ @il_request.should_receive("open").with("http://search.yahooapis.com/SiteExplorerService/V1/inlinkData?appid=123&query=http://erbmicha.com&output=json").and_return(@json_bl_file)
32
+ @il_request.results.size.should == 100
33
+ end
34
+
35
+ it "should form a valid request to page data" do
36
+ Yahoo::SE::Result.should_receive(:new).exactly(50).times.and_return(@result)
37
+ @pages_request.should_receive("open").with("http://search.yahooapis.com/SiteExplorerService/V1/pageData?appid=123&query=http://erbmicha.com&output=json").and_return(@json_pages_file)
38
+ @pages_request.results.size.should == 50
39
+ end
40
+
41
+ it "should form a valid request to ping a site" do
42
+ @ping_request.should_receive("open").with("http://search.yahooapis.com/SiteExplorerService/V1/ping?appid=123&sitemap=http://erbmicha.com&output=json").and_return(@json_ping_file)
43
+ @ping_request.response
44
+ end
45
+
46
+ it "should form a valid request to the update notification service" do
47
+ @update_notification_request.should_receive("open").with("http://search.yahooapis.com/SiteExplorerService/V1/updateNotification?appid=123&url=http://erbmicha.com&output=json").and_return(@json_ping_file)
48
+ @update_notification_request.response
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,11 @@
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
+ 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,12 @@
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
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yahoo-se
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.4
5
+ platform: ruby
6
+ authors:
7
+ - Lance Carlson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-11-09 00:00:00 -05:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rspec
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: rake
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
35
+ description: Ruby gem for the Yahoo! Site Explorer API
36
+ email: info@rubyskills.com
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files: []
42
+
43
+ files:
44
+ - Rakefile
45
+ - README
46
+ - lib/yahoo-se
47
+ - lib/yahoo-se/exceptions.rb
48
+ - lib/yahoo-se/inlinks.rb
49
+ - lib/yahoo-se/pages.rb
50
+ - lib/yahoo-se/paginator.rb
51
+ - lib/yahoo-se/ping.rb
52
+ - lib/yahoo-se/request.rb
53
+ - lib/yahoo-se/response.rb
54
+ - lib/yahoo-se/result.rb
55
+ - lib/yahoo-se/update_notification.rb
56
+ - lib/yahoo-se/version.rb
57
+ - lib/yahoo-se.rb
58
+ - spec/fixtures
59
+ - spec/fixtures/erbmicha.com_backlinks.json
60
+ - spec/fixtures/erbmicha.com_pages.json
61
+ - spec/fixtures/erbmicha.com_ping.json
62
+ - spec/spec.opts
63
+ - spec/spec_helper.rb
64
+ - spec/yahoo-se
65
+ - spec/yahoo-se/inlinks_spec.rb
66
+ - spec/yahoo-se/pages_spec.rb
67
+ - spec/yahoo-se/ping_spec.rb
68
+ - spec/yahoo-se/request_spec.rb
69
+ - spec/yahoo-se/response_spec.rb
70
+ - spec/yahoo-se/result_spec.rb
71
+ - spec/yahoo-se/update_notification_spec.rb
72
+ - spec/yahoo-se_spec.rb
73
+ has_rdoc: true
74
+ homepage: http://www.rubyskills.com
75
+ post_install_message:
76
+ rdoc_options: []
77
+
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: "0"
85
+ version:
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: "0"
91
+ version:
92
+ requirements: []
93
+
94
+ rubyforge_project:
95
+ rubygems_version: 1.3.1
96
+ signing_key:
97
+ specification_version: 2
98
+ summary: Yahoo! Site Explorer Gem
99
+ test_files: []
100
+