aws-sdb 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ Spec::Rake::SpecTask.new
7
7
  gem_spec = Gem::Specification.new do |s|
8
8
  s.name = "aws-sdb"
9
9
  s.rubyforge_project = s.name
10
- s.version = "0.1.1"
10
+ s.version = "0.1.2"
11
11
  s.platform = Gem::Platform::RUBY
12
12
  s.has_rdoc = true
13
13
  s.extra_rdoc_files = ["README", "LICENSE"]
data/lib/aws_sdb/error.rb CHANGED
@@ -25,6 +25,8 @@ module AwsSdb
25
25
  class NumberItemAttributesExceededError < RequestError ; end
26
26
  class RequestTimeoutError < RequestError ; end
27
27
 
28
+ class FeatureDeprecatedError < RequestError ; end
29
+
28
30
  class ConnectionError < Error
29
31
  attr_reader :response
30
32
 
@@ -18,7 +18,6 @@ module AwsSdb
18
18
  @secret_access_key = secret_access_key
19
19
  end
20
20
 
21
- # TODO Make this options hash not a param list
22
21
  def list_domains(max = nil, token = nil)
23
22
  params = { 'Action' => 'ListDomains' }
24
23
  params['MoreToken'] =
@@ -69,14 +68,14 @@ module AwsSdb
69
68
  params = {
70
69
  'Action' => 'PutAttributes',
71
70
  'DomainName' => domain.to_s,
72
- 'ItemName' => item.to_s,
73
- 'Replace' => replace
71
+ 'ItemName' => item.to_s
74
72
  }
75
73
  count = 0
76
74
  attributes.each do | key, values |
77
75
  ([]<<values).flatten.each do |value|
78
76
  params["Attribute.#{count}.Name"] = key.to_s
79
77
  params["Attribute.#{count}.Value"] = value.to_s
78
+ params["Attribute.#{count}.Replace"] = replace
80
79
  count += 1
81
80
  end
82
81
  end
@@ -118,7 +117,7 @@ module AwsSdb
118
117
 
119
118
  def call(method, params)
120
119
  params.merge!( {
121
- 'Version' => '2007-02-09',
120
+ 'Version' => '2007-11-07',
122
121
  'SignatureVersion' => '1',
123
122
  'AWSAccessKeyId' => @access_key_id,
124
123
  'Timestamp' => Time.now.gmtime.iso8601
@@ -18,9 +18,8 @@ describe Service, "when creating a new domain" do
18
18
  )
19
19
  @domain = "test-#{UUID.random_create.to_s}"
20
20
  # domains = @service.list_domains[0]
21
- # @logger.debug("Domains #{domains.inspect}")
22
21
  # domains.each do |d|
23
- # @service.delete_domain(d)
22
+ # @service.delete_domain(d) if d =~ /^test/
24
23
  # end
25
24
  end
26
25
 
@@ -86,49 +85,54 @@ describe Service, "when creating a new domain" do
86
85
 
87
86
  it "should raise an error if an a nil or '' domain name is given" do
88
87
  stub_error(
89
- 400, :InvalidDomainName, "The domain name '' is not valid."
88
+ 400,
89
+ :InvalidParameterValue,
90
+ "Value () for parameter DomainName is invalid."
90
91
  )
91
92
  lambda {
92
93
  @service.create_domain('')
93
- }.should raise_error(InvalidDomainNameError)
94
- stub_error(
95
- 400, :InvalidDomainName, "The domain name ' ' is not valid."
96
- )
94
+ }.should raise_error(InvalidParameterValueError)
97
95
  lambda {
98
- @service.create_domain(' ')
99
- }.should raise_error(InvalidDomainNameError)
96
+ @service.create_domain(nil)
97
+ }.should raise_error(InvalidParameterValueError)
100
98
  stub_error(
101
- 400, :InvalidDomainName, "The domain name '' is not valid."
99
+ 400,
100
+ :InvalidParameterValue,
101
+ "Value ( ) for parameter DomainName is invalid."
102
102
  )
103
103
  lambda {
104
- @service.create_domain(nil)
105
- }.should raise_error(InvalidDomainNameError)
104
+ @service.create_domain(' ')
105
+ }.should raise_error(InvalidParameterValueError)
106
106
  end
107
107
 
108
108
  it "should raise an error if the domain name length is < 3 or > 255" do
109
109
  stub_error(
110
- 400, :InvalidDomainName, "The domain name 'xx' is not valid."
110
+ 400,
111
+ :InvalidParameterValue,
112
+ "Value (xx) for parameter DomainName is invalid."
111
113
  )
