Class: Queuel::SQS::Message

Inherits:
Base::Message show all
Defined in:
lib/queuel/sqs/message.rb

Defined Under Namespace

Classes: BucketDoesNotExistError, InsufficientPermissions, NoBucketNameSupplied

Instance Attribute Summary

Attributes inherited from Base::Message

#body, #id, #queue

Instance Method Summary collapse

Methods inherited from Base::Message

#empty?, #initialize, #present?

Constructor Details

This class inherits a constructor from Queuel::Base::Message

Instance Method Details

#-(write) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/queuel/sqs/message.rb', line 57

def s3_transaction(method, *args)
  bucket_name = options[:s3_bucket_name]
  raise NoBucketNameSupplied if bucket_name.nil?
  my_bucket = s3.buckets[bucket_name]
  if my_bucket.exists?
    begin
      send("s3_#{method}", my_bucket, *args)
    rescue AWS::S3::Errors::AccessDenied => e
      raise InsufficientPermissions, "Unable to read from bucket: #{e.message}"
    end
  else
    raise BucketDoesNotExistError, "Bucket has either expired or does not exist"
  end
end

#deleteObject



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

def delete
  message_object.delete
end

#raw_bodyObject



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

def raw_body
  @raw_body ||= message_object ? pull_message : push_message
end