awis-wrapper 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,6 +1,7 @@
1
1
  source "http://rubygems.org"
2
2
 
3
3
  gem 'nokogiri'
4
+ gem 'extlib'
4
5
 
5
6
  group :development do
6
7
  gem "rspec"
@@ -2,6 +2,7 @@ GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
4
  diff-lcs (1.2.1)
5
+ extlib (0.9.16)
5
6
  fakeweb (1.3.0)
6
7
  git (1.2.5)
7
8
  jeweler (1.8.4)
@@ -33,6 +34,7 @@ PLATFORMS
33
34
 
34
35
  DEPENDENCIES
35
36
  bundler
37
+ extlib
36
38
  fakeweb
37
39
  jeweler (~> 1.8.4)
38
40
  nokogiri
@@ -0,0 +1,53 @@
1
+ #awis-wrapper
2
+
3
+ This is the wrapper for AWIS service, this thought derive from Ishango2 project.
4
+
5
+ ##Usage
6
+
7
+ ```ruby
8
+ Amazon::Awis.options = {:aws_access_key_id => "123", :aws_secret_key => "456", :action => "UrlInfo", :responsegroup => "RankByCountry"}
9
+
10
+ #Or with one block
11
+ Amazon::Awis.configure do |options|
12
+ # options[:aws_access_key_id] = [your access key]
13
+ # options[:aws_secret_key] = [you secret key]
14
+ options[:responsegroup] = 'Rank'
15
+ end
16
+
17
+ #Call get_info method to get single website info
18
+ res = Amazon::Awis.get_info('yahoo.com')
19
+ if res.success?
20
+ all_countries = res.get_all('country')
21
+ all_countries.each do |c|
22
+ c.contribution.first.users.first #navigate into the children tree. the accociations always return Array, so note the 'first' method.
23
+ end
24
+ end
25
+
26
+ #Or get multiple websites info with batch request
27
+ res = Amazon::Awis.get_info(]'yahoo.com', 'cnn.com')
28
+ if res.success?
29
+ res.get_all('response') # get all repsonse items in the document, then you can iterate all the response data with each "aws:Response"
30
+ element = res.get('response') # this would get only one(the first) item in the document
31
+ element.get_all_child('country') # all "aws:Country" items searched from current element. return Element class.
32
+ #or directly access
33
+ element.operation_request.first.request_id # would convert to camel case automaticly
34
+ # to access the attribute
35
+ element['Code'] == "US"
36
+ end
37
+ ```
38
+
39
+ ## Contributing to awis-wrapper
40
+
41
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
42
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
43
+ * Fork the project.
44
+ * Start a feature/bugfix branch.
45
+ * Commit and push until you are happy with your contribution.
46
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
47
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
48
+
49
+ ## Copyright
50
+
51
+ Copyright (c) 2013 Vincent.Z. See LICENSE.txt for
52
+ further details.
53
+
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -5,16 +5,16 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "awis-wrapper"
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Vincent.Z"]
12
- s.date = "2013-03-14"
12
+ s.date = "2013-03-15"
13
13
  s.description = "Easy to use, to navigate around the response"
14
14
  s.email = "zhu1230@gmail.com"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
17
- "README.rdoc"
17
+ "README.md"
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
@@ -22,13 +22,14 @@ Gem::Specification.new do |s|
22
22
  "Gemfile",
23
23
  "Gemfile.lock",
24
24
  "LICENSE.txt",
25
- "README.rdoc",
25
+ "README.md",
26
26
  "Rakefile",
27
27
  "VERSION",
28
28
  "awis-wrapper.gemspec",
29
29
  "lib/awis-wrapper.rb",
30
30
  "spec/awis-wrapper_spec.rb",
31
31
  "spec/fixtures/bad_request.xml",
32
+ "spec/fixtures/batch_info.xml",
32
33
  "spec/fixtures/url_info.xml",
33
34
  "spec/fixtures/wrong_request.xml",
34
35
  "spec/fixtures/wrong_response.xml",
@@ -45,6 +46,7 @@ Gem::Specification.new do |s|
45
46
 
46
47
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
47
48
  s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