112
114
  lambda {
113
115
  @service.create_domain('xx')
114
- }.should raise_error(InvalidDomainNameError)
116
+ }.should raise_error(InvalidParameterValueError)
115
117
  stub_error(
116
118
  400,
117
- :InvalidDomainName,
118
- "The domain name '#{:x.to_s*256}' is not valid."
119
+ :InvalidParameterValue,
120
+ "Value (#{:x.to_s*256}) for parameter DomainName is invalid."
119
121
  )
120
122
  lambda {
121
123
  @service.create_domain('x'*256)
122
- }.should raise_error(InvalidDomainNameError)
124
+ }.should raise_error(InvalidParameterValueError)
123
125
  end
124
126
 
125
127
  it "should only accept domain names with a-z, A-Z, 0-9, '_', '-', and '.' " do
126
128
  stub_error(
127
- 400, :InvalidDomainName, "The domain name '@$^*()' is not valid."
129
+ 400,
130
+ :InvalidParameterValue,
131
+ "Value (@$^*()) for parameter DomainName is invalid."
128
132
  )
129
133
  lambda {
130
- @service.create_domain('@$^&*()')
131
- }.should raise_error(InvalidDomainNameError)
134
+ @service.create_domain('@$^*()')
135
+ }.should raise_error(InvalidParameterValueError)
132
136
  end
133
137
 
134
138
  it "should only accept a maximum of 100 domain names" do
@@ -148,7 +152,7 @@ describe Service, "when listing domains" do
148
152
  )
149
153
  @domain = "test-#{UUID.random_create.to_s}"
150
154
  # @service.list_domains[0].each do |d|
151
- # @service.delete_domain(d)
155
+ # @service.delete_domain(d) if d =~ /^test/
152
156
  # end
153
157
  # @service.create_domain(@domain)
154
158
  end
@@ -162,14 +166,14 @@ describe Service, "when listing domains" do
162
166
  resp.stub!(:code).and_return("200")
163
167
  resp.stub!(:body).and_return(
164
168
  """
165
- <ListDomainsResponse>
166
- <ResponseStatus>
167
- <StatusCode>Success</StatusCode>
168
- <RequestID>#{UUID.random_create.to_s}</RequestID>
169
- <BoxUsage/>
170
- </ResponseStatus>
171
- <DomainName>#{@domain}</DomainName>
172
- </ListDomainsResponse>
169
+ <ListDomainsResponse>
170
+ <ResponseStatus>
171
+ <StatusCode>Success</StatusCode>
172
+ <RequestID>#{UUID.random_create.to_s}</RequestID>
173
+ <BoxUsage/>
174
+ </ResponseStatus>
175
+ <DomainName>#{@domain}</DomainName>
176
+ </ListDomainsResponse>
173
177
  """
174
178
  )
175
179
  http = mock(Net::HTTP)
@@ -194,7 +198,7 @@ describe Service, "when deleting domains" do
194
198
  )
195
199
  @domain = "test-#{UUID.random_create.to_s}"
196
200
  # @service.list_domains[0].each do |d|
197
- # @service.delete_domain(d)
201
+ # @service.delete_domain(d) if d =~ /^test/
198
202
  # end
199
203
  # @service.create_domain(@domain)
200
204
  end
@@ -242,10 +246,10 @@ describe Service, "when managing items" do
242
246
  ENV['AMAZON_SECRET_ACCESS_KEY']
243
247
  )
244
248
  @domain = "test-#{UUID.random_create.to_s}"
245
- # @service.list_domains[0].each do |d|
246
- # @service.delete_domain(d)
247
- # end
248
- # @service.create_domain(@domain)
249
+ # @service.list_domains[0].each do |d|
250
+ # @service.delete_domain(d) if d =~ /^test/
251
+ # end
252
+ # @service.create_domain(@domain)
249
253
  @item = "test-#{UUID.random_create.to_s}"
250
254
  @attributes = {
251
255
  :question => 'What is the answer?',
@@ -254,7 +258,7 @@ describe Service, "when managing items" do
254
258
  end
255
259
 
256
260
  after(:all) do
257
- # @service.delete_domain(@domain)
261
+ # @service.delete_domain(@domain)
258
262
  end
259
263
 
260
264
  def stub_put
@@ -397,3 +401,10 @@ describe Service, "when managing items" do
397
401
  }.should_not raise_error
398
402
  end
399
403
  end
404
+
405
+ # TODO Pull the specs from the amazon docs and write more rspec
406
+ # 100 attributes per each call
407
+ # 256 total attribute name-value pairs per item
408
+ # 250 million attributes per domain
409
+ # 10 GB of total user data storage per domain
410
+ # ...etc...
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Dysinger
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-01-04 00:00:00 -10:00
12
+ date: 2008-01-23 00:00:00 -10:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency