alexa 0.1.1 → 0.2.0

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/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
1
  pkg/*
2
2
  *.gem
3
3
  .bundle
4
+ Gemfile.lock
data/alexa.gemspec CHANGED
@@ -23,4 +23,5 @@ Gem::Specification.new do |s|
23
23
 
24
24
  s.add_development_dependency "test-unit"
25
25
  s.add_development_dependency "shoulda"
26
+ s.add_development_dependency "mocha"
26
27
  end
data/lib/alexa/config.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'singleton'
1
+ require "singleton"
2
2
 
3
3
  module Alexa
4
4
  class Config
@@ -12,4 +12,4 @@ module Alexa
12
12
  end
13
13
  Config.instance
14
14
  end
15
- end
15
+ end
@@ -1,55 +1,57 @@
1
1
  module Alexa
2
2
  class UrlInfo
3
+ API_VERSION = "2005-07-11"
3
4
  RESPONSE_GROUP = "Rank,ContactInfo,AdultContent,Speed,Language,Keywords,OwnedDomains,LinksInCount,SiteData,RelatedLinks,RankByCountry,RankByCity,UsageStats"
5
+
4
6
  attr_accessor :host, :response_group, :xml_response,
5
7
  :rank, :data_url, :site_title, :site_description, :language_locale, :language_encoding,
6
8
  :links_in_count, :keywords, :related_links, :speed_median_load_time, :speed_percentile,
7
9
  :rank_by_country, :rank_by_city, :usage_statistics
8
10
 
9
11
  def initialize(options = {})
10
- Alexa.config.access_key_id = options[:access_key_id] || Alexa.config.access_key_id
11
- Alexa.config.secret_access_key = options[:secret_access_key] || Alexa.config.secret_access_key
12
- raise ArgumentError.new("you must specify access_key_id") if Alexa.config.access_key_id.nil?
13
- raise ArgumentError.new("you must specify secret_access_key") if Alexa.config.secret_access_key.nil?
14
- @host = options[:host] or raise ArgumentError.new("you must specify host")
15
- @response_group = options[:response_group] || RESPONSE_GROUP
12
+ Alexa.config.access_key_id = options.fetch(:access_key_id, Alexa.config.access_key_id)
13
+ Alexa.config.secret_access_key = options.fetch(:secret_access_key, Alexa.config.secret_access_key)
14
+ raise ArgumentError.new("You must specify access_key_id") if Alexa.config.access_key_id.nil?
15
+ raise ArgumentError.new("You must specify secret_access_key") if Alexa.config.secret_access_key.nil?
16
+ self.host = options[:host] or raise ArgumentError.new("You must specify host")
17
+ self.response_group = options.fetch(:response_group, RESPONSE_GROUP)
16
18
  end
17
19
 
18
20
  def connect
19
- action = "UrlInfo"
20
- timestamp = Time::now.utc.strftime("%Y-%m-%dT%H:%M:%S.000Z")
21
- signature = generate_signature(Alexa.config.secret_access_key, action, timestamp)
22
- url = generate_url(action, Alexa.config.access_key_id, signature, timestamp, response_group, host)
23
21
  response = Net::HTTP.start(url.host) do |http|
24
22
  http.get url.request_uri
25
23
  end
26
- @xml_response = handle_response(response).body
24
+ self.xml_response = handle_response(response).body
27
25
  end
28
26
 
29
27
  def parse_xml(xml)
30
28
  xml = XmlSimple.xml_in(force_encoding(xml), 'ForceArray' => false)
31
29
  group = response_group.split(',')
32
30
  alexa = xml['Response']['UrlInfoResult']['Alexa']
33
- @rank = alexa['TrafficData']['Rank'].to_i if group.include?('Rank') and !alexa['TrafficData']['Rank'].empty?
34
- @data_url = alexa['TrafficData']['DataUrl']['content'] if group.include?('Rank')
35
- @rank_by_country = alexa['TrafficData']['RankByCountry']['Country'] if group.include?('RankByCountry')
36
- @rank_by_city = alexa['TrafficData']['RankByCity']['City'] if group.include?('RankByCity')
37
- @usage_statistics = alexa['TrafficData']['UsageStatistics']["UsageStatistic"] if group.include?('UsageStats') and !alexa['TrafficData']['UsageStatistics'].nil?
31
+ self.rank = alexa['TrafficData']['Rank'].to_i if group.include?('Rank') and !alexa['TrafficData']['Rank'].empty?
32
+ self.data_url = alexa['TrafficData']['DataUrl']['content'] if group.include?('Rank')
33
+ self.rank_by_country = alexa['TrafficData']['RankByCountry']['Country'] if group.include?('RankByCountry')
34
+ self.rank_by_city = alexa['TrafficData']['RankByCity']['City'] if group.include?('RankByCity')
35
+ self.usage_statistics = alexa['TrafficData']['UsageStatistics']["UsageStatistic"] if group.include?('UsageStats') and !alexa['TrafficData']['UsageStatistics'].nil?
38
36
 
39
- @site_title = alexa['ContentData']['SiteData']['Title'] if group.include?('SiteData')
40
- @site_description = alexa['ContentData']['SiteData']['Description'] if group.include?('SiteData')
41
- @language_locale = alexa['ContentData']['Language']['Locale'] if group.include?('Language')
42
- @language_encoding = alexa['ContentData']['Language']['Encoding'] if group.include?('Language')
43
- @links_in_count = alexa['ContentData']['LinksInCount'].to_i if group.include?('LinksInCount') and !alexa['ContentData']['LinksInCount'].empty?
44
- @keywords = alexa['ContentData']['Keywords']['Keyword'] if group.include?('Keywords')
45
- @speed_median_load_time = alexa['ContentData']['Speed']['MedianLoadTime'].to_i if group.include?('Speed') and !alexa['ContentData']['Speed']['MedianLoadTime'].empty?
46
- @speed_percentile = alexa['ContentData']['Speed']['Percentile'].to_i if group.include?('Speed') and !alexa['ContentData']['Speed']['Percentile'].empty?
37
+ self.site_title = alexa['ContentData']['SiteData']['Title'] if group.include?('SiteData')
38
+ self.site_description = alexa['ContentData']['SiteData']['Description'] if group.include?('SiteData')
39
+ self.language_locale = alexa['ContentData']['Language']['Locale'] if group.include?('Language')
40
+ self.language_encoding = alexa['ContentData']['Language']['Encoding'] if group.include?('Language')
41
+ self.links_in_count = alexa['ContentData']['LinksInCount'].to_i if group.include?('LinksInCount') and !alexa['ContentData']['LinksInCount'].empty?
42
+ self.keywords = alexa['ContentData']['Keywords']['Keyword'] if group.include?('Keywords')
43
+ self.speed_median_load_time = alexa['ContentData']['Speed']['MedianLoadTime'].to_i if group.include?('Speed') and !alexa['ContentData']['Speed']['MedianLoadTime'].empty?
44
+ self.speed_percentile = alexa['ContentData']['Speed']['Percentile'].to_i if group.include?('Speed') and !alexa['ContentData']['Speed']['Percentile'].empty?
47
45
 
48
- @related_links = alexa['Related']['RelatedLinks']['RelatedLink'] if group.include?('RelatedLinks')
46
+ self.related_links = alexa['Related']['RelatedLinks']['RelatedLink'] if group.include?('RelatedLinks')
49
47
  end
50
48
 
51
49
  private
52
50
 
51
+ def timestamp
52
+ @timestamp ||= Time::now.utc.strftime("%Y-%m-%dT%H:%M:%S.000Z")
53
+ end
54
+
53
55
  def force_encoding(xml)
54
56
  if RUBY_VERSION >= '1.9'
55
57
  xml.force_encoding(Encoding::UTF_8)
@@ -66,7 +68,7 @@ module Alexa
66
68
  if response.body.nil?
67
69
  raise StandardError.new(response)
68
70
  else
69
- @xml_response = response.body
71
+ self.xml_response = response.body
70
72
  xml = XmlSimple.xml_in(response.body, 'ForceArray' => false)
71
73
  message = xml['Errors']['Error']['Message']
72
74
  raise StandardError.new(message)
@@ -76,22 +78,22 @@ module Alexa
76
78
  end
77
79
  end
78
80
 
79
- def generate_signature(secret_access_key, action, timestamp)
80
- Base64.encode64( OpenSSL::HMAC.digest( OpenSSL::Digest::Digest.new( "sha1" ), secret_access_key, action + timestamp)).strip
81
+ def signature
82
+ @signature ||= Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new("sha1"), Alexa.config.secret_access_key, "UrlInfo" + timestamp)).strip
81
83
  end
82
84
 
83
- def generate_url(action, access_key_id, signature, timestamp, response_group, host)
84
- url = URI.parse(
85
- "http://awis.amazonaws.com/?" +
86
- {
87
- "Action" => action,
88
- "AWSAccessKeyId" => access_key_id,
89
- "Signature" => signature,
90
- "Timestamp" => timestamp,
91
- "ResponseGroup" => response_group,
92
- "Url" => host
93
- }.to_a.collect{ |item| item.first + "=" + CGI::escape(item.last) }.sort.join("&")
94
- )
85
+ def url
86
+ URI.parse("http://awis.amazonaws.com/?" +
87
+ {
88
+ "Action" => "UrlInfo",
89
+ "AWSAccessKeyId" => Alexa.config.access_key_id,
90
+ "Signature" => signature,
91
+ "Timestamp" => timestamp,
92
+ "ResponseGroup" => response_group,
93
+ "Url" => host,
94
+ "Version" => API_VERSION
95
+ }.map { |key, value| "#{key}=#{CGI::escape(value)}" }.sort.join("&")
96
+ )
95
97
  end
96
98
  end
97
- end
99
+ end
data/lib/alexa/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Alexa
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
data/test/config_test.rb CHANGED
@@ -1,38 +1,36 @@
1
1
  require 'helper'
2
2
 
3
3
  class ConfigTest < Test::Unit::TestCase
4
- context "Config test" do
5
- setup do
6
- # Config is singleton
7
- Alexa.config.access_key_id = nil
8
- Alexa.config.secret_access_key = nil
9
- end
4
+ def setup
5
+ # Config is singleton
6
+ Alexa.config.access_key_id = nil
7
+ Alexa.config.secret_access_key = nil
8
+ end
10
9
 
11
- should "raise argumment error if access key id is not present" do
12
- assert_raise ArgumentError do
13
- Alexa::UrlInfo.new(
14
- :secret_access_key => "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDF",
10
+ should "raise argumment error if access key id is not present" do
11
+ assert_raise ArgumentError do
12
+ Alexa::UrlInfo.new(
13
+ :secret_access_key => "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDF",
15
14
  :host => "some.host"
16
- )
17
- end
15
+ )
18
16
  end
17
+ end
19
18
 
20
- should "raise argumment error if secret access key is not present" do
21
- assert_raise ArgumentError do
22
- Alexa::UrlInfo.new(
23
- :access_key_id => "12345678901234567890",
19
+ should "raise argumment error if secret access key is not present" do
20
+ assert_raise ArgumentError do
21
+ Alexa::UrlInfo.new(
22
+ :access_key_id => "12345678901234567890",
24
23
  :host => "some.host"
25
- )
26
- end
24
+ )
27
25
  end
26
+ end
28
27
 
29
- should "raise argumment error if host is not present" do
30
- assert_raise ArgumentError do
31
- Alexa::UrlInfo.new(
32
- :access_key_id => "12345678901234567890",
33
- :secret_access_key => "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDF"
34
- )
35
- end
28
+ should "raise argumment error if host is not present" do
29
+ assert_raise ArgumentError do
30
+ Alexa::UrlInfo.new(
31
+ :access_key_id => "12345678901234567890",
32
+ :secret_access_key => "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDF"
33
+ )
36
34
  end
37
35
  end
38
- end
36
+ end
data/test/helper.rb CHANGED
@@ -1,14 +1,14 @@
1
- Bundler.require
1
+ Bundler.setup
2
2
  require "test/unit"
3
+ require "mocha"
3
4
  require "shoulda"
4
5
 
5
6
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
7
  $LOAD_PATH.unshift(File.dirname(__FILE__))
7
- require 'alexa'
8
+ require "alexa"
8
9
 
9
10
  class Test::Unit::TestCase
10
11
  def fixture_file(filename)
11
- return '' if filename == ''
12
12
  file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/' + filename)
13
13
  File.read(file_path)
14
14
  end
@@ -1,195 +1,188 @@
1
- require 'helper'
1
+ require "helper"
2
2
 
3
3
  class UrlInfoTest < Test::Unit::TestCase
4
- context "Alexa::UrlInfo" do
4
+ def setup
5
+ @alexa = Alexa::UrlInfo.new(
6
+ :access_key_id => "12345678901234567890",
7
+ :secret_access_key => "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDF",
8
+ :host => "some.host"
9
+ )
10
+ end
11
+
12
+ should "Generate signature" do
13
+ @alexa.stubs(:timestamp).returns("2009-07-03T07:22:24.000Z")
14
+ assert_equal "I1mPdBy+flhhzqqUaamNq9gq190=", @alexa.send(:signature)
15
+ end
16
+
17
+ should "Generate url" do
18
+ @alexa.stubs(:timestamp).returns("2009-07-03T07:22:24.000Z")
19
+ @alexa.response_group = "Rank,ContactInfo,AdultContent,Speed,Language,Keywords,OwnedDomains,LinksInCount,SiteData,RelatedLinks"
20
+ @alexa.host = "heroku.com"
21
+ expected_uri = "/?AWSAccessKeyId=12345678901234567890&Action=UrlInfo&ResponseGroup=Rank%2CContactInfo%2CAdultContent%2CSpeed%2CLanguage%2CKeywords%2COwnedDomains%2CLinksInCount%2CSiteData%2CRelatedLinks&Signature=I1mPdBy%2BflhhzqqUaamNq9gq190%3D&Timestamp=2009-07-03T07%3A22%3A24.000Z&Url=heroku.com&Version=2005-07-11"
22
+ assert_equal expected_uri, @alexa.send(:url).request_uri
23
+ assert_equal "awis.amazonaws.com", @alexa.send(:url).host
24
+ end
25
+
26
+ context "should parse xml return by options LinksInCount,SiteData" do
5
27
  setup do
6
- @alexa = Alexa::UrlInfo.new(
7
- :access_key_id => "12345678901234567890",
8
- :secret_access_key => "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDF",
9
- :host => "some.host"
10
- )
11
- end
12
-
13
- should "Generate signature" do
14
- signature = @alexa.send :generate_signature, Alexa.config.secret_access_key, "UrlInfo", '2009-07-03T07:22:24.000Z'
15
- assert_equal "I1mPdBy+flhhzqqUaamNq9gq190=", signature
16
- end
17
-
18
- should "Generate url" do
19
- url = @alexa.send(:generate_url,
20
- "UrlInfo",
21
- Alexa.config.access_key_id,
22
- "I1mPdBy+flhhzqqUaamNq9gq190=",
23
- '2009-07-03T07:22:24.000Z',
24
- "Rank,ContactInfo,AdultContent,Speed,Language,Keywords,OwnedDomains,LinksInCount,SiteData,RelatedLinks",
25
- "heroku.com"
26
- )
27
- expected_uri = "/?AWSAccessKeyId=12345678901234567890&Action=UrlInfo&ResponseGroup=Rank%2CContactInfo%2CAdultContent%2CSpeed%2CLanguage%2CKeywords%2COwnedDomains%2CLinksInCount%2CSiteData%2CRelatedLinks&Signature=I1mPdBy%2BflhhzqqUaamNq9gq190%3D&Timestamp=2009-07-03T07%3A22%3A24.000Z&Url=heroku.com"
28
- assert_equal expected_uri, url.request_uri
29
- assert_equal "awis.amazonaws.com", url.host
30
- end
31
-
32
- context "should parse xml return by options LinksInCount,SiteData and" do
33
- setup do
34
- @alexa.response_group = "Rank,LinksInCount,SiteData"
35
- xml = fixture_file('polsl_small.xml')
36
- @alexa.parse_xml(xml)
37
- end
28
+ @alexa.response_group = "Rank,LinksInCount,SiteData"
29
+ xml = fixture_file('polsl_small.xml')
30
+ @alexa.parse_xml(xml)
31
+ end
38
32
 
39
- should "return rank" do
40
- assert_equal 86020, @alexa.rank
41
- end
33
+ should "return rank" do
34
+ assert_equal 86020, @alexa.rank
35
+ end
42
36
 
43
- should "return data url" do
44
- assert_equal "polsl.pl/", @alexa.data_url
45
- end
37
+ should "return data url" do
38
+ assert_equal "polsl.pl/", @alexa.data_url
39
+ end
46
40
 
47
- should "return site title" do
48
- assert_equal "Silesian University of Technology", @alexa.site_title
49
- end
41
+ should "return site title" do
42
+ assert_equal "Silesian University of Technology", @alexa.site_title
43
+ end
50
44
 
51
- should "return site description" do
52
- assert_equal "About the university, studies, faculties and departments, photo gallery.", @alexa.site_description
53
- end
45
+ should "return site description" do
46
+ assert_equal "About the university, studies, faculties and departments, photo gallery.", @alexa.site_description
47
+ end
54
48
 
55
- should "not crash" do
56
- assert_nothing_raised do
57
- @alexa.language_locale
58
- end
59
- assert_nil @alexa.language_locale
49
+ should "not crash" do
50
+ assert_nothing_raised do
51
+ @alexa.language_locale
60
52
  end
53
+ assert_nil @alexa.language_locale
61
54
  end
55
+ end
62
56
 
63
- context "should parse xml with all options and" do
64
- setup do
65
- xml = fixture_file('polsl.xml')
66
- @alexa.parse_xml(xml)
67
- end
57
+ context "should parse xml with all options" do
58
+ setup do
59
+ xml = fixture_file('polsl.xml')
60
+ @alexa.parse_xml(xml)
61
+ end
68
62
 
69
- should "return rank" do
70
- assert_equal 86020, @alexa.rank
71
- end
63
+ should "return rank" do
64
+ assert_equal 86020, @alexa.rank
65
+ end
72
66
 
73
- should "return data url" do
74
- assert_equal "polsl.pl", @alexa.data_url
75
- end
67
+ should "return data url" do
68
+ assert_equal "polsl.pl", @alexa.data_url
69
+ end
76
70
 
77
- should "return site title" do
78
- assert_equal "Silesian University of Technology", @alexa.site_title
79
- end
71
+ should "return site title" do
72
+ assert_equal "Silesian University of Technology", @alexa.site_title
73
+ end
80
74
 
81
- should "return site description" do
82
- assert_equal "About the university, studies, faculties and departments, photo gallery.", @alexa.site_description
83
- end
75
+ should "return site description" do
76
+ assert_equal "About the university, studies, faculties and departments, photo gallery.", @alexa.site_description
77
+ end
84
78
 
85
- should "return language locale" do
86
- assert_equal "pl-PL", @alexa.language_locale
87
- end
79
+ should "return language locale" do
80
+ assert_equal "pl-PL", @alexa.language_locale
81
+ end
88
82
 
89
- should "return language encoding" do
90
- assert_equal "iso-8859-2", @alexa.language_encoding
91
- end
83
+ should "return language encoding" do
84
+ assert_equal "iso-8859-2", @alexa.language_encoding
85
+ end
92
86
 
93
- should "return links in count" do
94
- assert_equal 281, @alexa.links_in_count
95
- end
87
+ should "return links in count" do
88
+ assert_equal 281, @alexa.links_in_count
89
+ end
96
90
 
97
- should "return keywords" do
98
- assert_equal ["Polska", "Regionalne", "Gliwice"], @alexa.keywords
99
- end
91
+ should "return keywords" do
92
+ assert_equal ["Polska", "Regionalne", "Gliwice"], @alexa.keywords
93
+ end
100
94
 
101
- should "return related links" do
102
- assert_equal 10, @alexa.related_links.size
103
- end
95
+ should "return related links" do
96
+ assert_equal 10, @alexa.related_links.size
97
+ end
104
98
 
105
- should "return speed_median load time" do
106
- assert_equal 266, @alexa.speed_median_load_time
107
- end
99
+ should "return speed_median load time" do
100
+ assert_equal 266, @alexa.speed_median_load_time
101
+ end
108
102
 
109
- should "return speed percentile" do
110
- assert_equal 98, @alexa.speed_percentile
111
- end
103
+ should "return speed percentile" do
104
+ assert_equal 98, @alexa.speed_percentile
105
+ end
112
106
 
113
- should "return rank by country" do
114
- assert_equal 3, @alexa.rank_by_country.size
115
- end
107
+ should "return rank by country" do
108
+ assert_equal 3, @alexa.rank_by_country.size
109
+ end
116
110
 
117
- should "return rank by city" do
118
- assert_equal 68, @alexa.rank_by_city.size
119
- end
111
+ should "return rank by city" do
112
+ assert_equal 68, @alexa.rank_by_city.size
113
+ end
120
114
 
121
- should "return usage statistics" do
122
- assert_equal 4, @alexa.usage_statistics.size
123
- end
115
+ should "return usage statistics" do
116
+ assert_equal 4, @alexa.usage_statistics.size
124
117
  end
118
+ end
125
119
 
126
- context "should not crash when parsing empty xml response and" do
127
- setup do
128
- xml = fixture_file('empty.xml')
129
- @alexa.parse_xml(xml)
130
- end
120
+ context "should not crash when parsing empty xml response" do
121
+ setup do
122
+ xml = fixture_file('empty.xml')
123
+ @alexa.parse_xml(xml)
124
+ end
131
125
 
132
- should "return nil from rank" do
133
- assert_nil @alexa.rank
134
- end
126
+ should "return nil from rank" do
127
+ assert_nil @alexa.rank
128
+ end
135
129
 
136
- should "return nil from data_url" do
137
- assert_equal "404", @alexa.data_url
138
- end
130
+ should "return nil from data_url" do
131
+ assert_equal "404", @alexa.data_url
132
+ end
139
133
 
140
- should "return nil from site_title" do
141
- assert_equal "404", @alexa.site_title
142
- end
134
+ should "return nil from site_title" do
135
+ assert_equal "404", @alexa.site_title
136
+ end
143
137
 
144
- should "return nil from site_description" do
145
- assert_nil @alexa.site_description
146
- end
138
+ should "return nil from site_description" do
139
+ assert_nil @alexa.site_description
140
+ end
147
141
 
148
- should "return nil from language_locale" do
149
- assert_nil @alexa.language_locale
150
- end
142
+ should "return nil from language_locale" do
143
+ assert_nil @alexa.language_locale
144
+ end
151
145
 
152
- should "return nil from language_encoding" do
153
- assert_nil @alexa.language_encoding
154
- end
146
+ should "return nil from language_encoding" do
147
+ assert_nil @alexa.language_encoding
148
+ end
155
149
 
156
- should "return nil from links_in_count" do
157
- assert_nil @alexa.links_in_count
158
- end
150
+ should "return nil from links_in_count" do
151
+ assert_nil @alexa.links_in_count
152
+ end
159
153
 
160
- should "return nil from keywords" do
161
- assert_nil @alexa.keywords
162
- end
154
+ should "return nil from keywords" do
155
+ assert_nil @alexa.keywords
156
+ end
163
157
 
164
- should "return nil from related_links" do
165
- assert_nil @alexa.related_links
166
- end
158
+ should "return nil from related_links" do
159
+ assert_nil @alexa.related_links
160
+ end
167
161
 
168
- should "return nil from speed_median_load_time" do
169
- assert_nil @alexa.speed_median_load_time
170
- end
162
+ should "return nil from speed_median_load_time" do
163
+ assert_nil @alexa.speed_median_load_time
164
+ end
171
165
 
172
- should "return nil from speed_percentile" do
173
- assert_nil @alexa.speed_percentile
174
- end
166
+ should "return nil from speed_percentile" do
167
+ assert_nil @alexa.speed_percentile
168
+ end
175
169
 
176
- should "return nil from rank_by_country" do
177
- assert_nil @alexa.rank_by_country
178
- end
170
+ should "return nil from rank_by_country" do
171
+ assert_nil @alexa.rank_by_country
172
+ end
179
173
 
180
- should "return nil from rank_by_city" do
181
- assert_nil @alexa.rank_by_city
182
- end
174
+ should "return nil from rank_by_city" do
175
+ assert_nil @alexa.rank_by_city
176
+ end
183
177
 
184
- should "return nil from usage_statistics" do
185
- assert_nil @alexa.usage_statistics
186
- end
178
+ should "return nil from usage_statistics" do
179
+ assert_nil @alexa.usage_statistics
187
180
  end
181
+ end
188
182
 
189
- should "not raise error when response is OK" do
190
- assert_nothing_raised do
191
- @alexa.send :handle_response, Net::HTTPOK.new("1.1", "200", "OK")
192
- end
183
+ should "not raise error when response is OK" do
184
+ assert_nothing_raised do
185
+ @alexa.send :handle_response, Net::HTTPOK.new("1.1", "200", "OK")
193
186
  end
194
187
  end
195
188
  end
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alexa
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 1
8
- - 1
9
- version: 0.1.1
4
+ prerelease:
5
+ version: 0.2.0
10
6
  platform: ruby
11
7
  authors:
12
8
  - "Wojciech Wn\xC4\x99trzak"
@@ -14,8 +10,7 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2010-11-15 00:00:00 +01:00
18
- default_executable:
13
+ date: 2011-05-04 00:00:00 Z
19
14
  dependencies:
20
15
  - !ruby/object:Gem::Dependency
21
16
  name: xml-simple
@@ -24,8 +19,6 @@ dependencies:
24
19
  requirements:
25
20
  - - ">="
26
21
  - !ruby/object:Gem::Version
27
- segments:
28
- - 0
29
22
  version: "0"
30
23
  type: :runtime
31
24
  prerelease: false
@@ -37,8 +30,6 @@ dependencies:
37
30
  requirements:
38
31
  - - ">="
39
32
  - !ruby/object:Gem::Version
40
- segments:
41
- - 0
42
33
  version: "0"
43
34
  type: :development
44
35
  prerelease: false
@@ -50,12 +41,21 @@ dependencies:
50
41
  requirements:
51
42
  - - ">="
52
43
  - !ruby/object:Gem::Version
53
- segments:
54
- - 0
55
44
  version: "0"
56
45
  type: :development
57
46
  prerelease: false
58
47
  version_requirements: *id003
48
+ - !ruby/object:Gem::Dependency
49
+ name: mocha
50
+ requirement: &id004 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: "0"
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: *id004
59
59
  description: Alexa Web Information Service library (AWIS)
60
60
  email:
61
61
  - w.wnetrzak@gmail.com
@@ -68,7 +68,6 @@ extra_rdoc_files: []
68
68
  files:
69
69
  - .gitignore
70
70
  - Gemfile
71
- - Gemfile.lock
72
71
  - LICENSE
73
72
  - README.rdoc
74
73
  - Rakefile
@@ -83,7 +82,6 @@ files:
83
82
  - test/fixtures/polsl_small.xml
84
83
  - test/helper.rb
85
84
  - test/url_info_test.rb
86
- has_rdoc: true
87
85
  homepage: https://github.com/morgoth/alexa
88
86
  licenses: []
89
87
 
@@ -97,7 +95,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
97
95
  requirements:
98
96
  - - ">="
99
97
  - !ruby/object:Gem::Version
100
- hash: 3607547385087715805
98
+ hash: -201747439707847299
101
99
  segments:
102
100
  - 0
103
101
  version: "0"
@@ -106,14 +104,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
104
  requirements:
107
105
  - - ">="
108
106
  - !ruby/object:Gem::Version
109
- hash: 3607547385087715805
107
+ hash: -201747439707847299
110
108
  segments:
111
109
  - 0
112
110
  version: "0"
113
111
  requirements: []
114
112
 
115
113
  rubyforge_project: alexa
116
- rubygems_version: 1.3.7
114
+ rubygems_version: 1.7.2
117
115
  signing_key:
118
116
  specification_version: 3
119
117
  summary: Alexa Web Information Service library
data/Gemfile.lock DELETED
@@ -1,23 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- alexa (0.1.1)
5
- xml-simple
6
-
7
- GEM
8
- remote: http://rubygems.org/
9
- specs:
10
- rake (0.8.7)
11
- shoulda (2.11.3)
12
- test-unit (2.1.1)
13
- xml-simple (1.0.12)
14
-
15
- PLATFORMS
16
- ruby
17
-
18
- DEPENDENCIES
19
- alexa!
20
- rake
21
- shoulda
22
- test-unit
23
- xml-simple