wrest 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -13,7 +13,7 @@ Features under a numbered section are complete and available in the Wrest gem.
13
13
  * 304/ETag response caching
14
14
  * Keep-alive support for libcurl
15
15
 
16
- == Current
16
+ == 0.1.1
17
17
  * Multipart post and put using Net::Http
18
18
 
19
19
  == 0.1.0
data/README.rdoc CHANGED
@@ -1,6 +1,6 @@
1
- = Wrest 0.1.1
1
+ = Wrest 0.1.2
2
2
 
3
- (c) Copyright 2009 {Sidu Ponnappa}[http://blog.sidu.in]. All Rights Reserved.
3
+ (c) Copyright 2009-2010 {Sidu Ponnappa}[http://blog.sidu.in]. All Rights Reserved.
4
4
 
5
5
  Wrest is a ruby REST client library which
6
6
  * allows allows you to quickly build object oriented wrappers around any web service
data/Rakefile CHANGED
@@ -10,11 +10,11 @@
10
10
  # Note that some optional libraries/gems that the build (not Wrest itself) uses may not be available on all implementations of Ruby.
11
11
  puts "Building on Ruby #{RUBY_VERSION}, #{RUBY_RELEASE_DATE}, #{RUBY_PLATFORM}"
12
12
 
13
- if Object.const_defined?('RAILS_ROOT')
13
+ if Object.const_defined?('RAILS_ROOT') || Object.const_defined?('Rails')
14
14
  require File.dirname(__FILE__) + '/../../../config/environment'
15
15
  else
16
16
  require 'rubygems'
17
- gem 'rspec'
17
+ gem 'rspec', '= 1.3.0'
18
18
  require 'rake'
19
19
  require 'spec'
20
20
  require 'spec/rake/spectask'
@@ -27,17 +27,18 @@ else
27
27
  end
28
28
 
29
29
  desc 'Default: run spec tests.'
30
- task :default => 'spec:unit'
30
+ task :default => 'rspec:unit'
31
+ task :spec => 'rspec:unit'
31
32
 
32
- namespace :spec do
33
+ namespace :rspec do
33
34
  desc "Run all unit specs"
34
35
  Spec::Rake::SpecTask.new(:unit) do |task|
35
36
  task.spec_files = FileList['spec/unit/wrest/**/*_spec.rb']
36
37
  task.spec_opts = ['--options', 'spec/spec.opts']
37
38
  end
38
39
 
39
- desc "Run all live functional specs"
40
- Spec::Rake::SpecTask.new(:functional) do |task|
40
+ desc "Run all live functional specs - requires sample_rails_app running at 3000 in test environment"
41
+ Spec::Rake::SpecTask.new(:functional) do |task|
41
42
  task.spec_files = FileList['spec/functional/wrest/**/*_spec.rb']
42
43
  task.spec_opts = ['--options', 'spec/spec.opts']
43
44
  end
@@ -87,11 +88,11 @@ begin
87
88
  gemspec.homepage = "http://github.com/kaiwren/wrest"
88
89
  gemspec.has_rdoc = true
89
90
  gemspec.rubyforge_project = 'wrest'
90
- gemspec.executables = ['wrest', 'jwrest']
91
+ gemspec.executables = ['wrest']
91
92
  gemspec.require_path = "lib"
92
93
  gemspec.files.exclude *['.gitignore', 'spec/functional']
93
94
  gemspec.test_files.exclude *['.gitignore', 'spec/functional', 'examples']
94
- gemspec.add_dependency('activesupport', '>= 2.3.5')
95
+ gemspec.add_dependency('activesupport', '= 2.3.8')
95
96
  case RUBY_PLATFORM
96
97
  when /java/
97
98
  gemspec.add_dependency('json-jruby', '>= 1.1.3')
@@ -103,8 +104,8 @@ begin
103
104
  end
104
105
  end
105
106
  rescue LoadError
106
- puts "Jeweler not available. Install it with: gem install technicalpickles-jeweler -s http://gems.github.com"
107
- puts "If you're using JRuby and are having trouble installing jeweler, try installing the git (gem install git) and rubyforge (gem install rubyforge) gems by hand. Also remember to update gems itself (jruby -S gem update --system)."
107
+ puts "Jeweler not available. Install it with: gem install jeweler"
108
+ puts "If you're using JRuby and are having trouble installing jeweler, try installing the git (gem install git) and rubyforge (gem install rubyforge) gems by hand. Also remember to update gems itself (jruby -S gem update --system)." if RUBY_PLATFORM =~ /java/
108
109
  end
109
110
 
110
111
  begin
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 1
2
+ :patch: 2
3
3
  :minor: 1
4
4
  :major: 0
@@ -0,0 +1,24 @@
1
+ # Copyright 2009 - 2010 Sidu Ponnappa
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ # Unless required by applicable law or agreed to in writing, software distributed under the License
7
+ # is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8
+ # See the License for the specific language governing permissions and limitations under the License.
9
+
10
+ require 'pp'
11
+ require File.expand_path(File.dirname(__FILE__) + "/../lib/wrest")
12
+
13
+ # See http://code.google.com/p/imgur-api
14
+ imgur_key = 'f6561f62e13422bb25a1e738e9927d3b' # use your own key, this one is fake
15
+ file_path = 'VoA10.png'
16
+
17
+ # Using the eminently sensible Base64 encoded imgur file upload API
18
+ pp 'http://imgur.com/api/upload.xml'.to_uri.post_form(:image => [IO.read(file_path)].pack('m'), :key => imgur_key).deserialise
19
+
20
+ # If an API requires multipart posts - like the Facebook API - you can do that too
21
+ require 'wrest/multipart'
22
+ File.open(file_path) do |file|
23
+ pp 'http://imgur.com/api/upload.xml'.to_uri.post_multipart(:image => UploadIO.new(file, "image/png", file_path), :key => imgur_key).deserialise
24
+ end
data/lib/wrest.rb CHANGED
@@ -7,7 +7,7 @@
7
7
  # See the License for the specific language governing permissions and limitations under the License.
8
8
 
9
9
  require 'rubygems'
10
- gem 'activesupport', '>= 2.3.5'
10
+ gem 'activesupport', '=2.3.8'
11
11
 
12
12
  require 'net/http'
13
13
  require 'net/https'
@@ -116,7 +116,7 @@ module Wrest::Components
116
116
  #
117
117
  # This method can be overidden should you need a different name.
118
118
  def element_name
119
- @element_name ||= self.name.demodulize.underscore.underscore
119
+ @element_name ||= ActiveSupport::Inflector.demodulize(self.name).underscore.underscore
120
120
  end
121
121
  end
122
122
 
@@ -9,8 +9,8 @@
9
9
 
10
10
  begin
11
11
  gem 'multipart-post', '>= 1.0'
12
- rescue Gem::LoadError
13
- Wrest.logger.debug "Multipart Post >= 1.0 not found. Multipart Post is necessary to be able to post multipart. To install Multipart Post run `sudo gem install multipart-post`"
12
+ rescue Gem::LoadError => e
13
+ Wrest.logger.debug "Multipart Post >= 1.0 not found. Multipart Post is necessary to be able to post multipart. To install Multipart Post run 'sudo gem install multipart-post'"
14
14
  raise e
15
15
  end
16
16
 
@@ -12,6 +12,7 @@ module Wrest::Native
12
12
  def initialize(wrest_uri, parameters = {}, headers = {}, options = {})
13
13
  follow_redirects = options[:follow_redirects]
14
14
  options[:follow_redirects] = (follow_redirects == nil ? true : follow_redirects)
15
+ options[:cache_store] ||= {}
15
16
  super(
16
17
  wrest_uri,
17
18
  Net::HTTP::Get,
@@ -21,5 +22,30 @@ module Wrest::Native
21
22
  options
22
23
  )
23
24
  end
25
+
26
+ def invoke_with_cache_check
27
+ cached_response = get_cached_response
28
+ if cached_response.nil? then
29
+ response = invoke_without_cache_check
30
+ cache_response(response)
31
+ response
32
+ else
33
+ cached_response
34
+ end
35
+ end
36
+
37
+ def get_cached_response
38
+ response = nil
39
+ if cache_store.has_key?(@uri)
40
+ response = cache_store.fetch(@uri)
41
+ end
42
+ response
43
+ end
44
+
45
+ def cache_response(response)
46
+ cache_store[@uri] = response
47
+ end
48
+
49
+ alias_method_chain :invoke, :cache_check
24
50
  end
25
51
  end
@@ -13,7 +13,7 @@ module Wrest::Native
13
13
  # or Wrest::Native::Get etc. instead.
14
14
  class Request
15
15
  attr_reader :http_request, :uri, :body, :headers, :username, :password, :follow_redirects,
16
- :follow_redirects_limit, :follow_redirects_count, :timeout, :connection, :parameters
16
+ :follow_redirects_limit, :follow_redirects_count, :timeout, :connection, :parameters, :cache_store
17
17
  # Valid tuples for the options are:
18
18
  # :username => String, defaults to nil
19
19
  # :password => String, defaults to nil
@@ -31,6 +31,7 @@ module Wrest::Native
31
31
  # in the event of a connection failing to open. Defaulted to 60 by Uri#create_connection.
32
32
  # :connection => The HTTP Connection object to use. This is how a keep-alive connection can be
33
33
  # used for multiple requests.
34
+ # :cache_store => The object which should be used as cache store for cacheable responses
34
35
  def initialize(wrest_uri, http_request_klass, parameters = {}, body = nil, headers = {}, options = {})
35
36
  @uri = wrest_uri
36
37
  @headers = headers.stringify_keys
@@ -45,6 +46,7 @@ module Wrest::Native
45
46
  @timeout = @options[:timeout]
46
47
  @connection = @options[:connection]
47
48
  @http_request = self.build_request(http_request_klass, @uri, @parameters, @headers)
49
+ @cache_store = options[:cache_store]
48
50
  end
49
51
 
50
52
  # Makes a request and returns a Wrest::Native::Response.
data/lib/wrest/version.rb CHANGED
@@ -12,11 +12,11 @@ module Wrest
12
12
  unless defined? MAJOR
13
13
  MAJOR = 0
14
14
  MINOR = 1
15
- TINY = 1
15
+ TINY = 2
16
16
 
17
17
  STRING = [MAJOR, MINOR, TINY].join('.')
18
18
 
19
19
  SUMMARY = "wrest version #{STRING}"
20
20
  end
21
21
  end
22
- end
22
+ end
@@ -0,0 +1,64 @@
1
+ # Copyright 2009 Sidu Ponnappa
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ # Unless required by applicable law or agreed to in writing, software distributed under the License
7
+ # is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8
+ # See the License for the specific language governing permissions and limitations under the License.
9
+
10
+ require File.dirname(__FILE__) + '/../../spec_helper'
11
+
12
+ describe Wrest::Native::Get do
13
+ describe "caching" do
14
+
15
+ before :each do
16
+ @request_uri = 'http://localhost/foo'.to_uri
17
+ @cache = Hash.new
18
+ @get = Wrest::Native::Get.new(@request_uri, {},{},{:cache_store => @cache})
19
+ end
20
+
21
+ describe "dependencies" do
22
+ before :each do
23
+ @get.stub!(:invoke_without_cache_check).and_return(build_ok_response)
24
+ end
25
+
26
+ it "should call get_cached_response before making actual request" do
27
+ @get.should_receive(:get_cached_response)
28
+ @get.invoke
29
+ end
30
+
31
+ it "should call cache_response after calling invoke method for fresh request" do
32
+ @get.should_receive(:get_cached_response).and_return(nil)
33
+ @get.should_receive(:cache_response)
34
+ @get.invoke
35
+ end
36
+
37
+ it "should check if response already exists cache before making a request" do
38
+ @cache.should_receive(:has_key?).with(@request_uri)
39
+ @get.invoke
40
+ end
41
+ end
42
+ it "should call invoke_without_cache_check if response does not exist in cache" do
43
+ @cache.should_receive(:has_key?).with(@request_uri).and_return(false)
44
+ @get.should_receive(:invoke_without_cache_check)
45
+ @get.invoke
46
+ end
47
+
48
+ it "should not call invoke_without_cache_check if response exists in cache" do
49
+ @cache.should_receive(:has_key?).with(@request_uri).and_return(true)
50
+ @cache.should_receive(:fetch).with(@request_uri).and_return(build_ok_response)
51
+ @get.should_not_receive(:invoke_without_cache_check)
52
+ @get.invoke
53
+ end
54
+
55
+ it "should store response in cache if it did not exist in cache" do
56
+ response = build_ok_response
57
+ @cache.should_receive(:has_key?).with(@request_uri).and_return(false)
58
+ @get.should_receive(:invoke_without_cache_check).and_return(response)
59
+ @cache.should_receive(:[]=).with(@request_uri,response)
60
+ @get.invoke
61
+ end
62
+
63
+ end
64
+ end
data/wrest.gemspec CHANGED
@@ -5,14 +5,15 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{wrest}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Sidu Ponnappa"]
12
- s.date = %q{2010-04-22}
12
+ s.date = %q{2010-07-27}
13
+ s.default_executable = %q{wrest}
13
14
  s.description = %q{Wrest is a HTTP and REST client library which allows you to quickly build well encapsulated, object oriented wrappers around any web service.}
14
15
  s.email = %q{ckponnappa@gmail.com}
15
- s.executables = ["wrest", "jwrest"]
16
+ s.executables = ["wrest"]
16
17
  s.extra_rdoc_files = [
17
18
  "README.rdoc"
18
19
  ]
@@ -24,9 +25,9 @@ Gem::Specification.new do |s|
24
25
  "bin/jwrest",
25
26
  "bin/wrest",
26
27
  "bin/wrest_shell.rb",
27
- "examples/aws_simpledb.rb",
28
28
  "examples/delicious.rb",
29
29
  "examples/facebook.rb",
30
+ "examples/imgur_multipart.rb",
30
31
  "examples/keep_alive.rb",
31
32
  "examples/redirection.rb",
32
33
  "examples/twitter.rb",
@@ -107,6 +108,7 @@ Gem::Specification.new do |s|
107
108
  "spec/unit/wrest/curl/request_spec.rb",
108
109
  "spec/unit/wrest/curl/response_spec.rb",
109
110
  "spec/unit/wrest/http/response_spec.rb",
111
+ "spec/unit/wrest/native/get_spec.rb",
110
112
  "spec/unit/wrest/native/redirection_spec.rb",
111
113
  "spec/unit/wrest/native/request_spec.rb",
112
114
  "spec/unit/wrest/native/response_spec.rb",
@@ -120,7 +122,7 @@ Gem::Specification.new do |s|
120
122
  s.rdoc_options = ["--charset=UTF-8"]
121
123
  s.require_paths = ["lib"]
122
124
  s.rubyforge_project = %q{wrest}
123
- s.rubygems_version = %q{1.3.5}
125
+ s.rubygems_version = %q{1.3.7}
124
126
  s.summary = %q{REST client library for Ruby.}
125
127
  s.test_files = [
126
128
  "spec/custom_matchers/custom_matchers.rb",
@@ -140,6 +142,7 @@ Gem::Specification.new do |s|
140
142
  "spec/unit/wrest/curl/request_spec.rb",
141
143
  "spec/unit/wrest/curl/response_spec.rb",
142
144
  "spec/unit/wrest/http/response_spec.rb",
145
+ "spec/unit/wrest/native/get_spec.rb",
143
146
  "spec/unit/wrest/native/redirection_spec.rb",
144
147
  "spec/unit/wrest/native/request_spec.rb",
145
148
  "spec/unit/wrest/native/response_spec.rb",
@@ -153,15 +156,15 @@ Gem::Specification.new do |s|
153
156
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
154
157
  s.specification_version = 3
155
158
 
156
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
157
- s.add_runtime_dependency(%q<activesupport>, [">= 2.3.5"])
159
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
160
+ s.add_runtime_dependency(%q<activesupport>, ["= 2.3.8"])
158
161
  s.add_runtime_dependency(%q<json>, [">= 1.1.3"])
159
162
  else
160
- s.add_dependency(%q<activesupport>, [">= 2.3.5"])
163
+ s.add_dependency(%q<activesupport>, ["= 2.3.8"])
161
164
  s.add_dependency(%q<json>, [">= 1.1.3"])
162
165
  end
163
166
  else
164
- s.add_dependency(%q<activesupport>, [">= 2.3.5"])
167
+ s.add_dependency(%q<activesupport>, ["= 2.3.8"])
165
168
  s.add_dependency(%q<json>, [">= 1.1.3"])
166
169
  end
167
170
  end
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wrest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ hash: 31
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 2
10
+ version: 0.1.2
5
11
  platform: ruby
6
12
  authors:
7
13
  - Sidu Ponnappa
@@ -9,34 +15,45 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-04-22 00:00:00 +05:30
13
- default_executable:
18
+ date: 2010-07-27 00:00:00 +05:30
19
+ default_executable: wrest
14
20
  dependencies:
15
21
  - !ruby/object:Gem::Dependency
16
22
  name: activesupport
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
20
26
  requirements:
21
- - - ">="
27
+ - - "="
22
28
  - !ruby/object:Gem::Version
23
- version: 2.3.5
24
- version:
29
+ hash: 19
30
+ segments:
31
+ - 2
32
+ - 3
33
+ - 8
34
+ version: 2.3.8
35
+ type: :runtime
36
+ version_requirements: *id001
25
37
  - !ruby/object:Gem::Dependency
26
38
  name: json
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
30
42
  requirements:
31
43
  - - ">="
32
44
  - !ruby/object:Gem::Version
45
+ hash: 21
46
+ segments:
47
+ - 1
48
+ - 1
49
+ - 3
33
50
  version: 1.1.3
34
- version:
51
+ type: :runtime
52
+ version_requirements: *id002
35
53
  description: Wrest is a HTTP and REST client library which allows you to quickly build well encapsulated, object oriented wrappers around any web service.
36
54
  email: ckponnappa@gmail.com
37
55
  executables:
38
56
  - wrest
39
- - jwrest
40
57
  extensions: []
41
58
 
42
59
  extra_rdoc_files:
@@ -49,9 +66,9 @@ files:
49
66
  - bin/jwrest
50
67
  - bin/wrest
51
68
  - bin/wrest_shell.rb
52
- - examples/aws_simpledb.rb
53
69
  - examples/delicious.rb
54
70
  - examples/facebook.rb
71
+ - examples/imgur_multipart.rb
55
72
  - examples/keep_alive.rb
56
73
  - examples/redirection.rb
57
74
  - examples/twitter.rb
@@ -132,6 +149,7 @@ files:
132
149
  - spec/unit/wrest/curl/request_spec.rb
133
150
  - spec/unit/wrest/curl/response_spec.rb
134
151
  - spec/unit/wrest/http/response_spec.rb
152
+ - spec/unit/wrest/native/get_spec.rb
135
153
  - spec/unit/wrest/native/redirection_spec.rb
136
154
  - spec/unit/wrest/native/request_spec.rb
137
155
  - spec/unit/wrest/native/response_spec.rb
@@ -150,21 +168,27 @@ rdoc_options:
150
168
  require_paths:
151
169
  - lib
152
170
  required_ruby_version: !ruby/object:Gem::Requirement
171
+ none: false
153
172
  requirements:
154
173
  - - ">="
155
174
  - !ruby/object:Gem::Version
175
+ hash: 3
176
+ segments:
177
+ - 0
156
178
  version: "0"
157
- version:
158
179
  required_rubygems_version: !ruby/object:Gem::Requirement
180
+ none: false
159
181
  requirements:
160
182
  - - ">="
161
183
  - !ruby/object:Gem::Version
184
+ hash: 3
185
+ segments:
186
+ - 0
162
187
  version: "0"
163
- version:
164
188
  requirements: []
165
189
 
166
190
  rubyforge_project: wrest
167
- rubygems_version: 1.3.5
191
+ rubygems_version: 1.3.7
168
192
  signing_key:
169
193
  specification_version: 3
170
194
  summary: REST client library for Ruby.
@@ -186,6 +210,7 @@ test_files:
186
210
  - spec/unit/wrest/curl/request_spec.rb
187
211
  - spec/unit/wrest/curl/response_spec.rb
188
212
  - spec/unit/wrest/http/response_spec.rb
213
+ - spec/unit/wrest/native/get_spec.rb
189
214
  - spec/unit/wrest/native/redirection_spec.rb
190
215
  - spec/unit/wrest/native/request_spec.rb
191
216
  - spec/unit/wrest/native/response_spec.rb
@@ -1,60 +0,0 @@
1
- # Copyright 2009 Sidu Ponnappa
2
-
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6
- # Unless required by applicable law or agreed to in writing, software distributed under the License
7
- # is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8
- # See the License for the specific language governing permissions and limitations under the License.
9
-
10
- require File.expand_path(File.dirname(__FILE__) + "/../lib/wrest")
11
- require 'pp'
12
- require 'openssl'
13
- require 'time'
14
- require "base64"
15
-
16
- Wrest.logger = Logger.new(STDOUT)
17
- Wrest.logger.level = Logger::DEBUG # Set this to Logger::INFO or higher to disable request logging
18
-
19
- # AWS SDB API Reference
20
- # http://docs.amazonwebservices.com/AmazonSimpleDB/latest/DeveloperGuide/index.html?SDB_API.html
21
-
22
- module SimpleDB
23
- Config = {
24
- :aws_access_key_id => 'AKIAJOTOWFTQ6FRQIZZA',
25
- :aws_secret_access_key => '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'
26
- }
27
- Uri = "https://sdb.amazonaws.com".to_uri
28
- Digest = OpenSSL::Digest::Digest.new('sha1')
29
-
30
- extend self
31
- def invoke(action)
32
- options = {
33
- 'Action' => action,
34
- 'AWSAccessKeyId' => SimpleDB::Config[:aws_access_key_id],
35
- 'DomainName' => 'LEDev',
36
- 'SignatureVersion' => '2',
37
- 'SignatureMethod' => 'HmacSHA256',
38
- 'Timestamp' => Time.now.iso8601,
39
- 'Version' => '2009-04-15'
40
- }
41
- Uri.get(options.merge('Signature' => signature_for(options)))
42
- end
43
-
44
- # http://docs.amazonwebservices.com/AmazonSimpleDB/latest/DeveloperGuide/index.html?REST_RESTAuth.html
45
- def signature_for(options)
46
- data = [
47
- "GET",
48
- "sdb.amazonaws.com",
49
- options.keys.sort.map{|k| "#{k}=#{CGI::escape(options[k])}"}.join('&')
50
- ].join("\n")
51
- CGI::escape(Base64.encode64(OpenSSL::HMAC.digest(Digest, Config[:aws_secret_access_key], data)))
52
- end
53
-
54
- def list_domains
55
- invoke('ListDomains').body
56
- end
57
- end
58
-
59
-
60
- pp SimpleDB.list_domains