blog-pinging-service 0.1.2

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.
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
@@ -0,0 +1,5 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
4
+ rdoc
5
+ pkg
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 teejayvanslyke, 2010 jfredson
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,9 @@
1
+ = blog-pinging-service
2
+
3
+ Easy as pie:
4
+
5
+ BlogPingingService.ping('My Sweet Site', 'http://www.mysweetsite.com')
6
+
7
+ == Copyright
8
+
9
+ Copyright (c) 2009 teejayvanslyke, 2010 jfredson. See LICENSE for details.
@@ -0,0 +1,48 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "blog-pinging-service"
8
+ gem.summary = %Q{Ruby interface with various search engine ping APIs.}
9
+ gem.email = "jfredson@gmail.com"
10
+ gem.homepage = "http://github.com/jfredson/blog-pinging-service"
11
+ gem.authors = ["teejayvanslyke","jfredson"]
12
+ gem.add_dependency('curb')
13
+ end
14
+
15
+ rescue LoadError
16
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
17
+ end
18
+
19
+ require 'spec/rake/spectask'
20
+ Spec::Rake::SpecTask.new(:spec) do |spec|
21
+ spec.libs << 'lib' << 'spec'
22
+ spec.spec_files = FileList['spec/**/*_spec.rb']
23
+ end
24
+
25
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
26
+ spec.libs << 'lib' << 'spec'
27
+ spec.pattern = 'spec/**/*_spec.rb'
28
+ spec.rcov = true
29
+ end
30
+
31
+
32
+ task :default => :spec
33
+
34
+ require 'rake/rdoctask'
35
+ Rake::RDocTask.new do |rdoc|
36
+ if File.exist?('VERSION.yml')
37
+ config = YAML.load(File.read('VERSION.yml'))
38
+ version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
39
+ else
40
+ version = ""
41
+ end
42
+
43
+ rdoc.rdoc_dir = 'rdoc'
44
+ rdoc.title = "blog-pinging-service #{version}"
45
+ rdoc.rdoc_files.include('README*')
46
+ rdoc.rdoc_files.include('lib/**/*.rb')
47
+ end
48
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.2
@@ -0,0 +1,49 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{blog-pinging-service}
5
+ s.version = "0.1.2"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["teejayvanslyke","jfredson"]
9
+ s.date = %q{2009-07-07}
10
+ s.email = %q{jfredson@gmail.com}
11
+ s.extra_rdoc_files = [
12
+ "LICENSE",
13
+ "README.rdoc"
14
+ ]
15
+ s.files = [
16
+ ".document",
17
+ ".gitignore",
18
+ "LICENSE",
19
+ "README.rdoc",
20
+ "Rakefile",
21
+ "VERSION",
22
+ "blog-pinging-service.gemspec",
23
+ "lib/blog-pinging-service.rb",
24
+ "spec/blog-pinging-service_spec.rb",
25
+ "spec/spec_helper.rb"
26
+ ]
27
+ s.homepage = %q{http://github.com/jfredson/blog-pinging-service}
28
+ s.rdoc_options = ["--charset=UTF-8"]
29
+ s.require_paths = ["lib"]
30
+ s.rubygems_version = %q{1.3.4}
31
+ s.summary = %q{Ruby interface with various search engine ping APIs.}
32
+ s.test_files = [
33
+ "spec/blog-pinging-service_spec.rb",
34
+ "spec/spec_helper.rb"
35
+ ]
36
+
37
+ if s.respond_to? :specification_version then
38
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
39
+ s.specification_version = 3
40
+
41
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
42
+ s.add_runtime_dependency(%q<curb>, [">= 0"])
43
+ else
44
+ s.add_dependency(%q<curb>, [">= 0"])
45
+ end
46
+ else
47
+ s.add_dependency(%q<curb>, [">= 0"])
48
+ end
49
+ end
@@ -0,0 +1,70 @@
1
+ require 'rubygems'
2
+
3
+ require 'cgi'
4
+ require 'curb'
5
+
6
+ module BlogPingingService
7
+
8
+ class GoogleRequest
9
+ SERVICE_URI = "http://blogsearch.google.com/ping"
10
+
11
+ def initialize(name, uri, changes_url=nil)
12
+ @params = {
13
+ 'name' => name,
14
+ 'url' => uri
15
+ }
16
+ @params['changesUrl'] = changes_url if changes_url
17
+ end
18
+
19
+ def query_string
20
+ elements = []
21
+ @params.keys.size.times do |i|
22
+ elements << "#{@params.keys[i]}=#{CGI::escape(@params.values[i])}"
23
+ end
24
+ elements.join('&')
25
+ end
26
+
27
+ def perform
28
+ c = Curl::Easy.new("#{SERVICE_URI}?#{query_string}") do |curl|
29
+ curl.verbose = true
30
+ end
31
+ c.perform
32
+
33
+ return c.body_str == 'Thanks for the ping.'
34
+ end
35
+ end
36
+
37
+ class YahooRequest
38
+ SERVICE_URI = "http://search.yahooapis.com/SiteExplorerService/V1/ping"
39
+
40
+ def initialize(uri)
41
+ @params = {
42
+ 'sitemap' => uri,
43
+ }
44
+ end
45
+
46
+ def query_string
47
+ elements = []
48
+ @params.keys.size.times do |i|
49
+ elements << "#{@params.keys[i]}=#{CGI::escape(@params.values[i])}"
50
+ end
51
+ elements.join('&')
52
+ end
53
+
54
+ def perform
55
+ c = Curl::Easy.new("#{SERVICE_URI}?#{query_string}") do |curl|
56
+ curl.verbose = true
57
+ end
58
+ c.perform
59
+
60
+ return c.body_str == 'Thanks for the ping.'
61
+ end
62
+ end
63
+
64
+ def self.ping(name, uri, changes_url=nil)
65
+ GoogleRequest.new(name, uri, changes_url).perform
66
+ YahooRequest.new(uri).perform
67
+ end
68
+
69
+ end
70
+
@@ -0,0 +1,7 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "BlogPingingService" do
4
+ it "fails" do
5
+ fail "Error LOLFAIL: hey buddy, you should probably rename this file and start specing for real."
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ require 'spec'
2
+
3
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
4
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
5
+ require 'google-blog-pinging-service'
6
+
7
+ Spec::Runner.configure do |config|
8
+
9
+ end
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: blog-pinging-service
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 2
9
+ version: 0.1.2
10
+ platform: ruby
11
+ authors:
12
+ - teejayvanslyke
13
+ - jfredson
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2009-07-07 00:00:00 -04:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: curb
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ version: "0"
31
+ type: :runtime
32
+ version_requirements: *id001
33
+ description:
34
+ email: jfredson@gmail.com
35
+ executables: []
36
+
37
+ extensions: []
38
+
39
+ extra_rdoc_files:
40
+ - LICENSE
41
+ - README.rdoc
42
+ files:
43
+ - .document
44
+ - .gitignore
45
+ - LICENSE
46
+ - README.rdoc
47
+ - Rakefile
48
+ - VERSION
49
+ - blog-pinging-service.gemspec
50
+ - lib/blog-pinging-service.rb
51
+ - spec/blog-pinging-service_spec.rb
52
+ - spec/spec_helper.rb
53
+ has_rdoc: true
54
+ homepage: http://github.com/jfredson/blog-pinging-service
55
+ licenses: []
56
+
57
+ post_install_message:
58
+ rdoc_options:
59
+ - --charset=UTF-8
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ segments:
67
+ - 0
68
+ version: "0"
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ segments:
74
+ - 0
75
+ version: "0"
76
+ requirements: []
77
+
78
+ rubyforge_project:
79
+ rubygems_version: 1.3.6
80
+ signing_key:
81
+ specification_version: 3
82
+ summary: Ruby interface with various search engine ping APIs.
83
+ test_files:
84
+ - spec/blog-pinging-service_spec.rb
85
+ - spec/spec_helper.rb