Skip to content

Commit 9cd10f0

Browse files
Jeff DutilJeff Dutil
authored andcommitted
Bump to aws-sdk and fix AWS to Aws namespace.
1 parent 2369432 commit 9cd10f0

File tree

13 files changed

+20
-21
lines changed

13 files changed

+20
-21
lines changed

aws-sessionstore-dynamodb.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ Gem::Specification.new do |spec|
1313
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
1414
spec.require_paths = ["lib"]
1515

16-
spec.add_dependency 'aws-sdk-v1'
16+
spec.add_dependency 'aws-sdk'
1717
spec.add_dependency 'rack', '~> 1.0'
1818
end

lib/aws/session_store/dynamo_db/configuration.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# language governing permissions and limitations under the License.
1313

1414
require 'yaml'
15-
require 'aws-sdk-v1'
15+
require 'aws-sdk'
1616

1717
module AWS::SessionStore::DynamoDB
1818
# This class provides a Configuration object for all DynamoDB transactions
@@ -66,8 +66,7 @@ class Configuration
6666
:lock_expiry_time => 500,
6767
:lock_retry_delay => 500,
6868
:lock_max_wait_time => 1,
69-
:secret_key => nil,
70-
:api_version => '2012-08-10'
69+
:secret_key => nil
7170
}
7271

7372
# @return [String] Session table name.
@@ -203,7 +202,7 @@ def to_hash
203202
# @return [Hash] DDB client.
204203
def gen_dynamo_db_client
205204
client_opts = client_subset(@options)
206-
client = AWS::DynamoDB::Client
205+
client = Aws::DynamoDB::Client
207206
dynamo_db_client = @options[:dynamo_db_client] || client.new(client_opts)
208207
{:dynamo_db_client => dynamo_db_client}
209208
end

lib/aws/session_store/dynamo_db/errors/default_handler.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ module AWS::SessionStore::DynamoDB::Errors
1717
class DefaultHandler < AWS::SessionStore::DynamoDB::Errors::BaseHandler
1818
# Array of errors that will always be passed up the Rack stack.
1919
HARD_ERRORS = [
20-
AWS::DynamoDB::Errors::ResourceNotFoundException,
21-
AWS::DynamoDB::Errors::ConditionalCheckFailedException,
20+
Aws::DynamoDB::Errors::ResourceNotFoundException,
21+
Aws::DynamoDB::Errors::ConditionalCheckFailedException,
2222
AWS::SessionStore::DynamoDB::MissingSecretKeyError,
2323
AWS::SessionStore::DynamoDB::LockWaitTimeoutError
2424
]

lib/aws/session_store/dynamo_db/garbage_collection.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
1313

14-
require 'aws-sdk-v1'
14+
require 'aws-sdk'
1515

1616
module AWS::SessionStore::DynamoDB
1717
# Collects and deletes unwanted sessions based on

lib/aws/session_store/dynamo_db/locking/base.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def delete_session(env, sid)
5656
def handle_error(env = nil, &block)
5757
begin
5858
yield
59-
rescue AWS::DynamoDB::Errors::Base => e
59+
rescue Aws::DynamoDB::Errors::Base => e
6060
@config.error_handler.handle_error(e, env)
6161
end
6262
end

lib/aws/session_store/dynamo_db/locking/pessimistic.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def get_session_with_lock(env, sid)
4343
exceeded_wait_time?(max_attempt_date)
4444
begin
4545
result = attempt_set_lock(sid)
46-
rescue AWS::DynamoDB::Errors::ConditionalCheckFailedException
46+
rescue Aws::DynamoDB::Errors::ConditionalCheckFailedException
4747
expires_at ||= get_expire_date(sid)
4848
next if expires_at.nil?
4949
result = bust_lock(sid, expires_at)

lib/aws/session_store/dynamo_db/rack_middleware.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
require 'rack/session/abstract/id'
1515
require 'openssl'
16-
require 'aws-sdk-v1'
16+
require 'aws-sdk'
1717

