PageRankr 3.1.2 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. data/CHANGELOG.md +5 -0
  2. data/README.md +26 -10
  3. data/lib/page_rankr.rb +3 -0
  4. data/lib/page_rankr/backlinks/alexa.rb +4 -0
  5. data/lib/page_rankr/backlinks/bing.rb +4 -0
  6. data/lib/page_rankr/backlinks/google.rb +5 -1
  7. data/lib/page_rankr/backlinks/yahoo.rb +4 -0
  8. data/lib/page_rankr/indexes/bing.rb +4 -0
  9. data/lib/page_rankr/indexes/google.rb +5 -1
  10. data/lib/page_rankr/indexes/yahoo.rb +4 -0
  11. data/lib/page_rankr/proxy_services.rb +5 -0
  12. data/lib/page_rankr/proxy_services/random.rb +13 -0
  13. data/lib/page_rankr/proxy_services/round_robin.rb +16 -0
  14. data/lib/page_rankr/ranks.rb +0 -1
  15. data/lib/page_rankr/ranks/alexa_global.rb +4 -0
  16. data/lib/page_rankr/ranks/alexa_us.rb +4 -0
  17. data/lib/page_rankr/ranks/google.rb +4 -0
  18. data/lib/page_rankr/site.rb +1 -0
  19. data/lib/page_rankr/tracker.rb +10 -1
  20. data/lib/page_rankr/version.rb +1 -1
  21. data/spec/fixtures/vcr_cassettes/alexa_ranks_edge_case_1.yml +116 -108
  22. data/spec/fixtures/vcr_cassettes/failure_backlinks.yml +4313 -1334
  23. data/spec/fixtures/vcr_cassettes/failure_indexes.yml +4367 -1435
  24. data/spec/fixtures/vcr_cassettes/failure_ranks.yml +13 -551
  25. data/spec/fixtures/vcr_cassettes/success_backlinks.yml +5191 -2189
  26. data/spec/fixtures/vcr_cassettes/success_indexes.yml +5048 -1930
  27. data/spec/fixtures/vcr_cassettes/success_ranks.yml +31 -671
  28. data/spec/page_rankr_spec.rb +0 -5
  29. data/spec/proxy_services/random_spec.rb +21 -0
  30. data/spec/proxy_services/round_robin_spec.rb +30 -0
  31. data/spec/site_spec.rb +13 -0
  32. data/spec/spec_helper.rb +2 -2
  33. metadata +34 -23
  34. data/lib/page_rankr/ranks/compete.rb +0 -18
@@ -16,7 +16,6 @@ describe PageRankr do
16
16
 
17
17
  it{ should include(:alexa_us) }
18
18
  it{ should include(:alexa_global) }
19
- it{ should include(:compete) }
20
19
  it{ should include(:google) }
21
20
  end
22
21
 
@@ -31,11 +30,9 @@ describe PageRankr do
31
30
  it{ should have_key(:alexa_us) }
32
31
  it{ should have_key(:alexa_global) }
33
32
  it{ should have_key(:google) }
34
- it{ should have_key(:compete) }
35
33
 
36
34
  it{ subject[:alexa_us].should >= 1 }
37
35
  it{ subject[:alexa_global].should >= 1 }
38
- it{ subject[:compete].should >= 1 }
39
36
  it{ subject[:google].should be_in(0..10) }
40
37
  end
41
38
 
@@ -49,11 +46,9 @@ describe PageRankr do
49
46
  it{ should have_key(:alexa_us) }
50
47
  it{ should have_key(:alexa_global) }
51
48
  it{ should have_key(:google) }
52
- it{ should have_key(:compete) }
53
49
 
54
50
  it{ subject[:alexa_us].should be_nil }
55
51
  it{ subject[:alexa_global].should be_nil }
56
- it{ subject[:compete].should be_nil }
57
52
  it{ subject[:google].should be_nil }
58
53
  end
59
54
  end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe PageRankr::ProxyServices::Random do
