yahoo_site_explorer 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,9 +9,37 @@ class InlinkDataTest < Test::Unit::TestCase
9
9
  end
10
10
 
11
11
  should 'return the total number of query results' do
12
- mock_response_for('http://search.yahooapis.com/SiteExplorerService/V1/inlinkData?appid=testid&query=http://www.google.com',
12
+ mock_response_for('http://search.yahooapis.com/SiteExplorerService/V1/inlinkData?appid=testid&query=http://www.yahoo.com',
13
13
  :response => mock_inlink_data_successful_response)
14
- assert_equal '941822', inlink_data(:query => 'http://www.google.com')[:total_results]
14
+ assert_equal '941822', inlink_data(:query => 'http://www.yahoo.com')[:total_results_available]
15
+ end
16
+
17
+ should 'return the first result position' do
18
+ mock_response_for('http://search.yahooapis.com/SiteExplorerService/V1/inlinkData?appid=testid&query=http://www.yahoo.com',
19
+ :response => mock_inlink_data_successful_response)
20
+ assert_equal '1', inlink_data(:query => 'http://www.yahoo.com')[:first_result_position]
21
+ end
22
+
23
+ should 'return the total number of results returned' do
24
+ mock_response_for('http://search.yahooapis.com/SiteExplorerService/V1/inlinkData?appid=testid&query=http://www.yahoo.com',
25
+ :response => mock_inlink_data_successful_response)
26
+ assert_equal '2', inlink_data(:query => 'http://www.yahoo.com')[:total_results_returned]
27
+ end
28
+
29
+ should 'return the results' do
30
+ mock_response_for('http://search.yahooapis.com/SiteExplorerService/V1/inlinkData?appid=testid&query=http://www.yahoo.com',
31
+ :response => mock_inlink_data_successful_response)
32
+ assert_equal [ {
33
+ :url => 'http://www.commondreams.org/',
34
+ :title => 'Common Dreams News Center',
35
+ :click_url => 'http://www.commondreams.org/'
36
+ },
37
+ {
38
+ :url => 'http://www.scrubtheweb.com/',
39
+ :title => 'Scrub The Web',
40
+ :click_url => 'http://www.scrubtheweb.com/'
41
+ }],
42
+ inlink_data(:query => 'http://www.yahoo.com')[:results]
15
43
  end
16
44
 
17
45
  end
@@ -0,0 +1,48 @@
1
+ require 'test_helper'
2
+
3
+ class PageDataTest < Test::Unit::TestCase
4
+
5
+ context 'YahooSiteExplorer::API.page_data' do
6
+
7
+ teardown do
8
+ FakeWeb.clean_registry
9
+ end
10
+
11
+ should 'return the total number of query results' do
12
+ mock_response_for('http://search.yahooapis.com/SiteExplorerService/V1/pageData?appid=testid&query=http://www.yahoo.com',
13
+ :response => mock_page_data_successful_response_set_1)
14
+ assert_equal '99', page_data(:query => 'http://www.yahoo.com')[:total_results_available]
15
+ end
16
+
17
+ should 'return the first result position' do
18
+ mock_response_for('http://search.yahooapis.com/SiteExplorerService/V1/pageData?appid=testid&query=http://www.yahoo.com',
19
+ :response => mock_page_data_successful_response_set_1)
20
+ assert_equal '1', page_data(:query => 'http://www.yahoo.com')[:first_result_position]
21
+ end
22
+
23
+ should 'return the total number of results returned' do
24
+ mock_response_for('http://search.yahooapis.com/SiteExplorerService/V1/pageData?appid=testid&query=http://www.yahoo.com',
25
+ :response => mock_page_data_successful_response_set_1)
26
+ assert_equal '50', page_data(:query => 'http://www.yahoo.com')[:total_results_returned]
27
+ end
28
+
29
+ should 'return the results' do
30
+ mock_response_for('http://search.yahooapis.com/SiteExplorerService/V1/pageData?appid=testid&query=http://www.yahoo.com',
31
+ :response => mock_page_data_successful_response_set_1)
32
+ assert_equal 50,
33
+ page_data(:query => 'http://www.yahoo.com')[:results].size
34
+ assert_equal( {
35
+ :title=>"Site Explorer - Yahoo! Site Explorer",
36
+ :click_url=>"http://siteexplorer.search.yahoo.com/",
37
+ :url=>"http://siteexplorer.search.yahoo.com/"
38
+ },
39
+ page_data(:query => 'http://www.yahoo.com')[:results].first)
40
+ end
41
+
42
+ end
43
+
44
+ def page_data(options = {})
45
+ YahooSiteExplorer::API.new.page_data({:appid => 'testid'}.merge(options))
46
+ end
47
+
48
+ end
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{yahoo_site_explorer}
5
- s.version = "0.0.1"
5
+ s.version = "0.0.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Nathaniel Bibler"]
9
- s.date = %q{2009-06-08}
9
+ s.date = %q{2009-06-09}
10
10
  s.email = %q{gem@nathanielbibler.com}