49
+ s.add_runtime_dependency(%q<extlib>, [">= 0"])
48
50
  s.add_development_dependency(%q<rspec>, [">= 0"])
49
51
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
50
52
  s.add_development_dependency(%q<bundler>, [">= 0"])
@@ -53,6 +55,7 @@ Gem::Specification.new do |s|
53
55
  s.add_development_dependency(%q<fakeweb>, [">= 0"])
54
56
  else
55
57
  s.add_dependency(%q<nokogiri>, [">= 0"])
58
+ s.add_dependency(%q<extlib>, [">= 0"])
56
59
  s.add_dependency(%q<rspec>, [">= 0"])
57
60
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
58
61
  s.add_dependency(%q<bundler>, [">= 0"])
@@ -62,6 +65,7 @@ Gem::Specification.new do |s|
62
65
  end
63
66
  else
64
67
  s.add_dependency(%q<nokogiri>, [">= 0"])
68
+ s.add_dependency(%q<extlib>, [">= 0"])
65
69
  s.add_dependency(%q<rspec>, [">= 0"])
66
70
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
67
71
  s.add_dependency(%q<bundler>, [">= 0"])
@@ -29,6 +29,7 @@ require "uri"
29
29
  require "net/https"
30
30
  require "time"
31
31
  require "nokogiri"
32
+ require "extlib"
32
33
 
33
34
  module Amazon
34
35
 
@@ -80,7 +81,19 @@ module Amazon
80
81
  end
81
82
  log "Response text: #{res.body}"
82
83
  Response.new(res.body)
83
- end
84
+ end
85
+
86
+ def self.get_batch_info(domains)
87
+ url = self.batch_urls(domains)
88
+ log "Request URL: #{url}"
89
+ res = Net::HTTP.get_response(url)
90
+ unless res.kind_of? Net::HTTPSuccess
91
+ raise Amazon::RequestError, "HTTP Response: #{res.code} #{res.message} #{res.body}"
92
+ end
93
+ log "Response text: #{res.body}"
94
+ Response.new(res.body)
95
+ end
96
+
84
97
 
85
98
  # Response object returned after a REST call to Amazon service.
86
99
  class Response
@@ -93,31 +106,27 @@ module Amazon
93
106
  def doc
94
107
  @doc
95
108
  end
96
-
97
- def test
98
- @doc.xpath("//aws:Country", {:aws => "http://awis.amazonaws.com/doc/2005-07-11"})
99
- end
100
109
 
101
110
  def xpath(path)
102
111
  @doc.xpath(path, @namesapce)
103
112
  end
104
113
 
105
114
  def get(tag)
106
- Element.new @doc.at_xpath("//aws:#{tag.capitalize}", @namespace)
115
+ Element.new @doc.at_xpath("//aws:#{tag.camel_case}", @namespace)
107
116
  end
108
117
 
109
118
  def get_all(tag)
110
- @doc.xpath("//aws:#{tag.capitalize}", @namespace).collect{|data|Element.new data}
119
+ @doc.xpath("//aws:#{tag.camel_case}", @namespace).collect{|data|Element.new data}
111
120
  end
112
121
 
113
122
  # Return error code
114
123
  def error
115
- @doc.xpath("//aws:StatusMessage").first.content
124
+ @doc.at_xpath("//aws:StatusMessage").content
116
125
  end
117
126
 
118
127
  # Return error message.
119
128
  def success?
120
- (@doc.xpath "//aws:StatusCode").first.content == "Success"
129
+ (@doc.at_xpath "//aws:StatusCode").content == "Success"
121
130
  end
122
131
 
123
132
  #returns inner html of any tag in awis response i.e resp.rank => 3
@@ -133,8 +142,23 @@ module Amazon
133
142
  @node = arg
134
143
  end
135
144
 
145
+ def [](key)
146
+ @node[key.to_s]
147
+ end
148
+
149
+ def get_all_child(str)
150
+ result = @node.xpath(".//aws:#{str.to_s.camel_case}", Awis::NAMESPACE)
151
+ if result
152
+ result.collect do |r|
153
+ Element.new r
154
+ end
155
+ else
156
+ result
157
+ end
158
+ end
159
+
136
160
  def method_missing(methodId)
