PageRankr 2.0.0 → 2.0.1

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.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Change Log
2
2
 
3
+ ## Version 2.0.1
4
+ * Alexa sometimes returns result for the incorrect site. In this case, the results returned are ignored.
5
+
3
6
  ## Version 2.0.0
4
7
  * URL validation
5
8
  * Parallel requests = way faster!
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- PageRankr (1.7.1)
4
+ PageRankr (2.0.0)
5
5
  json (>= 1.4.6)
6
6
  nokogiri (>= 1.4.1)
7
7
  public_suffix_service (~> 0.8.1)
data/PageRankr.gemspec CHANGED
@@ -7,8 +7,8 @@ Gem::Specification.new do |s|
7
7
  s.authors = ["Allen Madsen"]
8
8
  s.email = ["blatyo@gmail.com"]
9
9
  s.homepage = "http://github.com/blatyo/page_rankr"
10
- s.summary = "Easy way to retrieve Google Page Rank, Alexa Rank, and backlink counts"
11
- s.description = "Easy way to retrieve Google Page Rank, Alexa Rank, and backlink counts"
10
+ s.summary = "Easy way to retrieve Google Page Rank, Alexa Rank, backlink counts, and index counts."
11
+ s.description = "Easy way to retrieve Google Page Rank, Alexa Rank, backlink counts, and index counts."
12
12
 
13
13
  s.required_rubygems_version = ">= 1.3.6"
14
14
  s.add_development_dependency "rspec", "~> 2.1.0"
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # PageRankr
2
2
 
3
- Provides an easy way to retrieve Google Page Rank, Alexa Rank, and backlink counts.
3
+ Provides an easy way to retrieve Google Page Rank, Alexa Rank, backlink counts, and index counts.
4
4
 
5
5
  Check out a little [web app][1] I wrote up that uses it or look at the [source][2].
6
6
 
@@ -142,10 +142,12 @@ Then, just make sure you require the class and PageRankr and whenever you call P
142
142
  * Optionally use API keys
143
143
  * Maybe allow API key cycling to get around query limits
144
144
  * Google search API is deprecated
145
+ * Some search engines throttle the amount of queries. It would be nice to know when this happens. Probably throw an exception.
145
146
 
146
147
  ## Contributors
