Class: Fog::Rackspace::Queues::Messages
- Inherits:
-
Collection
- Object
- Collection
- Fog::Rackspace::Queues::Messages
- Defined in:
- lib/fog/rackspace/models/queues/messages.rb
Instance Attribute Summary collapse
-
#client_id ⇒ String
UUID for the client instance.
-
#echo ⇒ Boolean
Determines whether the API returns a client’s own messages.
-
#include_claimed ⇒ String
Determines whether the API returns claimed messages and unclaimed messages.
-
#limit ⇒ String
When more messages are available than can be returned in a single request, the client can pick up the next batch of messages by simply using the URI template parameters returned from the previous call in the “next” field.
-
#marker ⇒ String
Specifies an opaque string that the client can use to request the next batch of messages.
-
#queue ⇒ String
The name of the queue associated with the message.
Instance Method Summary collapse
-
#all ⇒ Fog::Rackspace::Queues::Messages
Returns list of messages.
-
#get(message_id) ⇒ Fog::Rackspace::Queues::Claim
Returns the specified message from the queue.
Instance Attribute Details
#client_id ⇒ String
Returns UUID for the client instance.
12 13 14 |
# File 'lib/fog/rackspace/models/queues/messages.rb', line 12 def client_id @client_id end |
#echo ⇒ Boolean
Determines whether the API returns a client’s own messages. The echo parameter is a Boolean value (true or false) that determines whether the API returns a client’s own messages, as determined by the uuid portion of the User-Agent header. If you do not specify a value, echo uses the default value of false. If you are experimenting with the API, you might want to set echo=true in order to see the messages that you posted.
22 23 24 |
# File 'lib/fog/rackspace/models/queues/messages.rb', line 22 def echo @echo end |
#include_claimed ⇒ String
Returns Determines whether the API returns claimed messages and unclaimed messages. The include_claimed parameter is a Boolean value (true or false) that determines whether the API returns claimed messages and unclaimed messages. If you do not specify a value, include_claimed uses the default value of false (only unclaimed messages are returned).
39 40 41 |
# File 'lib/fog/rackspace/models/queues/messages.rb', line 39 def include_claimed @include_claimed end |
#limit ⇒ String
Returns When more messages are available than can be returned in a single request, the client can pick up the next batch of messages by simply using the URI template parameters returned from the previous call in the “next” field. Specifies up to 10 messages (the default value) to return. If you do not specify a value for the limit parameter, the default value of 10 is used.
28 29 30 |
# File 'lib/fog/rackspace/models/queues/messages.rb', line 28 def limit @limit end |
#marker ⇒ String
Returns Specifies an opaque string that the client can use to request the next batch of messages. The marker parameter communicates to the server which messages the client has already received. If you do not specify a value, the API returns all messages at the head of the queue (up to the limit).
33 34 35 |
# File 'lib/fog/rackspace/models/queues/messages.rb', line 33 def marker @marker end |
#queue ⇒ String
Returns The name of the queue associated with the message.
16 17 18 |
# File 'lib/fog/rackspace/models/queues/messages.rb', line 16 def queue @queue end |
Instance Method Details
#all ⇒ Fog::Rackspace::Queues::Messages
Returns list of messages
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/fog/rackspace/models/queues/messages.rb', line 47 def all requires :client_id, :queue response = service.(client_id, queue.name, ) if response.status == 204 data = [] else data = response.body['messages'] end load(data) end |
#get(message_id) ⇒ Fog::Rackspace::Queues::Claim
Returns the specified message from the queue.
65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/fog/rackspace/models/queues/messages.rb', line 65 def get() requires :client_id, :queue data = service.(client_id, queue.name, ).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 |