4
+ let(:proxies) do
5
+ [
6
+ "user:password@192.168.1.1:50501",
7
+ "bob:smith@127.0.0.1:3000"
8
+ ]
9
+ end
10
+ let(:site){PageRankr::Site("http://www.google.com")}
11
+ let(:name){:ranks_google}
12
+ subject{PageRankr::ProxyServices::Random.new(proxies)}
13
+
14
+ it{should respond_to(:proxy).with(2).arguments}
15
+
16
+ it "should return a proxy from the list of proxies" do
17
+ 10.times do
18
+ proxies.should include(subject.proxy(name, site))
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe PageRankr::ProxyServices::RoundRobin do
4
+ let(:proxies) do
5
+ [
6
+ "user:password@192.168.1.1:50501",
7
+ "bob:smith@127.0.0.1:3000"
8
+ ]
9
+ end
10
+ let(:site){PageRankr::Site("http://www.google.com")}
11
+ let(:name){:ranks_google}
12
+ subject{PageRankr::ProxyServices::RoundRobin.new(proxies)}
13
+
14
+ it{should respond_to(:proxy).with(2).arguments}
15
+
16
+ it "should return the first proxy on the first call" do
17
+ subject.proxy(name, site).should == proxies.first
18
+ end
19
+
20
+ it "should return the second proxy on the second call" do
21
+ subject.proxy(name, site)
22
+ subject.proxy(name, site).should == proxies.last
23
+ end
24
+
25
+ it "should return the first proxy on the third call" do
26
+ subject.proxy(name, site)
27
+ subject.proxy(name, site)
28
+ subject.proxy(name, site).should == proxies.first
29
+ end
30
+ end
data/spec/site_spec.rb ADDED
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe PageRankr::Site do
4
+ describe "#scheme" do
5
+ it "should set the scheme to http if no scheme is present" do
6
+ PageRankr::Site("www.google.com").scheme.should == "http"
7
+ end
8
+
9
+ it "should use the scheme if it is provided" do
10
+ PageRankr::Site("https://www.google.com").scheme.should == "https"
11
+ end
12
+ end
13
+ end
data/spec/spec_helper.rb CHANGED
@@ -3,9 +3,9 @@ require 'rspec'
3
3
  require 'fuubar'
4
4
  require 'vcr'
5
5
 
6
- VCR.config do |c|
6
+ VCR.configure do |c|
7
7
  c.cassette_library_dir = './spec/fixtures/vcr_cassettes'
8
- c.stub_with :typhoeus
8
+ c.hook_into :typhoeus
9
9
  end
10
10
 
11
11
  RSpec.configure do |c|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: PageRankr
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.2
4
+ version: 3.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-03 00:00:00.000000000 Z
12
+ date: 2012-05-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &70172803542120 !ruby/object:Gem::Requirement
16
+ requirement: &70262062209440 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70172803542120
24
+ version_requirements: *70262062209440
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &70172803541560 !ruby/object:Gem::Requirement
27
+ requirement: &70262062208660 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 2.6.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70172803541560
35
+ version_requirements: *70262062208660
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
- requirement: &70172803540980 !ruby/object:Gem::Requirement
38
+ requirement: &70262062208000 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.0.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70172803540980
46
+ version_requirements: *70262062208000
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: fuubar
49
- requirement: &70172803540520 !ruby/object:Gem::Requirement
49
+ requirement: &70262062207060 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.0.1
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70172803540520
57
+ version_requirements: *70262062207060
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: vcr
60
- requirement: &70172803540140 !ruby/object:Gem::Requirement
60
+ requirement: &70262062205520 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70172803540140
68
+ version_requirements: *70262062205520
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: nokogiri
71
- requirement: &70172803539460 !ruby/object:Gem::Requirement
71
+ requirement: &70262062204580 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 1.4.1
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70172803539460
79
+ version_requirements: *70262062204580
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: json
82
- requirement: &70172803538400 !ruby/object:Gem::Requirement
82
+ requirement: &70262062218800 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 1.4.6
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *70172803538400
90
+ version_requirements: *70262062218800
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: public_suffix
93
- requirement: &70172803537020 !ruby/object:Gem::Requirement
93
+ requirement: &70262062217400 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: 0.9.0
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *70172803537020
101
+ version_requirements: *70262062217400
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: typhoeus
104
- requirement: &70172803535880 !ruby/object:Gem::Requirement
104
+ requirement: &70262062215780 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: 0.2.1
110
110
  type: :runtime
