Class: Sqs::Queue
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #attributes ⇒ Object
- #create_message(body) ⇒ Object
- #destroy ⇒ Object
-
#initialize(service, url) ⇒ Queue
constructor
:nodoc:.
-
#inspect ⇒ Object
:nodoc:.
- #message(visibility_timeout = nil) ⇒ Object
- #update_attributes(attributes) ⇒ Object
Constructor Details
#initialize(service, url) ⇒ Queue
:nodoc:
47 48 49 50 |
# File 'lib/sqs/queue.rb', line 47 def initialize(service, url) #:nodoc: self.service = service self.url = url end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/sqs/queue.rb', line 5 def name @name end |
#path ⇒ Object
Returns the value of attribute path.
5 6 7 |
# File 'lib/sqs/queue.rb', line 5 def path @path end |
#service ⇒ Object
Returns the value of attribute service.
5 6 7 |
# File 'lib/sqs/queue.rb', line 5 def service @service end |
Instance Method Details
#==(other) ⇒ Object
9 10 11 |
# File 'lib/sqs/queue.rb', line 9 def ==(other) self.name == other.name and self.service == other.service end |
#attributes ⇒ Object
18 19 20 21 |
# File 'lib/sqs/queue.rb', line 18 def attributes response = queue_request({ :params => { "Action" => "GetQueueAttributes", "AttributeName" => "All" }}) parse_get_queue_attributes_result(response.body) end |
#create_message(body) ⇒ Object
32 33 34 |
# File 'lib/sqs/queue.rb', line 32 def (body) response = queue_request(:params => { "Action" => "SendMessage", "MessageBody" => body }) end |
#destroy ⇒ Object
13 14 15 16 |
# File 'lib/sqs/queue.rb', line 13 def destroy queue_request({ :params => { "Action" => "DeleteQueue" } }) true end |
#inspect ⇒ Object
:nodoc:
43 44 45 |
# File 'lib/sqs/queue.rb', line 43 def inspect #:nodoc: "#<#{self.class}:#{name}>" end |
#message(visibility_timeout = nil) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/sqs/queue.rb', line 36 def (visibility_timeout = nil) params = {} params["VisibilityTimeout"] = visibility_timeout.to_s if visibility_timeout response = queue_request(:params => params.merge("Action" => "ReceiveMessage")) (response.body).first end |
#update_attributes(attributes) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/sqs/queue.rb', line 23 def update_attributes(attributes) set_attributes = {} attributes.each_with_index do |attribute, i| set_attributes["Attribute.#{i + 1}.Name"] = attribute.first.to_s set_attributes["Attribute.#{i + 1}.Value"] = attribute.last.to_s end response = queue_request(:params => set_attributes.merge("Action" => "SetQueueAttributes")) end |