lancecarlson-yahoo-se 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -10,6 +10,8 @@ gem install yahoo-se
10
10
 
11
11
  == Usage
12
12
 
13
+ Yahoo::SE.application_id = "YOUR_YAHOO_APPLICATION_ID"
14
+
13
15
  backlinks = Yahoo::SE.inlinks("http://rubyskills.com", :results => 100)
14
16
 
15
17
  backlinks.results
data/Rakefile CHANGED
@@ -27,8 +27,8 @@ spec = Gem::Specification.new do |s|
27
27
  s.homepage = HOMEPAGE
28
28
  s.has_rdoc = true
29
29
 
30
- s.add_dependency('rspec', '>= 1.1.4')
31
- s.add_dependency('rake', '>= 0.8.1')
30
+ s.add_dependency('rspec')
31
+ s.add_dependency('rake')
32
32
 
33
33
  s.files = [ "Rakefile", "README" ]
34
34
  dist_dirs.each do |dir|
@@ -0,0 +1,22 @@
1
+ module Yahoo
2
+ module SE
3
+ def self.ping(domain)
4
+ Yahoo::SE::Ping.new(domain)
5
+ end
6
+
7
+ class Ping
8
+ SERVICE_PATH = "#{Yahoo::SE::SERVICE_PATH}/ping"
9
+
10
+ def initialize(domain)
11
+ @domain = domain
12
+ @options = {}
13
+ @options[:sitemap] = domain
14
+ response
15
+ end
16
+
17
+ def response
18
+ Yahoo::SE::Request.new(Yahoo::SE::Ping::SERVICE_PATH, @options).response
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,5 +1,5 @@
1
1
  module Yahoo
2
2
  module SE
3
- VERSION = "0.0.2" unless defined?(Yahoo::SE::VERSION)
3
+ VERSION = "0.1.0" unless defined?(Yahoo::SE::VERSION)
4
4
  end
5
5
  end
data/lib/yahoo-se.rb CHANGED
@@ -12,6 +12,6 @@ module Yahoo
12
12
  end
13
13
 
14
14
 
15
- %w(inlinks pages request response result version ping).each do |file|
15
+ %w(inlinks pages request response result version ping update_notification).each do |file|
16
16
  require File.join(File.dirname(__FILE__), "yahoo-se", file)
17
17
  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
@@ -14,6 +14,7 @@ describe Yahoo::SE::Request do
14
14
  @il_request = Yahoo::SE::Request.new(Yahoo::SE::Inlinks::SERVICE_PATH, :query => "http://erbmicha.com")
15
15
  @pages_request = Yahoo::SE::Request.new(Yahoo::SE::Pages::SERVICE_PATH, :query => "http://erbmicha.com")
16
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")
17
18
  @json_bl_file = mock(File)
18
19
  @json_bl_file.stub!(:readlines).and_return(@json_bl_file)
19
20
  @json_bl_file.stub!(:join).and_return(fixture("erbmicha.com_backlinks.json"))
@@ -41,5 +42,10 @@ describe Yahoo::SE::Request do
41
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)
42
43
  @ping_request.response
43
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
44
50
  end
45
51
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lancecarlson-yahoo-se
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lance Carlson
@@ -28,6 +28,7 @@ files:
28
28
  - lib/yahoo-se.rb
29
29
  - lib/yahoo-se/inlinks.rb
30
30
  - lib/yahoo-se/pages.rb
31
+ - lib/yahoo-se/ping.rb
31
32
  - lib/yahoo-se/request.rb
32
33
  - lib/yahoo-se/response.rb
33
34
  - lib/yahoo-se/result.rb
@@ -38,6 +39,7 @@ files:
38
39
  - spec/spec_helper.rb
39
40
  - spec/yahoo-se/inlinks_spec.rb
40
41
  - spec/yahoo-se/pages_spec.rb
42
+ - spec/yahoo-se/ping_spec.rb
41
43
  - spec/yahoo-se/request_spec.rb
42
44
  - spec/yahoo-se/response_spec.rb
43
45
  - spec/yahoo-se/result_spec.rb