Class: Sqs::Service
- Inherits:
-
Object
- Object
- Sqs::Service
- Extended by:
- Roxy::Moxie
- Defined in:
- lib/sqs/service.rb
Instance Attribute Summary collapse
-
#access_key_id ⇒ Object
readonly
Returns the value of attribute access_key_id.
-
#secret_access_key ⇒ Object
readonly
Returns the value of attribute secret_access_key.
-
#use_ssl ⇒ Object
readonly
Returns the value of attribute use_ssl.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Compares service to other, by access_key_id and secret_access_key.
-
#initialize(options) ⇒ Service
constructor
Parameters:
options:: a hash of options described below. -
#inspect ⇒ Object
:nodoc:.
-
#port ⇒ Object
Return 443 or 80, depends on use_ssl value from initializer.
-
#protocol ⇒ Object
Returns “http://” or “https://”, depends on use_ssl value from initializer.
-
#queues(reload = false) ⇒ Object
Returns all queues in the service and caches the result (see reload).
Methods included from Roxy::Moxie
Constructor Details
#initialize(options) ⇒ Service
Parameters:
options-
a hash of options described below
Options:
access_key_id-
Amazon access key id, required
secret_access_key-
Amazon secret access key, required
use_ssl-
true if use ssl in connection, otherwise false
timeout-
parameter for Net::HTTP module
debug-
prints the raw requests to STDOUT
21 22 23 24 25 26 27 |
# File 'lib/sqs/service.rb', line 21 def initialize() @access_key_id = [:access_key_id] or raise ArgumentError.new("No access key id given") @secret_access_key = [:secret_access_key] or raise ArgumentError.new("No secret access key given") @use_ssl = [:use_ssl] @timeout = [:timeout] @debug = [:debug] end |
Instance Attribute Details
#access_key_id ⇒ Object (readonly)
Returns the value of attribute access_key_id.
5 6 7 |
# File 'lib/sqs/service.rb', line 5 def access_key_id @access_key_id end |
#secret_access_key ⇒ Object (readonly)
Returns the value of attribute secret_access_key.
5 6 7 |
# File 'lib/sqs/service.rb', line 5 def secret_access_key @secret_access_key end |
#use_ssl ⇒ Object (readonly)
Returns the value of attribute use_ssl.
5 6 7 |
# File 'lib/sqs/service.rb', line 5 def use_ssl @use_ssl end |
Instance Method Details
#==(other) ⇒ Object
Compares service to other, by access_key_id and secret_access_key
8 9 10 |
# File 'lib/sqs/service.rb', line 8 def ==(other) self.access_key_id == other.access_key_id and self.secret_access_key == other.secret_access_key end |
#inspect ⇒ Object
:nodoc:
84 85 86 |
# File 'lib/sqs/service.rb', line 84 def inspect #:nodoc: "#<#{self.class}:#@access_key_id>" end |
#port ⇒ Object
Return 443 or 80, depends on use_ssl value from initializer
44 45 46 |
# File 'lib/sqs/service.rb', line 44 def port use_ssl ? 443 : 80 end |
#protocol ⇒ Object
Returns “http://” or “https://”, depends on use_ssl value from initializer
39 40 41 |
# File 'lib/sqs/service.rb', line 39 def protocol use_ssl ? "https://" : "http://" end |
#queues(reload = false) ⇒ Object
Returns all queues in the service and caches the result (see reload)
30 31 32 33 34 35 36 |
# File 'lib/sqs/service.rb', line 30 def queues(reload = false) if reload or @queues.nil? @queues = list_queues else @queues end end |