Class: RAWS::SQS::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/raws/sqs/message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(queue, data) ⇒ Message

Returns a new instance of Message.



5
6
7
# File 'lib/raws/sqs/message.rb', line 5

def initialize(queue, data)
  @queue, @data = queue, data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



3
4
5
# File 'lib/raws/sqs/message.rb', line 3

def data
  @data
end

#queueObject (readonly)

Returns the value of attribute queue.



2
3
4
# File 'lib/raws/sqs/message.rb', line 2

def queue
  @queue
end

Instance Method Details

#attributesObject Also known as: attrs



22
23
24
# File 'lib/raws/sqs/message.rb', line 22

def attributes
  data['Attribute']
end

#bodyObject



27
28
29
# File 'lib/raws/sqs/message.rb', line 27

def body
  data['Body']
end

#change_visibility(visibility_timeout) ⇒ Object Also known as: visibility=



31
32
33
# File 'lib/raws/sqs/message.rb', line 31

def change_visibility(visibility_timeout)
  queue.change_message_visibility receipt_handle, visibility_timeout
end

#deleteObject



36
37
38
# File 'lib/raws/sqs/message.rb', line 36

def delete
  queue.delete_message receipt_handle
end

#md5_of_bodyObject



18
19
20
# File 'lib/raws/sqs/message.rb', line 18

def md5_of_body
  data['MD5OfBody']
end

#message_idObject Also known as: id



9
10
11
# File 'lib/raws/sqs/message.rb', line 9

def message_id
  data['MessageId']
end

#receipt_handleObject



14
15
16
# File 'lib/raws/sqs/message.rb', line 14

def receipt_handle
  data['ReceiptHandle']
end