Class: Ramazon::Configuration
- Inherits:
-
Object
- Object
- Ramazon::Configuration
- Defined in:
- lib/ramazon/configuration.rb
Overview
the class that persists configuration information for Amazon requests
Constant Summary collapse
- LOCALES =
[:ca, :de, :fr, :jp, :uk, :us]
Class Method Summary collapse
-
.access_key ⇒ Object
get the current access key.
-
.access_key=(key) ⇒ Object
set the current access key.
-
.base_uri ⇒ Object
get the correct host based on your locale.
-
.locale ⇒ Object
get the current locale (defaults to the us).
-
.locale=(locale) ⇒ Object
set the locale for future requests will raise an exception if the locale isn’t in the Configuration::LOCALES collection.
-
.path ⇒ Object
get the path where requests should be dispatched to.
-
.secret_key ⇒ Object
get the current secret key that is used for request signing.
-
.secret_key=(key) ⇒ Object
set the secret key so that requests can be appropriately signed.
-
.uri ⇒ Object
get the full path including locale specific host and /onca/xml path.
Class Method Details
.access_key ⇒ Object
get the current access key
23 24 25 |
# File 'lib/ramazon/configuration.rb', line 23 def access_key configatron.ramazon.access_key end |
.access_key=(key) ⇒ Object
set the current access key
29 30 31 |
# File 'lib/ramazon/configuration.rb', line 29 def access_key=(key) configatron.ramazon.access_key = key end |
.base_uri ⇒ Object
get the correct host based on your locale
45 46 47 48 49 50 51 |
# File 'lib/ramazon/configuration.rb', line 45 def base_uri if locale == :us "http://ecs.amazonaws.com" else "http://ecs.amazonaws.#{locale}" end end |
.locale ⇒ Object
get the current locale (defaults to the us)
18 19 20 |
# File 'lib/ramazon/configuration.rb', line 18 def locale configatron.ramazon.locale || :us end |
.locale=(locale) ⇒ Object
set the locale for future requests will raise an exception if the locale isn’t in the Configuration::LOCALES collection
9 10 11 12 13 14 15 |
# File 'lib/ramazon/configuration.rb', line 9 def locale=(locale) if LOCALES.include?(locale) configatron.ramazon.locale = locale else raise "unknown locale" end end |
.path ⇒ Object
get the path where requests should be dispatched to
59 60 61 |
# File 'lib/ramazon/configuration.rb', line 59 def path "/onca/xml" end |
.secret_key ⇒ Object
get the current secret key that is used for request signing
34 35 36 |
# File 'lib/ramazon/configuration.rb', line 34 def secret_key configatron.ramazon.secret_key end |
.secret_key=(key) ⇒ Object
set the secret key so that requests can be appropriately signed
40 41 42 |
# File 'lib/ramazon/configuration.rb', line 40 def secret_key=(key) configatron.ramazon.secret_key = key end |
.uri ⇒ Object
get the full path including locale specific host and /onca/xml path
54 55 56 |
# File 'lib/ramazon/configuration.rb', line 54 def uri "#{base_uri}#{path}" end |