137
- result = @node.xpath(".//aws:#{methodId.capitalize}", Awis::NAMESPACE)
161
+ result = @node.xpath("./aws:#{methodId.to_s.camel_case}", Awis::NAMESPACE)
138
162
  if result
139
163
  result.collect do |r|
140
164
  Element.new r
@@ -168,7 +192,7 @@ module Amazon
168
192
 
169
193
  # Converts a hash into a query string (e.g. {a => 1, b => 2} becomes "a=1&b=2")
170
194
  def self.escape_query(query)
171
- query.to_a.collect { |item| item.first + '=' + CGI::escape(item.last.to_s) }.join('&')
195
+ query.sort.map{|k,v| k + "=" + URI.escape(v.to_s, /[^A-Za-z0-9\-_.~]/)}.join('&')
172
196
  end
173
197
 
174
198
  def self.prepare_url(domain)
@@ -188,7 +212,35 @@ module Amazon
188
212
  'sha1', self.options[:aws_secret_key],
189
213
  "GET\n#{awis_domain}\n/\n" + escape_query(query).strip)).chomp
190
214
  })))
191
- end
215
+ end
216
+
217
+ def self.batch_urls(urls)
218
+ raise Amazon::RequestError, "Awis batch request cannot be > 5" unless urls.length < 6
219
+
220
+ # timestamp = ( Time::now ).utc.strftime("%Y-%m-%dT%H:%M:%S.000Z")
221
+ awis_domain = Amazon::Awis::AWIS_DOMAIN
222
+
223
+ batch_query = {
224
+ "Action" => self.options[:action],
225
+ "AWSAccessKeyId" => self.options[:aws_access_key_id],
226
+ "Timestamp" => Time.now.utc.iso8601,
227
+ "#{self.options[:action]}.Shared.ResponseGroup" => self.options[:responsegroup],
228
+ "SignatureVersion" => 2,
229
+ "SignatureMethod" => "HmacSHA1"
230
+ }
231
+
232
+ urls.each_with_index do |url,i|
233
+ batch_query["#{self.options[:action]}.#{i+1}.Url"] = url
234
+ end
235
+ signature = Base64.encode64( OpenSSL::HMAC.digest( OpenSSL::Digest::Digest.new( "sha1" ),
236
+ self.options[:aws_secret_key], "GET\n#{awis_domain}\n/\n" + escape_query(batch_query))).strip
237
+ query_str = batch_query.merge({'Signature' => signature})
238
+ url = "http://#{awis_domain}/?#{escape_query(query_str)}"
239
+ URI.parse url
240
+ end
241
+
192
242
  end
193
243
 
194
- end
244
+
245
+
246
+ end
@@ -53,4 +53,16 @@ describe "AwisWrapper" do
53
53
  end
54
54
  end
55
55
 
