wrest 0.1.1-java → 0.1.2-java

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,4 +1,4 @@
1
- = Wrest 0.1.1
1
+ = Wrest 0.1.2
2
2
 
3
3
  (c) Copyright 2009-2010 {Sidu Ponnappa}[http://blog.sidu.in]. All Rights Reserved.
4
4
 
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
@@ -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
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'
@@ -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,15 +5,16 @@
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
  s.platform = %q{java}
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.authors = ["Sidu Ponnappa"]
13
- s.date = %q{2010-04-22}
13
+ s.date = %q{2010-07-27}
14
+ s.default_executable = %q{wrest}
14
15
  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.}
15
16
  s.email = %q{ckponnappa@gmail.com}
16
- s.executables = ["wrest", "jwrest"]
17
+ s.executables = ["wrest"]
17
18
  s.extra_rdoc_files = [
18
19
  "README.rdoc"
19
20
  ]
@@ -25,9 +26,9 @@ Gem::Specification.new do |s|
25
26
  "bin/jwrest",
26
27
  "bin/wrest",
27
28
  "bin/wrest_shell.rb",
28
- "examples/aws_simpledb.rb",
29
29
  "examples/delicious.rb",
30
30
  "examples/facebook.rb",
31
+ "examples/imgur_multipart.rb",
31
32
  "examples/keep_alive.rb",
32
33
  "examples/redirection.rb",
33
34
  "examples/twitter.rb",
@@ -108,6 +109,7 @@ Gem::Specification.new do |s|
108
109
  "spec/unit/wrest/curl/request_spec.rb",
109
110
  "spec/unit/wrest/curl/response_spec.rb",
110
111
  "spec/unit/wrest/http/response_spec.rb",
112
+ "spec/unit/wrest/native/get_spec.rb",
111
113
  "spec/unit/wrest/native/redirection_spec.rb",
112
114
  "spec/unit/wrest/native/request_spec.rb",
113
115
  "spec/unit/wrest/native/response_spec.rb",
@@ -121,7 +123,7 @@ Gem::Specification.new do |s|
121
123
  s.rdoc_options = ["--charset=UTF-8"]
122
124
  s.require_paths = ["lib"]
123
125
  s.rubyforge_project = %q{wrest}
124
- s.rubygems_version = %q{1.3.6}
126
+ s.rubygems_version = %q{1.3.7}
125
127
  s.summary = %q{REST client library for Ruby.}