147
- * [Druwerd](https://github.com/Druwerd) - Use Google Search API instead of scraping.
148
+ * [Dru Ibarra](https://github.com/Druwerd) - Use Google Search API instead of scraping.
148
149
  * [Iteration Labs, LLC](https://github.com/iterationlabs) - Compete rank tracker and domain indexes.
150
+ * [Mark Seeger](https://github.com/rb2k) - Ignore invalid ranks that Alexa returns for incorrect sites.
149
151
 
150
152
  ## Shout Out
151
153
  Gotta give credit where credits due!
@@ -6,8 +6,14 @@ module PageRankr
6
6
  class AlexaGlobal
7
7
  include Rank
8
8
 
9
+ # Alexa may sometimes return a result for the incorrect site and thus it is necessary to check if
10
+ # the results returned are for the site we want.
11
+ #
12
+ # For example, slocourts.net returns results for ca.gov, presumably because www.slocourts.ca.gov redirects
13
+ # to slocourts.net. Clearly something is wrong with how Alexa handles this case and so in the event this
14
+ # happens we treat the results as if there were no results.
9
15
  def xpath
10
- "//popularity/@text"
16
+ "//popularity[contains(@url, '#{@site.domain}')]/@text"
11
17
  end
12
18
 
13
19
  def request
@@ -6,8 +6,14 @@ module PageRankr
6
6
  class AlexaUs
7
7
  include Rank
8
8
 
9
+ # Alexa may sometimes return a result for the incorrect site and thus it is necessary to check if
10
+ # the results returned are for the site we want.
11
+ #
12
+ # For example, slocourts.net returns results for ca.gov, presumably because www.slocourts.ca.gov redirects
13
+ # to slocourts.net. Clearly something is wrong with how Alexa handles this case and so in the event this
14
+ # happens we treat the results as if there were no results.
9
15
  def xpath
10
- "//reach/@rank"
16
+ "//popularity[contains(@url, '#{@site.domain}')]/../reach/@rank"
11
17
  end
12
18
 
13
19
  def request
@@ -1,3 +1,3 @@
1
1
  module PageRankr
2
- VERSION = "2.0.0"
2
+ VERSION = "2.0.1"
3
3
  end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe PageRankr do
4
+ describe "#ranks" do
5
+ # Alexa may sometimes return a result for the incorrect site and thus it is necessary to check if
6
+ # the results returned are for the site we want.
7
+ #
8
+ # For example, slocourts.net returns results for ca.gov, presumably because www.slocourts.ca.gov redirects
9
+ # to slocourts.net. Clearly something is wrong with how Alexa handles this case and so in the event this
10
+ # happens we treat the results as if there were no results.
11
+ describe "when Alexa returns results for the incorrect site" do
12
+ subject{ PageRankr.ranks("slocourts.net", :alexa_us, :alexa_global) }
13
+
14
+ it{ should have_key(:alexa_us) }
15
+ it{ should have_key(:alexa_global) }
16
+
17
+ it{ subject[:alexa_us].should be_nil }
18
+ it{ subject[:alexa_global].should be_nil }
19
+ end
20
+ end
21
+ end
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: PageRankr
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 2
7
- - 0
8
- - 0
9
- version: 2.0.0
4
+ prerelease:
5
+ version: 2.0.1
10
6
  platform: ruby
11
7
  authors:
12
8
  - Allen Madsen
@@ -14,7 +10,7 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2011-02-02 00:00:00 -05:00
13
+ date: 2011-02-23 00:00:00 -05:00
18
14
  default_executable:
19
15
  dependencies:
20
16
  - !ruby/object:Gem::Dependency
@@ -25,10 +21,6 @@ dependencies:
25
21
  requirements:
26
22
  - - ~>
27
23
  - !ruby/object:Gem::Version
28
- segments:
29
- - 2
30
- - 1
31
- - 0
32
24
  version: 2.1.0
33
25
  type: :development
34
26
  version_requirements: *id001
@@ -40,10 +32,6 @@ dependencies:
40
32
  requirements:
41
33
  - - ">="
42
34
  - !ruby/object:Gem::Version
43
- segments:
44
- - 1
45
- - 0
46
- - 0
47
35
  version: 1.0.0
48
36
  type: :development
49
37
  version_requirements: *id002
@@ -55,10 +43,6 @@ dependencies:
55
43
  requirements:
56
44
  - - ">="
57
45
  - !ruby/object:Gem::Version
58
- segments:
59
- - 0
60
- - 0
61
- - 1
62
46
  version: 0.0.1
63
47
  type: :development
64
48
  version_requirements: *id003
@@ -70,10 +54,6 @@ dependencies:
70
54
  requirements:
71
55
  - - ">="
72
56
  - !ruby/object:Gem::Version
73
- segments:
74
- - 1
75
- - 4
76
- - 1
77
57
  version: 1.4.1
78
58
  type: :runtime
79
59
  version_requirements: *id004
@@ -85,10 +65,6 @@ dependencies:
85
65
  requirements:
86
66
  - - ">="
87
67
  - !ruby/object:Gem::Version
88
- segments:
89
- - 1
90
- - 4
91
- - 6
92
68
  version: 1.4.6
93
69
  type: :runtime
94
70
  version_requirements: *id005
@@ -100,10 +76,6 @@ dependencies:
100
76
  requirements:
101
77
  - - ~>
102
78
  - !ruby/object:Gem::Version
103
- segments:
104
- - 0
105
- - 8
106
- - 1
107
79
  version: 0.8.1
108
80
  type: :runtime
109
81
  version_requirements: *id006
@@ -115,14 +87,10 @@ dependencies:
115
87
  requirements:
116
88
  - - ~>
117
89
  - !ruby/object:Gem::Version
118
- segments:
119
- - 0
120
- - 2
121
- - 1
122
90
  version: 0.2.1
123
91
  type: :runtime
124
92
  version_requirements: *id007
125
- description: Easy way to retrieve Google Page Rank, Alexa Rank, and backlink counts
93
+ description: Easy way to retrieve Google Page Rank, Alexa Rank, backlink counts, and index counts.
126
94
  email:
127
95
  - blatyo@gmail.com
128
96
  executables: []
@@ -162,6 +130,7 @@ files:
162
130
  - lib/page_rankr/site.rb
163
131
  - lib/page_rankr/tracker.rb
164
132
  - lib/page_rankr/version.rb
133
+ - spec/edge_cases_spec.rb
165
134
  - spec/page_rankr_spec.rb
166
135
  - spec/spec_helper.rb
167
136
  has_rdoc: true
@@ -178,26 +147,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
178
147
  requirements:
179
148
  - - ">="
180
149
  - !ruby/object:Gem::Version
181
- segments:
182
- - 0
183
150
  version: "0"
184
151
  required_rubygems_version: !ruby/object:Gem::Requirement
185
152
  none: false
186
153
  requirements:
187
154
  - - ">="
188
155
  - !ruby/object:Gem::Version
189
- segments:
190
- - 1
191
- - 3
192
- - 6
193
156
  version: 1.3.6
194
157
  requirements: []
195
158
 
196
159
  rubyforge_project:
197
- rubygems_version: 1.3.7
160
+ rubygems_version: 1.5.2
198
161
  signing_key:
199
162
  specification_version: 3
200
- summary: Easy way to retrieve Google Page Rank, Alexa Rank, and backlink counts
163
+ summary: Easy way to retrieve Google Page Rank, Alexa Rank, backlink counts, and index counts.
201
164
  test_files:
165
+ - spec/edge_cases_spec.rb
202
166
  - spec/page_rankr_spec.rb
203
167
  - spec/spec_helper.rb