Class: Fog::Rackspace::Queues::Claims

Inherits:
Collection
  • Object
show all
Defined in:
lib/fog/rackspace/models/queues/claims.rb

Instance Attribute Summary collapse

Attributes inherited from Collection

#service

Instance Method Summary collapse

Methods inherited from Collection

#clear, #destroy, #initialize, #inspect, #load, model, #model, #new, #reload, #table, #to_json

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one

Constructor Details

This class inherits a constructor from Fog::Collection

Instance Attribute Details

#queueString

Returns The queue associated with the claim collection.

Returns:

  • (String)

    The queue associated with the claim collection



13
14
15
# File 'lib/fog/rackspace/models/queues/claims.rb', line 13

def queue
  @queue
end

Instance Method Details

#allFog::Rackspace::Queues::Claims

Note:

The Rackspace Cloud does not currently provide a way to retrieve claims as such this list is maintained by fog. Claims are added to the claim collection

Returns list of claims as they are created.



23
24
25
# File 'lib/fog/rackspace/models/queues/claims.rb', line 23

def all
  self
end

#create(attributes = {}) ⇒ Fog::Rackspace::Queues::Claim

This operation claims a set of messages (up to the value of the limit parameter) from oldest to newest and skips any messages that are already claimed.



34
35
36
37
38
39
40
41
# File 'lib/fog/rackspace/models/queues/claims.rb', line 34

def create(attributes = {})
  object = new(attributes)
  if object.save
    object
  else
    false
  end
end

#get(claim_id) ⇒ Fog::Rackspace::Queues::Claim

This operation queries the specified claim for the specified queue. Claims with malformed IDs or claims that are not found by ID are ignored.



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/fog/rackspace/models/queues/claims.rb', line 51

def get(claim_id)
  requires :queue
  data = service.get_claim(queue.identity, claim_id).body
  new(data)
rescue Fog::Rackspace::Queues::NotFound
  nil
# HACK - This has been escalated to the Rackspace Queues team, as this 
# behavior is not normal HTTP behavior.
rescue Fog::Rackspace::Queues::ServiceError
  nil
end