pingback 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/Rakefile +1 -0
- data/lib/pingback/client.rb +1 -1
- data/lib/pingback/version.rb +1 -1
- data/pingback.gemspec +1 -0
- data/spec/client_spec.rb +7 -7
- data/spec/spec_helper.rb +0 -2
- metadata +87 -29
data/README.rdoc
CHANGED
@@ -27,7 +27,7 @@ Personally I dont think that its a good idea to allow some strangers to request
|
|
27
27
|
source_uri = "http://myblog.com/articles/2"
|
28
28
|
target_uri = "http://someblog.com/articles/16"
|
29
29
|
|
30
|
-
Pingback::Client.
|
30
|
+
Pingback::Client.new.ping(source_uri, target_uri)
|
31
31
|
|
32
32
|
== receiving pingback requests
|
33
33
|
|
data/Rakefile
CHANGED
data/lib/pingback/client.rb
CHANGED
@@ -13,7 +13,7 @@ module Pingback
|
|
13
13
|
# @raise [Pingback::InvalidTargetException] raised if the target is not a pingback-enabled resource
|
14
14
|
# @raise [XMLRPC::FaultException] raised if the server responds with a faultcode
|
15
15
|
# @return [String] message indicating that the request was successful
|
16
|
-
def
|
16
|
+
def ping(source_uri, target_uri)
|
17
17
|
header = request_header target_uri
|
18
18
|
pingback_server = header['X-Pingback']
|
19
19
|
|
data/lib/pingback/version.rb
CHANGED
data/pingback.gemspec
CHANGED
@@ -16,6 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.add_dependency 'nokogiri'
|
17
17
|
s.add_dependency 'rack'
|
18
18
|
|
19
|
+
s.add_development_dependency "rake", "0.8.7"
|
19
20
|
s.add_development_dependency "bundler", ">= 1.0.0"
|
20
21
|
s.add_development_dependency "rspec", ">= 2.5.0"
|
21
22
|
s.add_development_dependency "webmock", ">= 1.6.2"
|
data/spec/client_spec.rb
CHANGED
@@ -16,7 +16,7 @@ describe Pingback::Client do
|
|
16
16
|
stub_request(:head, @target).to_return(pingback_in_header)
|
17
17
|
stub_request(:post, @server).to_return(successful_response)
|
18
18
|
|
19
|
-
@client.
|
19
|
+
@client.ping(@source, @target)
|
20
20
|
|
21
21
|
a_request(:head, @target).should have_been_made
|
22
22
|
a_request(:post, @server).should have_been_made
|
@@ -27,7 +27,7 @@ describe Pingback::Client do
|
|
27
27
|
stub_request(:get, @target).to_return(pingback_in_body)
|
28
28
|
stub_request(:post, @server).to_return(successful_response)
|
29
29
|
|
30
|
-
@client.
|
30
|
+
@client.ping(@source, @target)
|
31
31
|
|
32
32
|
a_request(:head, @target).should have_been_made
|
33
33
|
a_request(:get, @target).should have_been_made
|
@@ -42,7 +42,7 @@ describe Pingback::Client do
|
|
42
42
|
stub_request(:get, @target).to_return(pingback_in_body(escaped_server_uri))
|
43
43
|
stub_request(:post, server_uri).to_return(successful_response)
|
44
44
|
|
45
|
-
@client.
|
45
|
+
@client.ping(@source, @target)
|
46
46
|
|
47
47
|
a_request(:post, server_uri).should have_been_made
|
48
48
|
end
|
@@ -52,7 +52,7 @@ describe Pingback::Client do
|
|
52
52
|
stub_request(:get, @target).to_return(pingback_nowhere)
|
53
53
|
|
54
54
|
lambda {
|
55
|
-
@client.
|
55
|
+
@client.ping(@source, @target)
|
56
56
|
}.should raise_error(Pingback::InvalidTargetException)
|
57
57
|
end
|
58
58
|
|
@@ -60,7 +60,7 @@ describe Pingback::Client do
|
|
60
60
|
stub_request(:head, @target).to_return(pingback_in_header)
|
61
61
|
stub_request(:post, @server).to_return(successful_response)
|
62
62
|
|
63
|
-
@client.
|
63
|
+
@client.ping(@source, @target)
|
64
64
|
a_request(:post, @server).with { |req|
|
65
65
|
PrettyXML.write(req.body) == PrettyXML.write(pingback_request_xml)
|
66
66
|
}.should have_been_made
|
@@ -70,7 +70,7 @@ describe Pingback::Client do
|
|
70
70
|
stub_request(:head, @target).to_return(pingback_in_header)
|
71
71
|
stub_request(:post, @server).to_return(successful_response)
|
72
72
|
|
73
|
-
@client.
|
73
|
+
@client.ping(@source, @target).should ~ /Pingback for.*successful/
|
74
74
|
end
|
75
75
|
|
76
76
|
it "should raise a corresponding exception if a fault code is received" do
|
@@ -79,7 +79,7 @@ describe Pingback::Client do
|
|
79
79
|
stub_request(:post, @server).to_return(fault)
|
80
80
|
|
81
81
|
lambda {
|
82
|
-
@client.
|
82
|
+
@client.ping(@source, @target)
|
83
83
|
}.should raise_error(XMLRPC::FaultException)
|
84
84
|
end
|
85
85
|
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pingback
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 19
|
4
5
|
prerelease:
|
5
|
-
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 1.1.0
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
13
|
- Andreas Wurm
|
@@ -10,86 +15,131 @@ autorequire:
|
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
17
|
|
13
|
-
date: 2011-05-
|
18
|
+
date: 2011-05-30 00:00:00 +02:00
|
14
19
|
default_executable:
|
15
20
|
dependencies:
|
16
21
|
- !ruby/object:Gem::Dependency
|
17
|
-
|
18
|
-
prerelease: false
|
19
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
22
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
20
23
|
none: false
|
21
24
|
requirements:
|
22
25
|
- - ">="
|
23
26
|
- !ruby/object:Gem::Version
|
27
|
+
hash: 3
|
28
|
+
segments:
|
29
|
+
- 0
|
24
30
|
version: "0"
|
31
|
+
prerelease: false
|
25
32
|
type: :runtime
|
26
|
-
|
33
|
+
requirement: *id001
|
34
|
+
name: nokogiri
|
27
35
|
- !ruby/object:Gem::Dependency
|
28
|
-
|
29
|
-
prerelease: false
|
30
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
36
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
31
37
|
none: false
|
32
38
|
requirements:
|
33
39
|
- - ">="
|
34
40
|
- !ruby/object:Gem::Version
|
41
|
+
hash: 3
|
42
|
+
segments:
|
43
|
+
- 0
|
35
44
|
version: "0"
|
45
|
+
prerelease: false
|
36
46
|
type: :runtime
|
37
|
-
|
47
|
+
requirement: *id002
|
48
|
+
name: rack
|
38
49
|
- !ruby/object:Gem::Dependency
|
39
|
-
|
50
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - "="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
hash: 49
|
56
|
+
segments:
|
57
|
+
- 0
|
58
|
+
- 8
|
59
|
+
- 7
|
60
|
+
version: 0.8.7
|
40
61
|
prerelease: false
|
41
|
-
|
62
|
+
type: :development
|
63
|
+
requirement: *id003
|
64
|
+
name: rake
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
42
67
|
none: false
|
43
68
|
requirements:
|
44
69
|
- - ">="
|
45
70
|
- !ruby/object:Gem::Version
|
71
|
+
hash: 23
|
72
|
+
segments:
|
73
|
+
- 1
|
74
|
+
- 0
|
75
|
+
- 0
|
46
76
|
version: 1.0.0
|
77
|
+
prerelease: false
|
47
78
|
type: :development
|
48
|
-
|
79
|
+
requirement: *id004
|
80
|
+
name: bundler
|
49
81
|
- !ruby/object:Gem::Dependency
|
50
|
-
|
51
|
-
prerelease: false
|
52
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
82
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
53
83
|
none: false
|
54
84
|
requirements:
|
55
85
|
- - ">="
|
56
86
|
- !ruby/object:Gem::Version
|
87
|
+
hash: 27
|
88
|
+
segments:
|
89
|
+
- 2
|
90
|
+
- 5
|
91
|
+
- 0
|
57
92
|
version: 2.5.0
|
93
|
+
prerelease: false
|
58
94
|
type: :development
|
59
|
-
|
95
|
+
requirement: *id005
|
96
|
+
name: rspec
|
60
97
|
- !ruby/object:Gem::Dependency
|
61
|
-
|
62
|
-
prerelease: false
|
63
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
98
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
64
99
|
none: false
|
65
100
|
requirements:
|
66
101
|
- - ">="
|
67
102
|
- !ruby/object:Gem::Version
|
103
|
+
hash: 11
|
104
|
+
segments:
|
105
|
+
- 1
|
106
|
+
- 6
|
107
|
+
- 2
|
68
108
|
version: 1.6.2
|
109
|
+
prerelease: false
|
69
110
|
type: :development
|
70
|
-
|
111
|
+
requirement: *id006
|
112
|
+
name: webmock
|
71
113
|
- !ruby/object:Gem::Dependency
|
72
|
-
|
73
|
-
prerelease: false
|
74
|
-
requirement: &id006 !ruby/object:Gem::Requirement
|
114
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
75
115
|
none: false
|
76
116
|
requirements:
|
77
117
|
- - ">="
|
78
118
|
- !ruby/object:Gem::Version
|
119
|
+
hash: 3
|
120
|
+
segments:
|
121
|
+
- 0
|
79
122
|
version: "0"
|
123
|
+
prerelease: false
|
80
124
|
type: :development
|
81
|
-
|
125
|
+
requirement: *id007
|
126
|
+
name: rack-test
|
82
127
|
- !ruby/object:Gem::Dependency
|
83
|
-
|
84
|
-
prerelease: false
|
85
|
-
requirement: &id007 !ruby/object:Gem::Requirement
|
128
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
86
129
|
none: false
|
87
130
|
requirements:
|
88
131
|
- - "="
|
89
132
|
- !ruby/object:Gem::Version
|
133
|
+
hash: 25
|
134
|
+
segments:
|
135
|
+
- 0
|
136
|
+
- 1
|
137
|
+
- 1
|
90
138
|
version: 0.1.1
|
139
|
+
prerelease: false
|
91
140
|
type: :development
|
92
|
-
|
141
|
+
requirement: *id008
|
142
|
+
name: pretty-xml
|
93
143
|
description: This library enables the user to write pingback aware applications.
|
94
144
|
email:
|
95
145
|
- andreaswurm@gmx.de
|
@@ -127,12 +177,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
127
177
|
requirements:
|
128
178
|
- - ">="
|
129
179
|
- !ruby/object:Gem::Version
|
180
|
+
hash: 3
|
181
|
+
segments:
|
182
|
+
- 0
|
130
183
|
version: "0"
|
131
184
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
185
|
none: false
|
133
186
|
requirements:
|
134
187
|
- - ">="
|
135
188
|
- !ruby/object:Gem::Version
|
189
|
+
hash: 23
|
190
|
+
segments:
|
191
|
+
- 1
|
192
|
+
- 3
|
193
|
+
- 6
|
136
194
|
version: 1.3.6
|
137
195
|
requirements: []
|
138
196
|
|