PageRankr 3.2.1 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/PageRankr.gemspec +2 -1
- data/README.md +19 -10
- data/Rakefile +6 -1
- data/lib/PageRankr.rb +1 -0
- data/lib/page_rankr/proxy_services/random.rb +2 -0
- data/lib/page_rankr/ranks/google.rb +1 -1
- data/lib/page_rankr/request.rb +44 -0
- data/lib/page_rankr/tracker.rb +11 -19
- data/lib/page_rankr/trackers.rb +18 -13
- data/lib/page_rankr/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/alexa_ranks_edge_case_1.yml +191 -175
- data/spec/fixtures/vcr_cassettes/failure_backlinks.yml +257 -4510
- data/spec/fixtures/vcr_cassettes/failure_indexes.yml +221 -4509
- data/spec/fixtures/vcr_cassettes/failure_ranks.yml +196 -127
- data/spec/fixtures/vcr_cassettes/success_backlinks.yml +291 -5401
- data/spec/fixtures/vcr_cassettes/success_indexes.yml +223 -5242
- data/spec/fixtures/vcr_cassettes/success_ranks.yml +280 -217
- data/spec/page_rankr_spec.rb +35 -5
- data/spec/spec_helper.rb +13 -1
- metadata +168 -88
data/spec/page_rankr_spec.rb
CHANGED
@@ -10,6 +10,36 @@ RSpec::Matchers.define :be_in do |expected|
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
+
RSpec::Matchers.define :be_number do
|
14
|
+
match do |actual|
|
15
|
+
actual.is_a?(Numeric) && actual.send(@symbol, @expected)
|
16
|
+
end
|
17
|
+
|
18
|
+
chain :>= do |expected|
|
19
|
+
@symbol = :>=
|
20
|
+
@expected = expected
|
21
|
+
end
|
22
|
+
|
23
|
+
chain :> do |expected|
|
24
|
+
@symbol = :>
|
25
|
+
@expected = expected
|
26
|
+
end
|
27
|
+
|
28
|
+
chain :< do |expected|
|
29
|
+
@symbol = :<
|
30
|
+
@expected = expected
|
31
|
+
end
|
32
|
+
|
33
|
+
chain :<= do |expected|
|
34
|
+
@symbol = :<=
|
35
|
+
@expected = expected
|
36
|
+
end
|
37
|
+
|
38
|
+
failure_message_for_should do |actual|
|
39
|
+
"expected that #{actual.inspect} would be a number and #{@symbol} than #{@expected}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
13
43
|
describe PageRankr do
|
14
44
|
describe "#rank_trackers" do
|
15
45
|
subject{ PageRankr.rank_trackers }
|
@@ -31,8 +61,8 @@ describe PageRankr do
|
|
31
61
|
it{ should have_key(:alexa_global) }
|
32
62
|
it{ should have_key(:google) }
|
33
63
|
|
34
|
-
it{ subject[:alexa_us].should >= 1 }
|
35
|
-
it{ subject[:alexa_global].should >= 1 }
|
64
|
+
it{ subject[:alexa_us].should be_number >= 1 }
|
65
|
+
it{ subject[:alexa_global].should be_number >= 1 }
|
36
66
|
it{ subject[:google].should be_in(0..10) }
|
37
67
|
end
|
38
68
|
|
@@ -74,7 +104,7 @@ describe PageRankr do
|
|
74
104
|
it{ should have_key(tracker) }
|
75
105
|
|
76
106
|
it "#{tracker} should have a value greater than zero" do
|
77
|
-
subject[tracker].should > 0
|
107
|
+
subject[tracker].should be_number > 0
|
78
108
|
end
|
79
109
|
end
|
80
110
|
end
|
@@ -115,7 +145,7 @@ describe PageRankr do
|
|
115
145
|
it{ should have_key(tracker) }
|
116
146
|
|
117
147
|
it "#{tracker} should have a value greater than zero" do
|
118
|
-
subject[tracker].should > 0
|
148
|
+
subject[tracker].should be_number > 0
|
119
149
|
end
|
120
150
|
end
|
121
151
|
end
|
@@ -140,7 +170,7 @@ describe PageRankr do
|
|
140
170
|
describe "::Site" do
|
141
171
|
[nil, '', 'batman.thedarkknight'].each do |value|
|
142
172
|
it "should raise an exception when given #{value.inspect}" do
|
143
|
-
expect{PageRankr::Site(value)}.
|
173
|
+
expect{PageRankr::Site(value)}.to raise_error(PageRankr::DomainInvalid)
|
144
174
|
end
|
145
175
|
end
|
146
176
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -5,7 +5,19 @@ require 'vcr'
|
|
5
5
|
|
6
6
|
VCR.configure do |c|
|
7
7
|
c.cassette_library_dir = './spec/fixtures/vcr_cassettes'
|
8
|
-
c.hook_into :
|
8
|
+
c.hook_into :fakeweb
|
9
|
+
c.default_cassette_options = {
|
10
|
+
:record => :once,
|
11
|
+
:match_requests_on => [
|
12
|
+
:method,
|
13
|
+
VCR.request_matchers.uri_without_param(
|
14
|
+
:cli,
|
15
|
+
:dat,
|
16
|
+
:client,
|
17
|
+
:features
|
18
|
+
)
|
19
|
+
]
|
20
|
+
}
|
9
21
|
end
|
10
22
|
|
11
23
|
RSpec.configure do |c|
|
metadata
CHANGED
@@ -1,134 +1,202 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: PageRankr
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 63
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 4
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 4.0.0
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Allen Madsen
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
17
|
+
|
18
|
+
date: 2012-12-18 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
name: rake
|
16
|
-
|
22
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
17
23
|
none: false
|
18
|
-
requirements:
|
19
|
-
- -
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
hash: 3
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
22
31
|
type: :development
|
32
|
+
requirement: *id001
|
23
33
|
prerelease: false
|
24
|
-
|
25
|
-
- !ruby/object:Gem::Dependency
|
34
|
+
- !ruby/object:Gem::Dependency
|
26
35
|
name: rspec
|
27
|
-
|
36
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
28
37
|
none: false
|
29
|
-
requirements:
|
30
|
-
- -
|
31
|
-
- !ruby/object:Gem::Version
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
hash: 23
|
42
|
+
segments:
|
43
|
+
- 2
|
44
|
+
- 6
|
45
|
+
- 0
|
32
46
|
version: 2.6.0
|
33
47
|
type: :development
|
48
|
+
requirement: *id002
|
34
49
|
prerelease: false
|
35
|
-
|
36
|
-
- !ruby/object:Gem::Dependency
|
50
|
+
- !ruby/object:Gem::Dependency
|
37
51
|
name: bundler
|
38
|
-
|
52
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
39
53
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 23
|
58
|
+
segments:
|
59
|
+
- 1
|
60
|
+
- 0
|
61
|
+
- 0
|
43
62
|
version: 1.0.0
|
44
63
|
type: :development
|
64
|
+
requirement: *id003
|
45
65
|
prerelease: false
|
46
|
-
|
47
|
-
- !ruby/object:Gem::Dependency
|
66
|
+
- !ruby/object:Gem::Dependency
|
48
67
|
name: fuubar
|
49
|
-
|
68
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
50
69
|
none: false
|
51
|
-
requirements:
|
52
|
-
- -
|
53
|
-
- !ruby/object:Gem::Version
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
hash: 29
|
74
|
+
segments:
|
75
|
+
- 0
|
76
|
+
- 0
|
77
|
+
- 1
|
54
78
|
version: 0.0.1
|
55
79
|
type: :development
|
80
|
+
requirement: *id004
|
56
81
|
prerelease: false
|
57
|
-
|
58
|
-
- !ruby/object:Gem::Dependency
|
82
|
+
- !ruby/object:Gem::Dependency
|
59
83
|
name: vcr
|
60
|
-
|
84
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
61
85
|
none: false
|
62
|
-
requirements:
|
63
|
-
- -
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
hash: 3
|
90
|
+
segments:
|
91
|
+
- 0
|
92
|
+
version: "0"
|
66
93
|
type: :development
|
94
|
+
requirement: *id005
|
67
95
|
prerelease: false
|
68
|
-
|
69
|
-
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: fakeweb
|
98
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
hash: 3
|
104
|
+
segments:
|
105
|
+
- 0
|
106
|
+
version: "0"
|
107
|
+
type: :development
|
108
|
+
requirement: *id006
|
109
|
+
prerelease: false
|
110
|
+
- !ruby/object:Gem::Dependency
|
70
111
|
name: nokogiri
|
71
|
-
|
112
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
72
113
|
none: false
|
73
|
-
requirements:
|
74
|
-
- -
|
75
|
-
- !ruby/object:Gem::Version
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
hash: 5
|
118
|
+
segments:
|
119
|
+
- 1
|
120
|
+
- 4
|
121
|
+
- 1
|
76
122
|
version: 1.4.1
|
77
123
|
type: :runtime
|
124
|
+
requirement: *id007
|
78
125
|
prerelease: false
|
79
|
-
|
80
|
-
- !ruby/object:Gem::Dependency
|
126
|
+
- !ruby/object:Gem::Dependency
|
81
127
|
name: json
|
82
|
-
|
128
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
83
129
|
none: false
|
84
|
-
requirements:
|
85
|
-
- -
|
86
|
-
- !ruby/object:Gem::Version
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
hash: 11
|
134
|
+
segments:
|
135
|
+
- 1
|
136
|
+
- 4
|
137
|
+
- 6
|
87
138
|
version: 1.4.6
|
88
139
|
type: :runtime
|
140
|
+
requirement: *id008
|
89
141
|
prerelease: false
|
90
|
-
|
91
|
-
- !ruby/object:Gem::Dependency
|
142
|
+
- !ruby/object:Gem::Dependency
|
92
143
|
name: public_suffix
|
93
|
-
|
144
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
94
145
|
none: false
|
95
|
-
requirements:
|
96
|
-
- -
|
97
|
-
- !ruby/object:Gem::Version
|
146
|
+
requirements:
|
147
|
+
- - ">="
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
hash: 59
|
150
|
+
segments:
|
151
|
+
- 0
|
152
|
+
- 9
|
153
|
+
- 0
|
98
154
|
version: 0.9.0
|
99
155
|
type: :runtime
|
156
|
+
requirement: *id009
|
100
157
|
prerelease: false
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
requirement: &70335135898200 !ruby/object:Gem::Requirement
|
158
|
+
- !ruby/object:Gem::Dependency
|
159
|
+
name: httparty
|
160
|
+
version_requirements: &id010 !ruby/object:Gem::Requirement
|
105
161
|
none: false
|
106
|
-
requirements:
|
107
|
-
- -
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
|
162
|
+
requirements:
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
hash: 59
|
166
|
+
segments:
|
167
|
+
- 0
|
168
|
+
- 9
|
169
|
+
- 0
|
170
|
+
version: 0.9.0
|
110
171
|
type: :runtime
|
172
|
+
requirement: *id010
|
111
173
|
prerelease: false
|
112
|
-
|
113
|
-
- !ruby/object:Gem::Dependency
|
174
|
+
- !ruby/object:Gem::Dependency
|
114
175
|
name: jsonpath
|
115
|
-
|
176
|
+
version_requirements: &id011 !ruby/object:Gem::Requirement
|
116
177
|
none: false
|
117
|
-
requirements:
|
118
|
-
- -
|
119
|
-
- !ruby/object:Gem::Version
|
178
|
+
requirements:
|
179
|
+
- - ">="
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
hash: 11
|
182
|
+
segments:
|
183
|
+
- 0
|
184
|
+
- 4
|
185
|
+
- 2
|
120
186
|
version: 0.4.2
|
121
187
|
type: :runtime
|
188
|
+
requirement: *id011
|
122
189
|
prerelease: false
|
123
|
-
|
124
|
-
|
125
|
-
index counts.
|
126
|
-
email:
|
190
|
+
description: Easy way to retrieve Google Page Rank, Alexa Rank, backlink counts, and index counts.
|
191
|
+
email:
|
127
192
|
- blatyo@gmail.com
|
128
193
|
executables: []
|
194
|
+
|
129
195
|
extensions: []
|
196
|
+
|
130
197
|
extra_rdoc_files: []
|
131
|
-
|
198
|
+
|
199
|
+
files:
|
132
200
|
- .gitignore
|
133
201
|
- .rvmrc
|
134
202
|
- .travis.yml
|
@@ -138,6 +206,7 @@ files:
|
|
138
206
|
- PageRankr.gemspec
|
139
207
|
- README.md
|
140
208
|
- Rakefile
|
209
|
+
- lib/PageRankr.rb
|
141
210
|
- lib/page_rankr.rb
|
142
211
|
- lib/page_rankr/backlink.rb
|
143
212
|
- lib/page_rankr/backlinks.rb
|
@@ -159,6 +228,7 @@ files:
|
|
159
228
|
- lib/page_rankr/ranks/alexa_us.rb
|
160
229
|
- lib/page_rankr/ranks/google.rb
|
161
230
|
- lib/page_rankr/ranks/google/checksum.rb
|
231
|
+
- lib/page_rankr/request.rb
|
162
232
|
- lib/page_rankr/site.rb
|
163
233
|
- lib/page_rankr/tracker.rb
|
164
234
|
- lib/page_rankr/trackers.rb
|
@@ -180,30 +250,40 @@ files:
|
|
180
250
|
- spec/spec_helper.rb
|
181
251
|
homepage: http://github.com/blatyo/page_rankr
|
182
252
|
licenses: []
|
253
|
+
|
183
254
|
post_install_message:
|
184
255
|
rdoc_options: []
|
185
|
-
|
256
|
+
|
257
|
+
require_paths:
|
186
258
|
- lib
|
187
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
259
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
188
260
|
none: false
|
189
|
-
requirements:
|
190
|
-
- -
|
191
|
-
- !ruby/object:Gem::Version
|
192
|
-
|
193
|
-
|
261
|
+
requirements:
|
262
|
+
- - ">="
|
263
|
+
- !ruby/object:Gem::Version
|
264
|
+
hash: 3
|
265
|
+
segments:
|
266
|
+
- 0
|
267
|
+
version: "0"
|
268
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
194
269
|
none: false
|
195
|
-
requirements:
|
196
|
-
- -
|
197
|
-
- !ruby/object:Gem::Version
|
270
|
+
requirements:
|
271
|
+
- - ">="
|
272
|
+
- !ruby/object:Gem::Version
|
273
|
+
hash: 23
|
274
|
+
segments:
|
275
|
+
- 1
|
276
|
+
- 3
|
277
|
+
- 6
|
198
278
|
version: 1.3.6
|
199
279
|
requirements: []
|
280
|
+
|
200
281
|
rubyforge_project:
|
201
|
-
rubygems_version: 1.8.
|
282
|
+
rubygems_version: 1.8.24
|
202
283
|
signing_key:
|
203
284
|
specification_version: 3
|
204
|
-
summary: Easy way to retrieve Google Page Rank, Alexa Rank, backlink counts, and index
|
205
|
-
|
206
|
-
test_files:
|
285
|
+
summary: Easy way to retrieve Google Page Rank, Alexa Rank, backlink counts, and index counts.
|
286
|
+
test_files:
|
207
287
|
- spec/edge_cases_spec.rb
|
208
288
|
- spec/fixtures/vcr_cassettes/alexa_ranks_edge_case_1.yml
|
209
289
|
- spec/fixtures/vcr_cassettes/failure_backlinks.yml
|