1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/rackspace/requests/queues/update_claim.rb
2014-01-21 09:19:17 -05:00

43 lines
1.3 KiB
Ruby

module Fog
module Rackspace
class Queues
class Real
# This operation posts the specified message or messages.
# @note You can submit up to 10 messages in a single request.
#
# @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).
# @see http://docs.rackspace.com/queues/api/v1.0/cq-devguide/content/PATCH_updateClaim__version__queues__queue_name__claims__claimId__claims-operations-dle001.html
def update_claim(queue_name, claim_id, ttl)
body = {
:ttl => ttl
}
request(
:body => Fog::JSON.encode(body),
:expects => 204,
:method => 'PATCH',
:path => "queues/#{queue_name}/claims/#{claim_id}"
)
end
end
class Mock
def update_claim(queue_name, claim_id, ttl)
queue = mock_queue!(queue_name)
claim = queue.claim!(claim_id)
claim.touch!
claim.ttl = ttl
response = Excon::Response.new
response.status = 204
response
end
end
end
end
end