126
128
  s.test_files = [
127
129
  "spec/custom_matchers/custom_matchers.rb",
@@ -143,6 +145,7 @@ Gem::Specification.new do |s|
143
145
  "spec/unit/wrest/curl/request_spec.rb",
144
146
  "spec/unit/wrest/curl/response_spec.rb",
145
147
  "spec/unit/wrest/http/response_spec.rb",
148
+ "spec/unit/wrest/native/get_spec.rb",
146
149
  "spec/unit/wrest/native/redirection_spec.rb",
147
150
  "spec/unit/wrest/native/request_spec.rb",
148
151
  "spec/unit/wrest/native/response_spec.rb",
@@ -154,17 +157,17 @@ Gem::Specification.new do |s|
154
157
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
155
158
  s.specification_version = 3
156
159
 
157
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
158
- s.add_runtime_dependency(%q<activesupport>, [">= 2.3.5"])
160
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
161
+ s.add_runtime_dependency(%q<activesupport>, ["= 2.3.8"])
159
162
  s.add_runtime_dependency(%q<json-jruby>, [">= 1.1.3"])
160
163
  s.add_runtime_dependency(%q<nokogiri>, [">= 1.3.3"])
161
164
  else
162
- s.add_dependency(%q<activesupport>, [">= 2.3.5"])
165
+ s.add_dependency(%q<activesupport>, ["= 2.3.8"])
163
166
  s.add_dependency(%q<json-jruby>, [">= 1.1.3"])
164
167
  s.add_dependency(%q<nokogiri>, [">= 1.3.3"])
165
168
  end
166
169
  else
167
- s.add_dependency(%q<activesupport>, [">= 2.3.5"])
170
+ s.add_dependency(%q<activesupport>, ["= 2.3.8"])
168
171
  s.add_dependency(%q<json-jruby>, [">= 1.1.3"])
169
172
  s.add_dependency(%q<nokogiri>, [">= 1.3.3"])
170
173
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 1
9
- version: 0.1.1
8
+ - 2
9
+ version: 0.1.2
10
10
  platform: java
11
11
  authors:
12
12
  - Sidu Ponnappa
@@ -14,27 +14,29 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-22 00:00:00 +05:30
18
- default_executable:
17
+ date: 2010-07-27 00:00:00 +05:30
18
+ default_executable: wrest
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: activesupport
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
24
25
  requirements:
25
- - - ">="
26
+ - - "="
26
27
  - !ruby/object:Gem::Version
27
28
  segments:
28
29
  - 2
29
30
  - 3
30
- - 5
31
- version: 2.3.5
31
+ - 8
32
+ version: 2.3.8
32
33
  type: :runtime
33
34
  version_requirements: *id001
34
35
  - !ruby/object:Gem::Dependency
35
36
  name: json-jruby
36
37
  prerelease: false
37
38
  requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
38
40
  requirements:
39
41
  - - ">="
40
42
  - !ruby/object:Gem::Version
@@ -49,6 +51,7 @@ dependencies:
49
51
  name: nokogiri
50
52
  prerelease: false
51
53
  requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
52
55
  requirements:
53
56
  - - ">="
54
57
  - !ruby/object:Gem::Version
@@ -63,7 +66,6 @@ description: Wrest is a HTTP and REST client library which allows you to quickly
63
66
  email: ckponnappa@gmail.com
64
67
  executables:
65
68
  - wrest
66
- - jwrest
67
69
  extensions: []
68
70
 
69
71
  extra_rdoc_files:
@@ -76,9 +78,9 @@ files:
76
78
  - bin/jwrest
77
79
  - bin/wrest
78
80
  - bin/wrest_shell.rb
79
- - examples/aws_simpledb.rb
80
81
  - examples/delicious.rb
81
82
  - examples/facebook.rb
83
+ - examples/imgur_multipart.rb
82
84
  - examples/keep_alive.rb
83
85
  - examples/redirection.rb
84
86
  - examples/twitter.rb
@@ -159,6 +161,7 @@ files:
159
161
  - spec/unit/wrest/curl/request_spec.rb
160
162
  - spec/unit/wrest/curl/response_spec.rb
161
163
  - spec/unit/wrest/http/response_spec.rb
164
+ - spec/unit/wrest/native/get_spec.rb
162
165
  - spec/unit/wrest/native/redirection_spec.rb
163
166
  - spec/unit/wrest/native/request_spec.rb
164
167
  - spec/unit/wrest/native/response_spec.rb
@@ -177,6 +180,7 @@ rdoc_options:
177
180
  require_paths:
178
181
  - lib
179
182
  required_ruby_version: !ruby/object:Gem::Requirement
183
+ none: false
180
184
  requirements:
181
185
  - - ">="
182
186
  - !ruby/object:Gem::Version
@@ -184,6 +188,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
184
188
  - 0
185
189
  version: "0"
186
190
  required_rubygems_version: !ruby/object:Gem::Requirement
191
+ none: false
187
192
  requirements:
188
193
  - - ">="
189
194
  - !ruby/object:Gem::Version
@@ -193,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
198
  requirements: []
194
199
 
195
200
  rubyforge_project: wrest
196
- rubygems_version: 1.3.6
201
+ rubygems_version: 1.3.7
197
202
  signing_key:
198
203
  specification_version: 3
199
204
  summary: REST client library for Ruby.
@@ -217,6 +222,7 @@ test_files:
217
222
  - spec/unit/wrest/curl/request_spec.rb
218
223
  - spec/unit/wrest/curl/response_spec.rb
219
224
  - spec/unit/wrest/http/response_spec.rb
225
+ - spec/unit/wrest/native/get_spec.rb
220
226
  - spec/unit/wrest/native/redirection_spec.rb
221
227
  - spec/unit/wrest/native/request_spec.rb
222
228
  - 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