111
111
  prerelease: false
112
- version_requirements: *70172803535880
112
+ version_requirements: *70262062215780
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: jsonpath
115
- requirement: &70172803534900 !ruby/object:Gem::Requirement
115
+ requirement: &70262062214860 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,7 +120,7 @@ dependencies:
120
120
  version: 0.4.2
121
121
  type: :runtime
122
122
  prerelease: false
123
- version_requirements: *70172803534900
123
+ version_requirements: *70262062214860
124
124
  description: Easy way to retrieve Google Page Rank, Alexa Rank, backlink counts, and
125
125
  index counts.
126
126
  email:
@@ -150,11 +150,13 @@ files:
150
150
  - lib/page_rankr/indexes/bing.rb
151
151
  - lib/page_rankr/indexes/google.rb
152
152
  - lib/page_rankr/indexes/yahoo.rb
153
+ - lib/page_rankr/proxy_services.rb
154
+ - lib/page_rankr/proxy_services/random.rb
155
+ - lib/page_rankr/proxy_services/round_robin.rb
153
156
  - lib/page_rankr/rank.rb
154
157
  - lib/page_rankr/ranks.rb
155
158
  - lib/page_rankr/ranks/alexa_global.rb
156
159
  - lib/page_rankr/ranks/alexa_us.rb
157
- - lib/page_rankr/ranks/compete.rb
158
160
  - lib/page_rankr/ranks/google.rb
159
161
  - lib/page_rankr/ranks/google/checksum.rb
160
162
  - lib/page_rankr/site.rb
@@ -171,7 +173,10 @@ files:
171
173
  - spec/fixtures/vcr_cassettes/success_indexes.yml
172
174
  - spec/fixtures/vcr_cassettes/success_ranks.yml
173
175
  - spec/page_rankr_spec.rb
176
+ - spec/proxy_services/random_spec.rb
177
+ - spec/proxy_services/round_robin_spec.rb
174
178
  - spec/ranks/google/checksum_spec.rb
179
+ - spec/site_spec.rb
175
180
  - spec/spec_helper.rb
176
181
  homepage: http://github.com/blatyo/page_rankr
177
182
  licenses: []
@@ -185,6 +190,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
185
190
  - - ! '>='
186
191
  - !ruby/object:Gem::Version
187
192
  version: '0'
193
+ segments:
194
+ - 0
195
+ hash: 3537705496008062486
188
196
  required_rubygems_version: !ruby/object:Gem::Requirement
189
197
  none: false
190
198
  requirements:
@@ -208,5 +216,8 @@ test_files:
208
216
  - spec/fixtures/vcr_cassettes/success_indexes.yml
209
217
  - spec/fixtures/vcr_cassettes/success_ranks.yml
210
218
  - spec/page_rankr_spec.rb
219
+ - spec/proxy_services/random_spec.rb
220
+ - spec/proxy_services/round_robin_spec.rb
211
221
  - spec/ranks/google/checksum_spec.rb
222
+ - spec/site_spec.rb
212
223
  - spec/spec_helper.rb
@@ -1,18 +0,0 @@
1
- require File.expand_path('../../rank', __FILE__)
2
- require 'cgi'
3
-
4
- module PageRankr
5
- class Ranks
6
- class Compete
7
- include Rank
8
-
9
- def url
10
- "http://siteanalytics.compete.com/#{CGI.escape(@site.domain)}/"
11
- end
12
-
13
- def xpath
14
- "//div[@class='section score']/h4[2]/text()"
15
- end
16
- end
17
- end
18
- end