11
11
  s.extra_rdoc_files = [
12
12
  "LICENSE",
@@ -18,14 +18,19 @@ Gem::Specification.new do |s|
18
18
  "LICENSE",
19
19
  "README.rdoc",
20
20
  "Rakefile",
21
- "VERSION",
21
+ "VERSION.yml",
22
22
  "lib/yahoo_site_explorer.rb",
23
23
  "lib/yahoo_site_explorer/api.rb",
24
24
  "lib/yahoo_site_explorer/backlinks.rb",
25
+ "lib/yahoo_site_explorer/page_data.rb",
26
+ "lib/yahoo_site_explorer/result.rb",
27
+ "lib/yahoo_site_explorer/results_container.rb",
25
28
  "test/integrations/yahoo_site_explorer_test.rb",
26
29
  "test/mocks/inlink_data.rb",
30
+ "test/mocks/page_data.rb",
27
31
  "test/test_helper.rb",
28
32
  "test/units/inlink_data_test.rb",
33
+ "test/units/page_data_test.rb",
29
34
  "yahoo_site_explorer.gemspec"
30
35
  ]
31
36
  s.has_rdoc = true
@@ -38,8 +43,10 @@ Gem::Specification.new do |s|
38
43
  s.test_files = [
39
44
  "test/integrations/yahoo_site_explorer_test.rb",
40
45
  "test/mocks/inlink_data.rb",
46
+ "test/mocks/page_data.rb",
41
47
  "test/test_helper.rb",
42
- "test/units/inlink_data_test.rb"
48
+ "test/units/inlink_data_test.rb",
49
+ "test/units/page_data_test.rb"
43
50
  ]
44
51
 
45
52
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yahoo_site_explorer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathaniel Bibler
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-08 00:00:00 -04:00
12
+ date: 2009-06-09 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -77,14 +77,19 @@ files:
77
77
  - LICENSE
78
78
  - README.rdoc
79
79
  - Rakefile
80
- - VERSION
80
+ - VERSION.yml
81
81
  - lib/yahoo_site_explorer.rb
82
82
  - lib/yahoo_site_explorer/api.rb
83
83
  - lib/yahoo_site_explorer/backlinks.rb
84
+ - lib/yahoo_site_explorer/page_data.rb
85
+ - lib/yahoo_site_explorer/result.rb
86
+ - lib/yahoo_site_explorer/results_container.rb
84
87
  - test/integrations/yahoo_site_explorer_test.rb
85
88
  - test/mocks/inlink_data.rb
89
+ - test/mocks/page_data.rb
86
90
  - test/test_helper.rb
87
91
  - test/units/inlink_data_test.rb
92
+ - test/units/page_data_test.rb
88
93
  - yahoo_site_explorer.gemspec
89
94
  has_rdoc: true
90
95
  homepage: http://github.com/nbibler/yahoo_site_explorer
@@ -117,5 +122,7 @@ summary: Ruby interface to the Yahoo! Site Explorer REST API
117
122
  test_files:
118
123
  - test/integrations/yahoo_site_explorer_test.rb
119
124
  - test/mocks/inlink_data.rb
125
+ - test/mocks/page_data.rb
120
126
  - test/test_helper.rb
121
127
  - test/units/inlink_data_test.rb
128
+ - test/units/page_data_test.rb
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.0.1