56
+ context "with batch query" do
57
+
58
+ let(:batch_request) { IO.read(Pathname.new(File.expand_path(File.dirname(__FILE__))).join('fixtures', 'batch_info.xml')) }
59
+ it "return multiple datasets" do
60
+ FakeWeb.register_uri(:get, %r{http://#{Amazon::Awis::AWIS_DOMAIN}/?.*}, body: batch_request)
61
+ responses = Amazon::Awis::get_info(['yahoo.com', 'cnn.com'])
62
+ responses.get_all('response').size.should == 2
63
+ responses.get_all('response')[0].get_all_child('country').size.should == 34
64
+ responses.get_all('response')[1].url_info_result.first.alexa.should_not be_empty
65
+ end
66
+ end
67
+
56
68
  end
@@ -0,0 +1,408 @@
1
+ <?xml version="1.0"?>
2
+ <aws:UrlInfoResponse xmlns:aws="http://alexa.amazonaws.com/doc/2005-10-05/">
3
+ <aws:Response xmlns:aws="http://awis.amazonaws.com/doc/2005-07-11">
4
+ <aws:OperationRequest>
5
+ <aws:RequestId>441b56e0-a3ca-65e4-c370-5d8400ae320c</aws:RequestId>
6
+ </aws:OperationRequest>
7
+ <aws:UrlInfoResult>
8
+ <aws:Alexa>
9
+ <aws:TrafficData>
10
+ <aws:DataUrl type="canonical">yahoo.com/</aws:DataUrl>
11
+ <aws:RankByCountry>
12
+ <aws:Country Code="US">
13
+ <aws:Rank>4</aws:Rank>
14
+ <aws:Contribution>
15
+ <aws:PageViews>35.4%</aws:PageViews>
16
+ <aws:Users>33.2%</aws:Users>
17
+ </aws:Contribution>
18
+ </aws:Country>
19
+ <aws:Country Code="IN">
20
+ <aws:Rank>5</aws:Rank>
21
+ <aws:Contribution>
22
+ <aws:PageViews>10.3%</aws:PageViews>
23
+ <aws:Users>8.9%</aws:Users>
24
+ </aws:Contribution>
25
+ </aws:Country>
26
+ <aws:Country Code="TW">
27
+ <aws:Rank>1</aws:Rank>
28
+ <aws:Contribution>
29
+ <aws:PageViews>10.9%</aws:PageViews>
30
+ <aws:Users>3.8%</aws:Users>
31
+ </aws:Contribution>
32
+ </aws:Country>
33
+ <aws:Country Code="GB">
34
+ <aws:Rank>8</aws:Rank>
35
+ <aws:Contribution>
36
+ <aws:PageViews>2.5%</aws:PageViews>
37
+ <aws:Users>3.2%</aws:Users>
38
+ </aws:Contribution>
39
+ </aws:Country>
40
+ <aws:Country Code="IR">
41
+ <aws:Rank>2</aws:Rank>
42
+ <aws:Contribution>
43
+ <aws:PageViews>2.8%</aws:PageViews>
44
+ <aws:Users>3.2%</aws:Users>
45
+ </aws:Contribution>
46
+ </aws:Country>
47
+ <aws:Country Code="BR">
48
+ <aws:Rank>9</aws:Rank>
49
+ <aws:Contribution>
50
+ <aws:PageViews>2.0%</aws:PageViews>
51
+ <aws:Users>2.9%</aws:Users>
52
+ </aws:Contribution>
53
+ </aws:Country>
54
+ <aws:Country Code="ID">
55
+ <aws:Rank>6</aws:Rank>
56
+ <aws:Contribution>
57
+ <aws:PageViews>2.8%</aws:PageViews>
58
+ <aws:Users>2.8%</aws:Users>
59
+ </aws:Contribution>
60
+ </aws:Country>
61
+ <aws:Country Code="MX">
62
+ <aws:Rank>6</aws:Rank>
63
+ <aws:Contribution>
64
+ <aws:PageViews>2.1%</aws:PageViews>
65
+ <aws:Users>2.3%</aws:Users>
66
+ </aws:Contribution>
67
+ </aws:Country>
68
+ <aws:Country Code="CN">
69
+ <aws:Rank>37</aws:Rank>
70
+ <aws:Contribution>
71
+ <aws:PageViews>1.5%</aws:PageViews>
72
+ <aws:Users>2.2%</aws:Users>
73
+ </aws:Contribution>
74
+ </aws:Country>
75
+ <aws:Country Code="CA">
76
+ <aws:Rank>5</aws:Rank>
77
+ <aws:Contribution>
78
+ <aws:PageViews>2.1%</aws:PageViews>
79
+ <aws:Users>2.1%</aws:Users>
80
+ </aws:Contribution>
81
+ </aws:Country>
82
+ <aws:Country Code="IT">
83
+ <aws:Rank>6</aws:Rank>
84
+ <aws:Contribution>
85
+ <aws:PageViews>1.2%</aws:PageViews>
86
+ <aws:Users>2.0%</aws:Users>
87
+ </aws:Contribution>
88
+ </aws:Country>
89
+ <aws:Country Code="FR">
90
+ <aws:Rank>10</aws:Rank>
91
+ <aws:Contribution>
92
+ <aws:PageViews>1.4%</aws:PageViews>
93
+ <aws:Users>1.9%</aws:Users>
94
+ </aws:Contribution>
95
+ </aws:Country>
96
+ <aws:Country Code="DE">
97
+ <aws:Rank>10</aws:Rank>
98
+ <aws:Contribution>
99
+ <aws:PageViews>1.1%</aws:PageViews>
100
+ <aws:Users>1.7%</aws:Users>
101
+ </aws:Contribution>
102
+ </aws:Country>
103
+ <aws:Country Code="NG">
104
+ <aws:Rank>4</aws:Rank>
105
+ <aws:Contribution>
106
+ <aws:PageViews>1.5%</aws:PageViews>
107
+ <aws:Users>1.5%</aws:Users>
108
+ </aws:Contribution>
109
+ </aws:Country>
110
+ <aws:Country Code="ES">
111
+ <aws:Rank>7</aws:Rank>
112
+ <aws:Contribution>
113
+ <aws:PageViews>0.9%</aws:PageViews>
114
+ <aws:Users>1.5%</aws:Users>
115
+ </aws:Contribution>
116
+ </aws:Country>
117
+ <aws:Country Code="PH">
118
+ <aws:Rank>5</aws:Rank>
119
+ <aws:Contribution>
120
+ <aws:PageViews>1.4%</aws:PageViews>
121
+ <aws:Users>1.2%</aws:Users>
122
+ </aws:Contribution>
123
+ </aws:Country>
124
+ <aws:Country Code="PK">
125
+ <aws:Rank>4</aws:Rank>
126
+ <aws:Contribution>
127
+ <aws:PageViews>1.0%</aws:PageViews>
128
+ <aws:Users>1.2%</aws:Users>
129
+ </aws:Contribution>
130
+ </aws:Country>
131
+ <aws:Country Code="AU">
132
+ <aws:Rank>5</aws:Rank>
133
+ <aws:Contribution>
134
+ <aws:PageViews>0.8%</aws:PageViews>
135
+ <aws:Users>1.1%</aws:Users>
136
+ </aws:Contribution>
137
+ </aws:Country>
138
+ <aws:Country Code="EG">
139
+ <aws:Rank>5</aws:Rank>
140
+ <aws:Contribution>
141
+ <aws:PageViews>0.7%</aws:PageViews>
142
+ <aws:Users>1.0%</aws:Users>
143
+ </aws:Contribution>
144
+ </aws:Country>
145
+ <aws:Country Code="RO">
146
+ <aws:Rank>5</aws:Rank>
147
+ <aws:Contribution>
148
+ <aws:PageViews>0.7%</aws:PageViews>
149
+ <aws:Users>1.0%</aws:Users>
150
+ </aws:Contribution>
151
+ </aws:Country>
152
+ <aws:Country Code="MY">
153
+ <aws:Rank>6</aws:Rank>
154
+ <aws:Contribution>
155
+ <aws:PageViews>0.7%</aws:PageViews>
156
+ <aws:Users>0.9%</aws:Users>
157
+ </aws:Contribution>
158
+ </aws:Country>
159
+ <aws:Country Code="AR">
160
+ <aws:Rank>7</aws:Rank>
161
+ <aws:Contribution>
162
+ <aws:PageViews>0.6%</aws:PageViews>
163
+ <aws:Users>0.9%</aws:Users>
164
+ </aws:Contribution>
165
+ </aws:Country>
166
+ <aws:Country Code="HK">
167
+ <aws:Rank>4</aws:Rank>
168
+ <aws:Contribution>
169
+ <aws:PageViews>1.6%</aws:PageViews>
170
+ <aws:Users>0.8%</aws:Users>
171
+ </aws:Contribution>
172
+ </aws:Country>
173
+ <aws:Country Code="TH">
174
+ <aws:Rank>6</aws:Rank>
175
+ <aws:Contribution>
176
+ <aws:PageViews>0.6%</aws:PageViews>
177
+ <aws:Users>0.7%</aws:Users>
178
+ </aws:Contribution>
179
+ </aws:Country>
180
+ <aws:Country Code="SA">
181
+ <aws:Rank>6</aws:Rank>
182
+ <aws:Contribution>
183
+ <aws:PageViews>0.5%</aws:PageViews>
184
+ <aws:Users>0.7%</aws:Users>
185
+ </aws:Contribution>
186
+ </aws:Country>
187
+ <aws:Country Code="VN">
188
+ <aws:Rank>8</aws:Rank>
189
+ <aws:Contribution>
190
+ <aws:PageViews>0.4%</aws:PageViews>
191
+ <aws:Users>0.6%</aws:Users>
192
+ </aws:Contribution>
193
+ </aws:Country>
194
+ <aws:Country Code="SG">
195
+ <aws:Rank>5</aws:Rank>
196
+ <aws:Contribution>
197
+ <aws:PageViews>0.6%</aws:PageViews>
198
+ <aws:Users>0.6%</aws:Users>
199
+ </aws:Contribution>
200
+ </aws:Country>
201
+ <aws:Country Code="ZA">
202
+ <aws:Rank>5</aws:Rank>
203
+ <aws:Contribution>
204
+ <aws:PageViews>0.4%</aws:PageViews>
205
+ <aws:Users>0.6%</aws:Users>
206
+ </aws:Contribution>
207
+ </aws:Country>
208
+ <aws:Country Code="CO">
209
+ <aws:Rank>6</aws:Rank>
210
+ <aws:Contribution>
211
+ <aws:PageViews>0.4%</aws:PageViews>
212
+ <aws:Users>0.6%</aws:Users>
213
+ </aws:Contribution>
214
+ </aws:Country>
215
+ <aws:Country Code="RU">
216
+ <aws:Rank>31</aws:Rank>
217
+ <aws:Contribution>
218
+ <aws:PageViews>0.3%</aws:PageViews>
219
+ <aws:Users>0.6%</aws:Users>
220
+ </aws:Contribution>
221
+ </aws:Country>
222
+ <aws:Country Code="KR">
223
+ <aws:Rank>12</aws:Rank>
224
+ <aws:Contribution>
225
+ <aws:PageViews>0.4%</aws:PageViews>
226
+ <aws:Users>0.6%</aws:Users>
227
+ </aws:Contribution>
228
+ </aws:Country>
229
+ <aws:Country Code="BD">
230
+ <aws:Rank>4</aws:Rank>
231
+ <aws:Contribution>
232
+ <aws:PageViews>0.4%</aws:PageViews>
233
+ <aws:Users>0.6%</aws:Users>
234
+ </aws:Contribution>
235
+ </aws:Country>
236
+ <aws:Country Code="GR">
237
+ <aws:Rank>6</aws:Rank>
238
+ <aws:Contribution>
239
+ <aws:PageViews>0.4%</aws:PageViews>
240
+ <aws:Users>0.5%</aws:Users>
241
+ </aws:Contribution>
242
+ </aws:Country>
243
+ <aws:Country Code="O">
244
+ <aws:Rank/>
245
+ <aws:Contribution>
246
+ <aws:PageViews>9.5%</aws:PageViews>
247
+ <aws:Users>12.7%</aws:Users>
248
+ </aws:Contribution>
249
+ </aws:Country>
250
+ </aws:RankByCountry>
251
+ </aws:TrafficData>
252
+ </aws:Alexa>
253
+ </aws:UrlInfoResult>
254
+ <aws:ResponseStatus xmlns:aws="http://alexa.amazonaws.com/doc/2005-10-05/">
255
+ <aws:StatusCode>Success</aws:StatusCode>
256
+ </aws:ResponseStatus>
257
+ </aws:Response>
258
+ <aws:Response xmlns:aws="http://awis.amazonaws.com/doc/2005-07-11">
259
+ <aws:OperationRequest>
260
+ <aws:RequestId>441b56e0-a3ca-65e4-c370-5d8400ae320c</aws:RequestId>
261
+ </aws:OperationRequest>
262
+ <aws:UrlInfoResult>
263
+ <aws:Alexa>
264
+ <aws:TrafficData>
265
+ <aws:DataUrl type="canonical">cnn.com/</aws:DataUrl>
266
+ <aws:RankByCountry>
267
+ <aws:Country Code="US">
268
+ <aws:Rank>21</aws:Rank>
269
+ <aws:Contribution>
270
+ <aws:PageViews>68.4%</aws:PageViews>
271
+ <aws:Users>63.8%</aws:Users>
272
+ </aws:Contribution>
273
+ </aws:Country>
274
+ <aws:Country Code="CA">
275
+ <aws:Rank>43</aws:Rank>
276
+ <aws:Contribution>
277
+ <aws:PageViews>3.9%</aws:PageViews>
278
+ <aws:Users>3.7%</aws:Users>
279
+ </aws:Contribution>
280
+ </aws:Country>
281
+ <aws:Country Code="IN">
282
+ <aws:Rank>267</aws:Rank>
283
+ <aws:Contribution>
284
+ <aws:PageViews>2.3%</aws:PageViews>
285
+ <aws:Users>3.3%</aws:Users>
286
+ </aws:Contribution>
287
+ </aws:Country>
288
+ <aws:Country Code="MX">
289
+ <aws:Rank>50</aws:Rank>
290
+ <aws:Contribution>
291
+ <aws:PageViews>2.7%</aws:PageViews>
292
+ <aws:Users>3.0%</aws:Users>
293
+ </aws:Contribution>
294
+ </aws:Country>
295
+ <aws:Country Code="GB">
296
+ <aws:Rank>233</aws:Rank>
297
+ <aws:Contribution>
298
+ <aws:PageViews>1.0%</aws:PageViews>
299
+ <aws:Users>1.4%</aws:Users>
300
+ </aws:Contribution>
301
+ </aws:Country>
302
+ <aws:Country Code="AU">
303
+ <aws:Rank>109</aws:Rank>
304
+ <aws:Contribution>
305
+ <aws:PageViews>0.8%</aws:PageViews>
306
+ <aws:Users>1.1%</aws:Users>
307
+ </aws:Contribution>
308
+ </aws:Country>
309
+ <aws:Country Code="BR">
310
+ <aws:Rank>335</aws:Rank>
311
+ <aws:Contribution>
312
+ <aws:PageViews>0.9%</aws:PageViews>
313
+ <aws:Users>1.0%</aws:Users>
314
+ </aws:Contribution>
315
+ </aws:Country>
316
+ <aws:Country Code="ZA">
317
+ <aws:Rank>71</aws:Rank>
318
+ <aws:Contribution>
319
+ <aws:PageViews>0.8%</aws:PageViews>
320
+ <aws:Users>1.0%</aws:Users>
321
+ </aws:Contribution>
322
+ </aws:Country>
323
+ <aws:Country Code="KR">
324
+ <aws:Rank>149</aws:Rank>
325
+ <aws:Contribution>
326
+ <aws:PageViews>0.9%</aws:PageViews>
327
+ <aws:Users>0.9%</aws:Users>
328
+ </aws:Contribution>
329
+ </aws:Country>
330
+ <aws:Country Code="NG">
331
+ <aws:Rank>65</aws:Rank>
332
+ <aws:Contribution>
333
+ <aws:PageViews>0.6%</aws:PageViews>
334
+ <aws:Users>0.8%</aws:Users>
335
+ </aws:Contribution>
336
+ </aws:Country>
337
+ <aws:Country Code="TH">
338
+ <aws:Rank>113</aws:Rank>
339
+ <aws:Contribution>
340
+ <aws:PageViews>0.7%</aws:PageViews>
341
+ <aws:Users>0.8%</aws:Users>
342
+ </aws:Contribution>
343
+ </aws:Country>
344
+ <aws:Country Code="JP">
345
+ <aws:Rank>858</aws:Rank>
346
+ <aws:Contribution>
347
+ <aws:PageViews>0.9%</aws:PageViews>
348
+ <aws:Users>0.8%</aws:Users>
349
+ </aws:Contribution>
350
+ </aws:Country>
351
+ <aws:Country Code="VE">
352
+ <aws:Rank>96</aws:Rank>
353
+ <aws:Contribution>
354
+ <aws:PageViews>0.4%</aws:PageViews>
355
+ <aws:Users>0.7%</aws:Users>
356
+ </aws:Contribution>
357
+ </aws:Country>
358
+ <aws:Country Code="CN">
359
+ <aws:Rank>1740</aws:Rank>
360
+ <aws:Contribution>
361
+ <aws:PageViews>0.5%</aws:PageViews>
362
+ <aws:Users>0.7%</aws:Users>
363
+ </aws:Contribution>
364
+ </aws:Country>
365
+ <aws:Country Code="PH">
366
+ <aws:Rank>78</aws:Rank>
367
+ <aws:Contribution>
368
+ <aws:PageViews>0.7%</aws:PageViews>
369
+ <aws:Users>0.6%</aws:Users>
370
+ </aws:Contribution>
371
+ </aws:Country>
372
+ <aws:Country Code="ES">
373
+ <aws:Rank>438</aws:Rank>
374
+ <aws:Contribution>
375
+ <aws:PageViews>0.5%</aws:PageViews>
376
+ <aws:Users>0.6%</aws:Users>
377
+ </aws:Contribution>
378
+ </aws:Country>
379
+ <aws:Country Code="NL">
380
+ <aws:Rank>200</aws:Rank>
381
+ <aws:Contribution>
382
+ <aws:PageViews>0.4%</aws:PageViews>
383
+ <aws:Users>0.5%</aws:Users>
384
+ </aws:Contribution>
385
+ </aws:Country>
386
+ <aws:Country Code="PK">
387
+ <aws:Rank>187</aws:Rank>
388
+ <aws:Contribution>
389
+ <aws:PageViews>0.5%</aws:PageViews>
390
+ <aws:Users>0.5%</aws:Users>
391
+ </aws:Contribution>
392
+ </aws:Country>
393
+ <aws:Country Code="O">
394
+ <aws:Rank/>
395
+ <aws:Contribution>
396
+ <aws:PageViews>12.9%</aws:PageViews>
397
+ <aws:Users>14.6%</aws:Users>
398
+ </aws:Contribution>
399
+ </aws:Country>
400
+ </aws:RankByCountry>
401
+ </aws:TrafficData>
402
+ </aws:Alexa>
403
+ </aws:UrlInfoResult>
404
+ <aws:ResponseStatus xmlns:aws="http://alexa.amazonaws.com/doc/2005-10-05/">
405
+ <aws:StatusCode>Success</aws:StatusCode>
406
+ </aws:ResponseStatus>
407
+ </aws:Response>
408
+ </aws:UrlInfoResponse>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awis-wrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-14 00:00:00.000000000 Z
12
+ date: 2013-03-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -27,6 +27,22 @@ dependencies:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: extlib
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
30
46
  - !ruby/object:Gem::Dependency
31
47
  name: rspec
32
48
  requirement: !ruby/object:Gem::Requirement
@@ -129,20 +145,21 @@ executables: []
129
145
  extensions: []
130
146
  extra_rdoc_files:
131
147
  - LICENSE.txt
132
- - README.rdoc
148
+ - README.md
133
149
  files:
134
150
  - .document
135
151
  - .rspec
136
152
  - Gemfile
137
153
  - Gemfile.lock
138
154
  - LICENSE.txt
139
- - README.rdoc
155
+ - README.md
140
156
  - Rakefile
141
157
  - VERSION
142
158
  - awis-wrapper.gemspec
143
159
  - lib/awis-wrapper.rb
144
160
  - spec/awis-wrapper_spec.rb
145
161
  - spec/fixtures/bad_request.xml
162
+ - spec/fixtures/batch_info.xml
146
163
  - spec/fixtures/url_info.xml
147
164
  - spec/fixtures/wrong_request.xml
148
165
  - spec/fixtures/wrong_response.xml
@@ -162,7 +179,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
162
179
  version: '0'
163
180
  segments:
164
181
  - 0
165
- hash: 3170519927619946549
182
+ hash: -92231066217950697
166
183
  required_rubygems_version: !ruby/object:Gem::Requirement
167
184
  none: false
168
185
  requirements:
@@ -1,19 +0,0 @@
1
- = awis-wrapper
2
-
3
- This is the wrapper for AWIS service, this thought derive from Ishango2 project.
4
-
5
- == Contributing to awis-wrapper
6
-
7
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
- * Fork the project.
10
- * Start a feature/bugfix branch.
11
- * Commit and push until you are happy with your contribution.
12
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
-
15
- == Copyright
16
-
17
- Copyright (c) 2013 Vincent.Z. See LICENSE.txt for
18
- further details.
19
-