1818
module AWS::SessionStore::DynamoDB
1919
# This class is an ID based Session Store Rack Middleware
@@ -99,7 +99,7 @@ def destroy_session(env, sid, options)
9999
def handle_error(env = nil, &block)
100100
begin
101101
yield
102-
rescue AWS::DynamoDB::Errors::Base,
102+
rescue Aws::DynamoDB::Errors::Base,
103103
AWS::SessionStore::DynamoDB::InvalidIDError => e
104104
@config.error_handler.handle_error(e, env)
105105
end

lib/aws/session_store/dynamo_db/table.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
1313

14-
require 'aws-sdk-v1'
14+
require 'aws-sdk'
1515
require 'logger'
1616

1717
module AWS::SessionStore::DynamoDB
@@ -30,7 +30,7 @@ def create_table(options = {})
3030
logger << "Table #{config.table_name} created, waiting for activation...\n"
3131
block_until_created(config)
3232
logger << "Table #{config.table_name} is now ready to use.\n"
33-
rescue AWS::DynamoDB::Errors::ResourceInUseException
33+
rescue Aws::DynamoDB::Errors::ResourceInUseException
3434
logger << "Table #{config.table_name} already exists, skipping creation.\n"
3535
end
3636

spec/aws/session_store/dynamo_db/error/default_error_handler_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
let(:base_app) { MultiplierApplication.new }
2727
let(:app) { AWS::SessionStore::DynamoDB::RackMiddleware.new(base_app, @options) }
28-
let(:client) { double('AWS::DynamoDB::Client') }
28+
let(:client) { double('Aws::DynamoDB::Client') }
2929

3030
context "Error handling for Rack Middleware with default error handler" do
3131
it "raises error for missing secret key" do

spec/aws/session_store/dynamo_db/garbage_collection_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def collect_garbage
9797
}
9898
}
9999

100-
let(:dynamo_db_client) {AWS::DynamoDB::Client.new}
100+
let(:dynamo_db_client) { Aws::DynamoDB::Client.new }
101101

102102
context "Mock DynamoDB client with garbage collection" do
103103

spec/aws/session_store/dynamo_db/locking/threaded_sessions_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def update_item_mock(options, update_method)
7171
get "/"
7272
last_request.session[:multiplier].should eq(1)
7373

74-
t1 = thread_exception(AWS::DynamoDB::Errors::ConditionalCheckFailedException)
74+
t1 = thread_exception(Aws::DynamoDB::Errors::ConditionalCheckFailedException)
7575
t2 = thread(2, 0.25, true)
7676
t1.join
7777
t2.join

spec/aws/session_store/dynamo_db/rack_middleware_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def ensure_data_updated(mutated_data)
4646
end
4747

4848
let(:dynamo_db_client) do
49-
client = double('AWS::DynamoDB::Client')
49+
client = double('Aws::DynamoDB::Client')
5050
client.stub(:delete_item) { 'Deleted' }
5151
client.stub(:list_tables) { {:table_names => ['Sessions']} }
5252
client.stub(:get_item) do

spec/spec_helper.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ def call(env)
3939

4040
ConstantHelpers = lambda do
4141
let(:token_error_msg) { 'The security token included in the request is invalid' }
42-
let(:resource_error) { AWS::DynamoDB::Errors::ResourceNotFoundException }
43-
let(:key_error) { AWS::DynamoDB::Errors::ValidationException.new(key_error_msg) }
42+
let(:resource_error) { Aws::DynamoDB::Errors::ResourceNotFoundException }
43+
let(:key_error) { Aws::DynamoDB::Errors::ValidationException.new(key_error_msg) }
4444
let(:key_error_msg) { 'The provided key element does not match the schema' }
45-
let(:client_error) { AWS::DynamoDB::Errors::UnrecognizedClientException }
45+
let(:client_error) { Aws::DynamoDB::Errors::UnrecognizedClientException }
4646
let(:invalid_cookie) { {"HTTP_COOKIE" => "rack.session=ApplePieBlueberries"} }
4747
let(:invalid_session_data) { {"rack.session"=>{"multiplier" => 1}} }
4848
let(:rack_default_error_msg) { "Warning! AWS::SessionStore::DynamoDB failed to save session. Content dropped.\n" }

0 commit comments

Comments
 (0)