Sha256: a877b81d4149e4028dadc9b3f1b7705f895bfe87199d9c898062048366e06a60

Contents?: true

Size: 1.87 KB

Versions: 21

Compression:

Stored size: 1.87 KB

Contents

module Fog
  module Rackspace
    class Queues
      class Real

        # 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.
        # If no unclaimed messages are available, the API returns a 204 No Content message.
        #
        # @param [String] queue_name Specifies the name of the queue.
        # @param [Integer] ttl The ttl attribute specifies how long the server waits before releasing the claim. The ttl value must be between 60 and 43200 seconds (12 hours).
        # @param [Integer] grace The grace attribute specifies the message grace period in seconds. The value of grace value must be between 60 and 43200 seconds (12 hours).
        # @param [Hash] options
        # @option options [Integer] :limit - Specifies the number of messages to return, up to 20 messages. If limit is not specified, limit defaults to 10.
        # @return [Excon::Response] response
        # @raise [Fog::Rackspace::Queues::NotFound] - HTTP 404
        # @raise [Fog::Rackspace::Queues::BadRequest] - HTTP 400
        # @raise [Fog::Rackspace::Queues::InternalServerError] - HTTP 500
        # @raise [Fog::Rackspace::Queues::ServiceError]
        # @see http://docs.rackspace.com/queues/api/v1.0/cq-devguide/content/POST_claimMessages__version__queues__queue_name__claims_claims-operations-dle001.html
        def create_claim(queue_name, ttl, grace, options = {})
          body = {
            :ttl => ttl,
            :grace => grace
          }

          query = {}
          query[:limit] = options[:limit] if options.has_key? :limit
          request(
            :body => Fog::JSON.encode(body),
            :expects => [200, 201, 204],
            :method => 'POST',
            :path => "queues/#{queue_name}/claims",
            :query => query
          )
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
fog-maestrodev-1.19.0.20140212012611 lib/fog/rackspace/requests/queues/create_claim.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/rackspace/requests/queues/create_claim.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/rackspace/requests/queues/create_claim.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/rackspace/requests/queues/create_claim.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/rackspace/requests/queues/create_claim.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/rackspace/requests/queues/create_claim.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/rackspace/requests/queues/create_claim.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/rackspace/requests/queues/create_claim.rb
fog-1.19.0 lib/fog/rackspace/requests/queues/create_claim.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/rackspace/requests/queues/create_claim.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/rackspace/requests/queues/create_claim.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/rackspace/requests/queues/create_claim.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/rackspace/requests/queues/create_claim.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/rackspace/requests/queues/create_claim.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/rackspace/requests/queues/create_claim.rb
fog-maestrodev-1.18.0.20131209090811 lib/fog/rackspace/requests/queues/create_claim.rb
fog-maestrodev-1.18.0.20131206115947 lib/fog/rackspace/requests/queues/create_claim.rb
fog-maestrodev-1.18.0.20131205181604 lib/fog/rackspace/requests/queues/create_claim.rb
fog-maestrodev-1.18.0.20131127194823 lib/fog/rackspace/requests/queues/create_claim.rb
fog-maestrodev-1.18.0.20131126183714 lib/fog/rackspace/requests/queues/create_claim.rb