Parent

RightAws::Sqs::Grantee

Attributes

email[RW]
id[RW]
name[RW]
perms[RW]
queue[RW]

Public Class Methods

new(queue, email=nil, id=nil, name=nil, perms=[]) click to toggle source

Creates new Grantee instance. To create new grantee for queue use:

grantee = Grantee.new(queue, grantee@email.address)
grantee.grant('FULLCONTROL')
# File lib/sqs/right_sqs.rb, line 324
def initialize(queue, email=nil, id=nil, name=nil, perms=[])
  @queue = queue
  @id    = id
  @name  = name
  @perms = perms
  @email = email
  retrieve unless id
end

Public Instance Methods

drop() click to toggle source

Revokes all permissions for this grantee. Returns true

# File lib/sqs/right_sqs.rb, line 377
def drop
  @perms.each do |permission|
    @queue.sqs.interface.remove_grant(@queue.url, @email || @id, permission)
  end
  retrieve
  true
end
grant(permission=nil) click to toggle source

Adds permissions for grantee. Permission: 'FULLCONTROL' | 'RECEIVEMESSAGE' | 'SENDMESSAGE'. The caller must have set the email instance variable.

# File lib/sqs/right_sqs.rb, line 354
def grant(permission=nil)
  raise "You can't grant permission without defining a grantee email address!" unless @email
  @queue.sqs.interface.add_grant(@queue.url, @email, permission)
  retrieve
end
revoke(permission='FULLCONTROL') click to toggle source

Revokes permissions for grantee. Permission: 'FULLCONTROL' | 'RECEIVEMESSAGE' | 'SENDMESSAGE'. Default value is 'FULLCONTROL'. User must have +@email+ or +@id+ set. Returns true.

# File lib/sqs/right_sqs.rb, line 365
def revoke(permission='FULLCONTROL')
  @queue.sqs.interface.remove_grant(@queue.url, @email || @id, permission)
  unless @email   # if email is unknown - just remove permission from local perms list...
    @perms.delete(permission)
  else            # ... else retrieve updated information from Amazon
    retrieve
  end
  true
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.