Module: SimpleRecord
- Defined in:
- lib/simple_record/password.rb,
lib/simple_record.rb,
lib/simple_record/stats.rb,
lib/simple_record/errors.rb,
lib/simple_record/encryptor.rb,
lib/simple_record/attributes.rb,
lib/simple_record/exceptions.rb,
lib/simple_record/translations.rb,
lib/simple_record/results_array.rb
Overview
This module defines all the methods that perform data translations for storage and retrieval.
Defined Under Namespace
Modules: Attributes, Callbacks, Encryptor, Password, Translations
Classes: Activerecordtosdb_subrecord_array, Base, PasswordHashed, RecordInvalid, RecordNotSaved, ResultsArray, SimpleRecordError, SimpleRecord_errors, Stats
Constant Summary
collapse
- @@options =
{}
- @@stats =
SimpleRecord::Stats.new
- @@logging =
false
Class Method Summary
collapse
Class Method Details
.close_connection ⇒ Object
84
85
86
|
# File 'lib/simple_record.rb', line 84
def self.close_connection()
Aws::ActiveSdb.close_connection
end
|
.disable_logging ⇒ Object
51
52
53
|
# File 'lib/simple_record.rb', line 51
def self.disable_logging
@@logging = false
end
|
.enable_logging ⇒ Object
47
48
49
|
# File 'lib/simple_record.rb', line 47
def self.enable_logging
@@logging = true
end
|
.establish_connection(aws_access_key = nil, aws_secret_key = nil, params = {}) ⇒ Object
Create a new handle to an Sdb account. All handles share the same per process or per thread HTTP connection to Amazon Sdb. Each handle is for a specific account. The params are passed through as-is to Aws::SdbInterface.new Params:
{ :server => 'sdb.amazonaws.com'
:port => 443
:protocol => 'https'
:signature_version => '0'
:connection_mode => :default
:default (will use best known safe (as in won't need explicit close) option, may change in the future)
:per_request (opens and closes a connection on every request to SDB)
:single (one thread across entire app)
:per_thread (one connection per thread)
:pool (uses a connection pool with a maximum number of connections - NOT IMPLEMENTED YET)
:logger => Logger Object # Logger instance: logs to STDOUT if omitted
78
79
80
81
82
|
# File 'lib/simple_record.rb', line 78
def self.establish_connection(aws_access_key=nil, aws_secret_key=nil, params={})
@@options.merge!(params)
puts 'SimpleRecord.establish_connection with options: ' + @@options.inspect
Aws::ActiveSdb.establish_connection(aws_access_key, aws_secret_key, @@options)
end
|
.logging? ⇒ Boolean
55
56
57
|
# File 'lib/simple_record.rb', line 55
def self.logging?
@@logging
end
|
.options ⇒ Object
88
89
90
|
# File 'lib/simple_record.rb', line 88
def self.options
@@options
end
|
.stats ⇒ Object
59
60
61
|
# File 'lib/simple_record.rb', line 59
def self.stats
@@stats
end
|